Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tpot/evolvers/base_evolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,8 +890,8 @@ def evaluate_population_selection_early_stop(self,survival_counts, thresholds=No
threshold = thresholds[step]
invalids = []
for i in range(len(offspring_scores)):

if all([s*w>t*w for s,t,w in zip(offspring_scores[i],threshold,objective_function_signs) ]):
# fix: 'not' needed to fix logic (bug in original TPOT code meaning threshold logic was inverted); >= to make this work for scores that might be the same across all individuals in certain cases (e.g. on first of multiple stateful runs)
if not all([s*w>=t*w for s,t,w in zip(offspring_scores[i],threshold,objective_function_signs) ]):
invalids.append(i)

if len(invalids) > 0:
Expand All @@ -908,7 +908,7 @@ def evaluate_population_selection_early_stop(self,survival_counts, thresholds=No
# Remove based on selection
if survival_counts is not None:
if step < self.evaluation_early_stop_steps - 1 and survival_counts[step]>1: #don't do selection for the last loop since they are completed
k = survival_counts[step] + len(invalids) #TODO can remove the min if the selections method can ignore k>population size
k = survival_counts[step] # ambiguous which invalids objects from above this is supposed to refer to; removed (tbc)
if len(cur_individuals)> 1 and k > self.n_jobs and k < len(cur_individuals):
weighted_scores = np.array([s * self.objective_function_weights for s in offspring_scores ])

Expand Down
5 changes: 3 additions & 2 deletions tpot/search_spaces/nodes/genetic_feature_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,9 @@ def _mutate_remove(self, rng=None):
p = to_remove / num_pos
p = min(p, .5)

remove_mask = rng.choice([True, False], size=self.mask.shape, p=[p,1-p])
self.mask = np.logical_and(self.mask, remove_mask)
# bugfix for logic flaw
keep_mask = rng.choice([False, True], size=self.mask.shape, p=[p,1-p])
self.mask = np.logical_and(self.mask, keep_mask)


if sum(self.mask) == 0:
Expand Down
2 changes: 1 addition & 1 deletion tpot/tpot_estimator/estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ def objective_function(pipeline_individual,


if self.threshold_evaluation_pruning is not None or self.selection_evaluation_pruning is not None:
evaluation_early_stop_steps = self.cv
evaluation_early_stop_steps = n_folds # fix to work with cv object instead of int
else:
evaluation_early_stop_steps = None

Expand Down