Skip to content

Commit

Permalink
Merge pull request #301 from CITCOM-project/jmafoster1/fix-gp-fitness
Browse files Browse the repository at this point in the history
Fixed GP fitness again
  • Loading branch information
jmafoster1 authored Jan 9, 2025
2 parents 7bf3f4c + 1cd053e commit 641107f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def fitness(self, expression: gp.PrimitiveTree) -> float:
sqerrors = (self.df[self.outcome] - y_estimates) ** 2
nrmse = np.sqrt(sqerrors.sum() / len(self.df)) / (self.df[self.outcome].max() - self.df[self.outcome].min())

if pd.isnull(nrmse) or nrmse.real != nrmse:
if pd.isnull(nrmse) or nrmse.real != nrmse or y_estimates.dtype != self.df.dtypes[self.outcome]:
return (float("inf"),)

return (nrmse,)
Expand Down

0 comments on commit 641107f

Please sign in to comment.