You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the same dataset from the other issue (I can reupload again if you want), running the following code:
fromfeatimportFeatRegressordefstandardNotation(expr):
expr= (expr.replace("X0", "x0")
.replace("X1", "x1")
.replace("X2", "x2")
.replace("_", "")
.replace("+-", "-")
.replace("--", "+")
.replace("^", "**")
)
expr=re.sub(r"/(-\d+\.\d+)", r"/(\1)", expr)
returnre.sub(r"\*(-\d+\.\d+)", r"*(\1)", expr)
defprotected(expr):
returnexpr.replace("log", "plog")
defmodel(est):
returnest.get_eqn()
est=FeatRegressor(
pop_size=500,
gens=2,
backprop=False,
iters=1,
max_depth=2,
functions="+,-,*,/", # remove exp, log for kotanchekverbosity=0,
random_state=55
)
est.fit(x,y)
eq=protected(standardNotation(model(est))) # normalizes the expressionyhat=eval(eq) # evaluates the symbolic expressionyhat2=FEAT.est.predict(x) # the same but using the internal methodprint(np.square(yhat-yhat2).mean())
I get: 276.03250450032573 where I should get something close to 0. I'm not really sure if it is related to the other issue or if it's an unrelated issue.
The text was updated successfully, but these errors were encountered:
Same problem! I had to change the seed to 59 test with normalize=False because with seed 55 and without normalization, it returned an invalid expression as in that other issue I opened.
Using the same dataset from the other issue (I can reupload again if you want), running the following code:
I get: 276.03250450032573 where I should get something close to 0. I'm not really sure if it is related to the other issue or if it's an unrelated issue.
The text was updated successfully, but these errors were encountered: