Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add abstract types for single- and multi-target MLJ Regressors. #398

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

atharvas
Copy link
Contributor

Right now, SRRegressor and MultitargetSRRegressor subtype AbstractSRRegresor. However, much of the src/MLJInterface.jl code dispatches on either SRRegressor or MultitargetSRRegressor. This creates a bottleneck for defining custom MLJInterfaces and forces redefinition of much of src/MLJInterface.jl. The commit addresses this by introducing two new types, SingletargetAbstractSRRegressor and MultitargetAbstractSRRegressor, and changes the logic in src/MLJInterface.jl to dispatch on these types instead.

Note: This approach is kind of janky as it solves the reuse problem using multiple inheritance (which might cause problems of its own if abused). This can be trimmed further / I'm open to rethinking this.

…ressor objects.

Right now, SRRegressor and MultitargetSRRegressor subtype AbstractSRRegresor. However, much of the `src/MLJInterface.jl` code dispatches on either SRRegressor or MultitargetSRRegressor. This creates a bottleneck for defining custom MLJInterfaces and forces redefinition of much of `src/MLJInterface.jl`. The commit addresses this by introducing two new types, SingletargetAbstractSRRegressor and MultitargetAbstractSRRegressor, and changes logic in `src/MLJInterface.jl` to dispatch on these types instead.

Note: This approach is kind of janky as it solves the reuse problem using multiple inheritence (which might cause problems of its own if abused). This can be trimmed further / I'm open to rethinking this.
Copy link
Contributor

github-actions bot commented Dec 30, 2024

Benchmark Results

master e6a502d... master/e6a502d8c102da...
search/multithreading 17.7 ± 0.82 s 17.3 ± 2.1 s 1.02
search/serial 28.9 ± 1.1 s 30 ± 1.2 s 0.965
utils/best_of_sample 1.63 ± 0.42 μs 1.76 ± 0.72 μs 0.926
utils/check_constraints_x10 11.4 ± 3 μs 11.3 ± 2.9 μs 1.02
utils/compute_complexity_x10/Float64 2.11 ± 0.09 μs 2.12 ± 0.1 μs 0.995
utils/compute_complexity_x10/Int64 2.11 ± 1.6 μs 2.11 ± 1.5 μs 1
utils/compute_complexity_x10/nothing 1.53 ± 0.08 μs 1.49 ± 0.1 μs 1.03
utils/insert_random_op_x10 5.71 ± 1.8 μs 5.81 ± 1.8 μs 0.984
utils/next_generation_x100 0.35 ± 0.092 ms 0.359 ± 0.098 ms 0.977
utils/optimize_constants_x10 0.0338 ± 0.0079 s 0.0356 ± 0.0086 s 0.951
utils/randomly_rotate_tree_x10 5.41 ± 0.7 μs 5.43 ± 0.73 μs 0.996
time_to_load 1.89 ± 0.027 s 1.94 ± 0.0042 s 0.975

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.
Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

@MilesCranmer
Copy link
Owner

Sounds good to me. One minor thing is it should be AbstractMultitargetSRRegressor per usual Julia style of Abstract going at the start of the type name. So perhaps AbstractSRRegressor should be named to AbstractSymbolicRegressor or something, so it sounds more "general"?

@coveralls
Copy link

coveralls commented Jan 6, 2025

Pull Request Test Coverage Report for Build 12680133314

Details

  • 14 of 15 (93.33%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 94.786%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/MLJInterface.jl 13 14 92.86%
Totals Coverage Status
Change from base Build 12680128577: 0.0%
Covered Lines: 3163
Relevant Lines: 3337

💛 - Coveralls

@MilesCranmer MilesCranmer marked this pull request as ready for review January 8, 2025 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants