Confusion with custon operator definition #522
Unanswered
anubhavkamal
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Keep in mind it’s going to try many different things as input to your operator; not just the dataset feature itself. Because you have cheers, |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
def p(i):
if i < 20.0:
return sympy.log(27.1285645162762 - 1.42277605519119i)
else:
return float("nan")
model = pysr.PySRRegressor(
turbo=True,
maxsize=30,
batching=True,
warm_start=True,
model_selection='best',
niterations=40000,
precision = 64,
binary_operators=['+','-','','/'],
#unary_operators=['exp', 'log'],
unary_operators = ['exp', "fn(x) = log(27.1285645162762 - 1.42277605519119*x)"],
extra_sympy_mappings = {"fn": lambda x: p(x)},
nested_constraints = {"exp": {"exp" : 0}},
#loss = 'LogitDistLoss()',
)
JULIA: The operator
fn
is not well-defined over the real line, as it threw the errorDomainError
when evaluating the input 20.408163265306122. You can work around this by returning NaN for invalid inputs. For example,safe_log(x::T) where {T} = x > 0 ? log(x) : T(NaN)
.The inputs in the dataset is less than 18. Thus, there is no case where the value of log(x) blows to infinity. I am not sure about this 'DomainError'.
Beta Was this translation helpful? Give feedback.
All reactions