Using the same dataset from the other issue (I can reupload again if you want), running the following code:
from feat import FeatRegressor
def standardNotation(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)
return re.sub(r"\*(-\d+\.\d+)", r"*(\1)", expr)
def protected(expr):
return expr.replace("log", "plog")
def model(est):
return est.get_eqn()
est = FeatRegressor(
pop_size=500,
gens=2,
backprop=False,
iters=1,
max_depth=2,
functions="+,-,*,/", # remove exp, log for kotanchek
verbosity=0,
random_state=55
)
est.fit(x,y)
eq = protected(standardNotation(model(est))) # normalizes the expression
yhat = eval(eq) # evaluates the symbolic expression
yhat2 = FEAT.est.predict(x) # the same but using the internal method
print(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.
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.