Skip to content

Commit

Permalink
to pull req
Browse files Browse the repository at this point in the history
  • Loading branch information
leostre committed Jul 16, 2024
1 parent 49d0570 commit 2e2ad91
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 13 deletions.
4 changes: 2 additions & 2 deletions fedot_ind/core/models/early_tc/base_early_tc.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ def _predict(self, X, training=True):
estimator_indices, offset = self._select_estimators(X, training)
if not training:
self._estimator_for_predict = estimator_indices
prediction = zip(
prediction = (np.stack(array_list) for array_list in zip(
*[self._predict_one_slave(X, i, offset) for i in estimator_indices] # check boundary
)
))
return prediction # see the output in _predict_one_slave

def _consecutive_count(self, predicted_labels: List[np.array]):
Expand Down
3 changes: 0 additions & 3 deletions fedot_ind/core/models/early_tc/ecec.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@ def _predict_one_slave(self, X, i, offset=0):

def _predict(self, X, training=False):
predicted_labels, predicted_probas, reliabilities = super()._predict(X, training)
reliabilities = np.stack(reliabilities)
confidences = 1 - np.cumprod(1 - reliabilities, axis=0)
non_confident = confidences < self.confidence_thresholds[:len(predicted_labels), None]
predicted_labels = np.stack(predicted_labels)
predicted_probas = np.stack(predicted_probas)
return predicted_labels, predicted_probas, non_confident, confidences

def predict_proba(self, X):
Expand Down
1 change: 0 additions & 1 deletion fedot_ind/core/models/early_tc/economy_k.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ def _get_prediction_time(self, X, cluster_centroids, i):

def predict_proba(self, X):
probas, times, _ = self._predict(X, training=False)
probas, times = np.stack(probas), np.stack(times)
return super().predict_proba(probas, times)

def _transform_score(self, time):
Expand Down
2 changes: 0 additions & 2 deletions fedot_ind/core/models/early_tc/prob_threshold.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ def predict_proba(self, X):

def _predict(self, X, training=True):
predicted_probas, predicted_labels = super()._predict(X, training)
predicted_probas = np.stack(predicted_probas)
predicted_labels = np.stack(predicted_labels)
non_acceptance = self._consecutive_count(predicted_labels) < self.consecutive_predictions
double_check = predicted_probas.max(axis=-1) > self.probability_threshold
non_acceptance[non_acceptance & double_check] = False
Expand Down
7 changes: 2 additions & 5 deletions fedot_ind/core/models/early_tc/teaser.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,10 @@ def _form_X_oc(self, predicted_probas):

def _predict(self, X, training=False):
estimator_indices, offset = self._select_estimators(X)
X_ocs, predicted_probas, predicted_labels = zip(
X_ocs, predicted_probas, predicted_labels = map(np.stack, zip(
*[self._predict_one_slave(X, i, offset) for i in estimator_indices]
)
))
non_acceptance = self._consecutive_count(predicted_labels) < self.consecutive_predictions
X_ocs = np.stack(X_ocs)
predicted_probas = np.stack(predicted_probas)
predicted_labels = np.stack(predicted_labels)
final_verdicts = np.zeros((len(estimator_indices), X.shape[0]))
# for each point of estimation
for i in range(predicted_labels.shape[0]):
Expand Down

0 comments on commit 2e2ad91

Please sign in to comment.