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

Custom loss functions - v0.5.0 #28

Merged
merged 5 commits into from
Feb 12, 2021
Merged

Custom loss functions - v0.5.0 #28

merged 5 commits into from
Feb 12, 2021

Conversation

MilesCranmer
Copy link
Owner

@MilesCranmer MilesCranmer commented Feb 11, 2021

This will move PySR to v0.5.0 of SymbolicRegression.jl (once that version is added to the registry).

This also enables custom loss functions via the loss kwarg. One can define a loss using the functions available (e.g., L2DistLoss() or L1DistLoss()), or pass a function definition like this:

pysr(..., loss="myloss(x, y) = abs(x - y)")

or, for weighted, e.g.,

pysr(..., loss="myloss(x, y, w) = abs(x - y) * w")

This is slower than using the built-in losses but more convenient for defining new ones.

@MilesCranmer MilesCranmer marked this pull request as ready for review February 12, 2021 08:05
@MilesCranmer MilesCranmer merged commit 0b34329 into master Feb 12, 2021
@MilesCranmer MilesCranmer deleted the v0.5.0-rc1 branch February 12, 2021 08:05
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.

1 participant