Skip to content

Taking Derivatives of Candidate Expression Inside Custom Loss Function #299

Answered by MilesCranmer
gopal-iyer asked this question in Q&A
Discussion options

You must be logged in to vote

I think this would be easiest done on the SymPy side. You can get the expressions with, e.g., model.sympy(i), where i is the index of the expression you want to get. Then, you can compute derivatives with sympy.diff: https://docs.sympy.org/latest/tutorials/intro-tutorial/calculus.html#derivatives

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@MilesCranmer
Comment options

Answer selected by gopal-iyer
@gopal-iyer
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
Converted from issue

This discussion was converted from issue #296 on April 19, 2023 18:16.