@@ -200,7 +200,7 @@ def apply(self, objective: Equation, arguments: dict, force_out_of_place: bool =
200200 for start_idx in range (0 , num_horizons , step_size ):
201201 end_idx = start_idx + window_size
202202 target_window = target_vals [start_idx :end_idx ]
203- eq_window_weights .append (np .abs (np .std (target_window ) / np .mean (target_window )))
203+ eq_window_weights .append (np .abs (np .std (target_window ) / np .sqrt ( np . mean (np . power ( target_window , 2 )) )))
204204 lr = np .mean (eq_window_weights )
205205 else :
206206 features = self .feature_reshape (features_vals )
@@ -212,7 +212,7 @@ def apply(self, objective: Equation, arguments: dict, force_out_of_place: bool =
212212 estimator .fit (feature_window , target_window , sample_weight = self .g_fun_vals [start_idx :end_idx ])
213213 valuable_weights = estimator .coef_ [:- 1 ]
214214 eq_window_weights .append (valuable_weights )
215- eq_cv = np .array ([np .abs (np .std (_ ) / (np .mean (_ ) + 1e-12 )) for _ in zip (* eq_window_weights )])
215+ eq_cv = np .array ([np .abs (np .std (_ ) / np . sqrt (np .mean (np . power ( _ , 2 )) )) for _ in zip (* eq_window_weights )])
216216 lr = eq_cv .mean ()
217217
218218 elif target_vals .ndim == 2 :
@@ -233,7 +233,7 @@ def apply(self, objective: Equation, arguments: dict, force_out_of_place: bool =
233233 target_window = target_vals [start_idx :end_idx , :].reshape (- 1 )
234234 else :
235235 target_window = target_vals [:, start_idx :end_idx ].reshape (- 1 )
236- eq_window_weights .append (np .abs (np .std (target_window ) / np .mean (target_window )))
236+ eq_window_weights .append (np .abs (np .std (target_window ) / np .sqrt ( np . mean (np . power ( target_window , 2 )) )))
237237 lr += np .mean (eq_window_weights )
238238 else :
239239 features = self .feature_reshape (features_vals )
@@ -250,7 +250,7 @@ def apply(self, objective: Equation, arguments: dict, force_out_of_place: bool =
250250 estimator .fit (feature_window , target_window , sample_weight = self .g_fun_vals .reshape (* data_shape , - 1 )[:, start_idx :end_idx ].reshape (- 1 ))
251251 valuable_weights = estimator .coef_ [:- 1 ]
252252 eq_window_weights .append (valuable_weights )
253- eq_cv = np .array ([np .abs (np .std (_ ) / (np .mean (_ ) + 1e-12 )) for _ in zip (* eq_window_weights )])
253+ eq_cv = np .array ([np .abs (np .std (_ ) / np . sqrt (np .mean (np . power ( _ , 2 )) )) for _ in zip (* eq_window_weights )])
254254 lr += eq_cv .mean ()
255255
256256 elif target_vals .ndim == 3 :
@@ -269,7 +269,7 @@ def apply(self, objective: Equation, arguments: dict, force_out_of_place: bool =
269269 target_window = target_vals [:, start_idx :end_idx , :].reshape (- 1 )
270270 else :
271271 target_window = target_vals [:, :, start_idx :end_idx ].reshape (- 1 )
272- eq_window_weights .append (np .abs (np .std (target_window ) / np .mean (target_window )))
272+ eq_window_weights .append (np .abs (np .std (target_window ) / np .sqrt ( np . mean (np . power ( target_window , 2 )) )))
273273 lr += np .mean (eq_window_weights )
274274 else :
275275 features = self .feature_reshape (features_vals )
@@ -290,7 +290,7 @@ def apply(self, objective: Equation, arguments: dict, force_out_of_place: bool =
290290 estimator .fit (feature_window , target_window , sample_weight = self .g_fun_vals .reshape (* data_shape , - 1 )[:, :, start_idx :end_idx ].reshape (- 1 ))
291291 valuable_weights = estimator .coef_ [:- 1 ]
292292 eq_window_weights .append (valuable_weights )
293- eq_cv = np .array ([np .abs (np .std (_ ) / (np .mean (_ ) + 1e-12 )) for _ in zip (* eq_window_weights )])
293+ eq_cv = np .array ([np .abs (np .std (_ ) / np . sqrt (np .mean (np . power ( _ , 2 )) )) for _ in zip (* eq_window_weights )])
294294 lr += eq_cv .mean ()
295295
296296 objective .fitness_calculated = True
0 commit comments