Skip to content

Commit f22af96

Browse files
committed
More detailed comment
1 parent 9bb78f1 commit f22af96

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

causal_testing/estimation/genetic_programming_regression_fitter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,14 +282,15 @@ def fitness(self, expression: gp.PrimitiveTree) -> float:
282282
if isinstance(expression, str):
283283
expression = creator.Individual(gp.PrimitiveTree.from_string(expression, self.pset))
284284

285-
# Create model, fit (run) it, give estimates from it]
285+
# Create model, fit (run) it, give estimates from it
286286
func = gp.compile(expression, self.pset)
287287
y_estimates = pd.Series(
288288
[func(**x) for _, x in self.df[self.features].iterrows()],
289289
index=self.df.index,
290290
)
291291

292-
# Calculate errors using root mean square error
292+
# Calculate errors using the normalised root mean square error (nrmse),
293+
# which is normalised with respect to the range
293294
sqerrors = (self.df[self.outcome] - y_estimates) ** 2
294295
nrmse = np.sqrt(sqerrors.sum() / len(self.df)) / (self.df[self.outcome].max() - self.df[self.outcome].min())
295296

0 commit comments

Comments
 (0)