Migrating from v1 to v2
SymbolicRegression.jl v2 restructures the internals around a composable plugin interface, first-class mutation types, and customizable crossover operations. Almost all v1 code still runs without modification: the breaking surface is behavioral rather than syntactic. This page lists what to check when upgrading from v1.13.
Behavioral changes
Your code will run unchanged, but search results will differ:
Adaptive mutation weights are now on by default. Mutation weights adapt over the course of the search via
AdaptiveMutationWeightsPlugin. To recover static v1 weights, choose the default plugin set explicitly:juliaOptions(; default_plugins=(SimulatedAnnealingPlugin(; alpha=3.17), AdaptiveParsimonyPlugin()) )batchingnow defaults to:auto. Large datasets are evaluated in batches automatically, withbatch_sizechosen for you when not set. Restore v1 behavior withbatching=false, batch_size=50.crossover_probabilitynow defaults to0.20(was0.0259).Simplification recomputes cost. After a tree is simplified, its cost is recomputed from scratch, so
PopMember.costcan differ from v1 for an equivalent expression.Constant-optimization restarts can now escape zero-valued constants, so optimization trajectories (and therefore results) differ from v1.
All other defaults are unchanged from v1.13.
Renames (deprecated shims in place)
These still work but emit deprecation warnings:
eval_options=is noweval_context=in evaluation entry points.use_recorder/recorder_fileare nowuse_tracing/tracing_file; recorder output is streamed as JSONL traces.PopMember.scoreis nowPopMember.cost.camelCase keyword arguments (
mutationWeights,useFrequency,shouldOptimizeConstants, ...) are deprecated in favor of snake_case.
Removed
ParametricExpressionis removed. UseTemplateExpressionwith optimizable parameters instead.Options,SearchState, andTemplateExpressionSpecgained type parameters, which changes their concrete type arity.SearchStatealso replacesall_running_search_statisticswithplugin_states.The internal mutation helpers
delete_random_op!and_random_opwere generalized to n-ary operators. This only affects code that defines custom mutations against internals.
v1 keyword arguments that still work
These are converted automatically to the new plugin/mutation configuration, and need no changes:
mutation_weights(including a plain vector via the deprecatedmutationWeightsspelling) is converted to weighted first-class mutations.annealing/alphainject aSimulatedAnnealingPlugin.use_frequency/use_frequency_in_tournamentconfigure theAdaptiveParsimonyPlugin.perturbation_factor/probability_negate_constantare applied to the defaultConstantMutation.
New APIs
Plugins:
Options(; plugins=(MyPlugin(),))composes search behaviors. See the Plugins page for the hook set and a worked example.First-class mutations: pass
mutations=[MutateConstant() => 1.0, ...]or subtypeAbstractMutation; see Customization.Custom crossovers: subtype
AbstractCrossoverand passcrossovers=[MyCrossover() => 1.0, ...].MLJ-free interface:
machine,fit!,predict, andreportwork without loading MLJ.