From 926eb927102b068b2710858351bce05868f300ba Mon Sep 17 00:00:00 2001 From: leostre Date: Fri, 12 Jul 2024 15:02:54 +0300 Subject: [PATCH] slight fixes --- fedot_ind/core/models/early_tc/base_early_tc.py | 2 +- fedot_ind/core/models/early_tc/economy_k.py | 9 ++++++--- .../core/repository/data/default_operation_params.json | 4 ++-- fedot_ind/core/tuning/search_space.py | 6 +++--- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/fedot_ind/core/models/early_tc/base_early_tc.py b/fedot_ind/core/models/early_tc/base_early_tc.py index 9fbc162c5..cbed8c463 100644 --- a/fedot_ind/core/models/early_tc/base_early_tc.py +++ b/fedot_ind/core/models/early_tc/base_early_tc.py @@ -124,7 +124,7 @@ def _score(self, X, y, accuracy_importance=None, training=True): predictions = self._predict(X, training)[0] prediction_points = predictions.shape[0] accuracies = (predictions == np.tile(y, (prediction_points, 1))).sum(axis=1) / len(y) - return (1 + accuracy_importance) * accuracies * self.earliness[:prediction_points] / (accuracy_importance * accuracies + self.earliness[:prediction_points]) + return (1 - accuracy_importance) * self.earliness[:prediction_points] + accuracy_importance * accuracies def _get_applicable_index(self, last_available_idx): idx = np.searchsorted(self.prediction_idx, last_available_idx, side='right') diff --git a/fedot_ind/core/models/early_tc/economy_k.py b/fedot_ind/core/models/early_tc/economy_k.py index bf09acd4b..c39097189 100644 --- a/fedot_ind/core/models/early_tc/economy_k.py +++ b/fedot_ind/core/models/early_tc/economy_k.py @@ -65,7 +65,7 @@ def __expected_costs(self, X, cluster_centroids, i): np.sum(self.state[i:], axis=-1), axes=(0, 2, 1) ) * self._pyck_[None, ...], axis=1) costs = cluster_probas @ s_glob.T # n_inst x time_left - costs += self.earliness[None, i:] * (1 - self.accuracy_importance) # subtract or add ? + costs -= self.earliness[None, i:] * (1 - self.accuracy_importance) # subtract or add ? return costs def _get_prediction_time(self, X, cluster_centroids, i): @@ -82,8 +82,11 @@ def predict_proba(self, X): def _transform_score(self, time): idx = self._estimator_for_predict[-1] - scores = -(1 - (time - self.prediction_idx[idx]) / self.prediction_idx[-1]) - scores[scores == 0] = 1 # no posibility for lininterp when sure + scores = (1 - (time - self.prediction_idx[idx]) / self.prediction_idx[-1]) # [1 / n; 1 ] - 1 / n) * n /(n - 1) * 2 - 1 + n = self.n_pred + scores -= 1 / n + scores *= n / (n - 1) * 2 + scores -= 1 return scores diff --git a/fedot_ind/core/repository/data/default_operation_params.json b/fedot_ind/core/repository/data/default_operation_params.json index cfbf25e1c..a91a8a938 100644 --- a/fedot_ind/core/repository/data/default_operation_params.json +++ b/fedot_ind/core/repository/data/default_operation_params.json @@ -137,12 +137,12 @@ "teaser": { "interval_percentage": 10, "consecutive_predictions": 3, - "accuracy_importance": 2 + "accuracy_importance": 0.5 }, "proba_threshold_etc": { "interval_percentage": 10, "consecutive_predictions": 3, - "accuracy_importance": 2 + "accuracy_importance": 0.5 }, "dt": { "max_depth": 5, diff --git a/fedot_ind/core/tuning/search_space.py b/fedot_ind/core/tuning/search_space.py index c19e7340e..832eaad26 100644 --- a/fedot_ind/core/tuning/search_space.py +++ b/fedot_ind/core/tuning/search_space.py @@ -97,15 +97,15 @@ 'acceptance_threshold': {'hyperopt-dist': hp.choice, 'sampling_scope': [[1, 2, 3, 4, 5]]}, 'accuracy_importance': {'hyperopt-dist': hp.choice, - 'sampling-scope': [0.01, 0.1, 0.5, 1, 5, 10, 100]}, + 'sampling-scope': [[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1,]]}, }, 'teaser': {'interval_percentage': {'hyperopt-dist': hp.choice, 'sampling-scope': [[5, 10, 20, 25]]}, 'acceptance_threshold': {'hyperopt-dist': hp.choice, 'sampling_scope': [[1, 2, 3, 4, 5]]}, - 'hm_shift_to_acc': {'hyperopt-dist': hp.choice, - 'sampling-scope': [0.01, 0.1, 0.5, 1, 5, 10, 100]}, + 'accuracy_importance': {'hyperopt-dist': hp.choice, + 'sampling-scope': [[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1,]]}, }, 'deepar_model': {'epochs': {'hyperopt-dist': hp.choice,