Introducing new variables in custom loss function #385
-
Hi Dr. Cranmer (or others), For the PySR custom loss function (loss = "loss(x,y, w[optional]) = ") we specify in the model, right now it seems "x" is the data input while "y" is the analytic value found by PySR, and w are any weights the data has (which is optional), though please correct me if I misunderstood the variables (and this could potentially solve my problem). However, if I'm using PySR to model something very specific (i.e. Poisson likelihood) and have a custom loss function that also depends on other variables ( data x = x(r), where I also want to include r in the loss function), is there a way to do this? https://astroautomata.com/PySR/options/#loss has some nice examples of loss functions, but not introducing any other variables than the data "x" and fit value "y". |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @quasars100, The loss argument is of the form cheers, |
Beta Was this translation helpful? Give feedback.
-
Oh wait I think I misunderstood. Do you need weights and the radius r? If you only need the radius in the loss function, you can just treat it like |
Beta Was this translation helpful? Give feedback.
Exactly!
They are called "weights" because the standard loss function treats them as regular statistical weightings. But if you are writing a custom loss function anyways, you can use them however you like.