Skip to content

Manipulating identified expressions using a custom loss function #303

Answered by MilesCranmer
TadeuNP asked this question in Q&A
Discussion options

You must be logged in to vote

So I can define a custom loss function that will act different every/after n iterations or evaluate less complex solutions with a slightly different formula.

This is not allowed because the loss values are cached, so they may be out-of-date in one when comparing two individuals. Instead what you should do is restart the search (pass in the saved_state) with a different loss function, which will trigger all existing loss values to be cleared in the saved state.

options = Options(return_state=true)
hof, state = EquationSearch(...)

# change loss function and create new Options

hof, state = EquationSearch(..., saved_state=(hof, state))

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@TadeuNP
Comment options

@MilesCranmer
Comment options

Answer selected by TadeuNP
@TadeuNP
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
PySR PySR-related discussion SymbolicRegression.jl SymbolicRegression.jl-related discussion
2 participants