Skip to content

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.
@github-actions
Copy link
Contributor

github-actions bot commented Dec 30, 2024

Benchmark Results

master 1699da6... master/1699da6650abd0...
search/multithreading 16.6 ± 0.51 s 16.9 ± 0.63 s 0.986
search/serial 28.5 ± 0.24 s 26.6 ± 0.57 s 1.07
utils/best_of_sample 1.72 ± 0.98 μs 1.7 ± 0.57 μs 1.01
utils/check_constraints_x10 12.2 ± 3.4 μs 12.3 ± 3.4 μs 0.989
utils/compute_complexity_x10/Float64 2.13 ± 0.1 μs 2.14 ± 1.5 μs 0.995
utils/compute_complexity_x10/Int64 2.09 ± 1.6 μs 2.15 ± 1.5 μs 0.972
utils/compute_complexity_x10/nothing 1.51 ± 0.08 μs 1.48 ± 1.5 μs 1.02
utils/insert_random_op_x10 6.09 ± 2.7 μs 5.75 ± 1.9 μs 1.06
utils/next_generation_x100 0.405 ± 0.097 ms 0.357 ± 0.099 ms 1.14
utils/optimize_constants_x10 0.0343 ± 0.0085 s 0.0348 ± 0.0083 s 0.984
utils/randomly_rotate_tree_x10 5.52 ± 0.73 μs 5.43 ± 0.73 μs 1.02
time_to_load 1.76 ± 0.0045 s 1.77 ± 0.006 s 0.998

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 13093567852

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
@atharvas atharvas force-pushed the customize-mlj-interface branch from 3bf5b68 to e6a502d Compare January 21, 2025 00:43
This allows us the SRFitResult struct for LaSR. It shouldn't cause any conflicts with upstream code.
@atharvas
Copy link
Contributor Author

@MilesCranmer might need your help debugging this. The test case for parametric expressions with the Zygote autodiff seem to be failing even on the SymbolicRegression master branch.

@MilesCranmer
Copy link
Owner

Sorry for the delay. This turned out to be from an update to DifferentiationInterface.jl which has since been fixed:

Just waiting on a release now.

Copy link
Owner

@MilesCranmer MilesCranmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!!

@MilesCranmer MilesCranmer merged commit ddb7efb into MilesCranmer:master Feb 2, 2025
17 checks passed
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