Skip to content

Commit

Permalink
slight fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
leostre committed Jul 15, 2024
1 parent e51949b commit 926eb92
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion fedot_ind/core/models/early_tc/base_early_tc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
9 changes: 6 additions & 3 deletions fedot_ind/core/models/early_tc/economy_k.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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


4 changes: 2 additions & 2 deletions fedot_ind/core/repository/data/default_operation_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions fedot_ind/core/tuning/search_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 926eb92

Please sign in to comment.