Skip to content

Commit

Permalink
Merge pull request #40 from perib/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
perib authored Aug 16, 2023
2 parents e6a2647 + 2e0d6e1 commit b041ea8
Show file tree
Hide file tree
Showing 12 changed files with 243 additions and 188 deletions.
2 changes: 1 addition & 1 deletion PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

## What are the relevant issues?

[you can link directly to issues by entering # then the number of the issue, for example, #3 links to issue 3]
[you can link directly to issues by entering # then the number of the issue]

## Screenshots (if appropriate)

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ If you are interested in using the current stable release of TPOT, you can do th
Please see the [repository license](https://github.com/EpistasisLab/tpot2/blob/main/LICENSE) for the licensing and usage information for TPOT2.
Generally, we have licensed TPOT2 to make it as widely usable as possible.

## Documentation

[The documentation webpage can be found here.](epistasislab.github.io/tpot2/)

We also recommend looking at the Tutorials folder for jupyter notebooks with examples and guides.

## Installation

Expand Down
268 changes: 134 additions & 134 deletions Tutorial/3_Genetic_Feature_Set_Selectors.ipynb

Large diffs are not rendered by default.

126 changes: 83 additions & 43 deletions Tutorial/4_Symbolic_Regression_and_Classification.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tpot2/evolvers/base_evolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def optimize(self, generations=None):
self.evaluate_population()

if len(self.population.population) == 0:
raise Exception("No individuals could be evaluated in the initial population")
raise Exception("No individuals could be evaluated in the initial population. This may indicate a bug in the configuration, included models, or objective functions. Set verbose>=4 to see the errors that caused individuals to fail.")

self.generation += 1
# Generation 1 is the first generation after the initial population
Expand Down
9 changes: 9 additions & 0 deletions tpot2/evolvers/steady_state_evolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import math
from tpot2.utils.utils import get_thresholds, beta_interpolation, remove_items, equalize_list
import dask
import warnings

class SteadyStateEvolver():
def __init__( self,
Expand Down Expand Up @@ -451,10 +452,18 @@ def optimize(self):
# If we don't have enough evaluated individuals to use as parents for variation, we create new individuals randomly
# This can happen if the individuals in the initial population are invalid
if len(cur_evaluated_population) == 0 and len(submitted_futures) < self.max_queue_size:

initial_population = self.population.evaluated_individuals.iloc[:self.initial_population_size*3]
invalid_initial_population = initial_population[initial_population[self.objective_names].isin(["TIMEOUT","INVALID"]).any(axis=1)]
if len(invalid_initial_population) >= self.initial_population_size*3: #if all individuals in the 3*initial population are invalid
raise Exception("No individuals could be evaluated in the initial population. This may indicate a bug in the configuration, included models, or objective functions. Set verbose>=4 to see the errors that caused individuals to fail.")

n_individuals_to_create = self.max_queue_size - len(submitted_futures)
initial_population = [next(self.individual_generator) for _ in range(n_individuals_to_create)]
self.population.add_to_population(initial_population)




###############################
# Step 6: Add Unevaluated Individuals Generated by Variation
Expand Down
17 changes: 9 additions & 8 deletions tpot2/objectives/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
from .average_path_length_objective import average_path_length_objective
from .number_of_nodes_objective import number_of_nodes_objective
from .number_of_leaves_scorer import number_of_leaves_scorer, number_of_leaves_objective
from .complexity_objective import complexity_scorer
from .average_path_length import average_path_length_objective
from .number_of_nodes import number_of_nodes_objective
from .number_of_leaves import number_of_leaves_scorer, number_of_leaves_objective
from .complexity import complexity_scorer


#these scorers are calculated per fold of CV on the fitted pipeline for that fold
SCORERS = { "number_of_leaves": number_of_leaves_scorer,
"complexity": complexity_scorer
SCORERS = {
"complexity_scorer": complexity_scorer
}

#these objectives are calculated once on unfitted models as secondary objectives
OBJECTIVES = { "average_path_length": average_path_length_objective,
"number_of_nodes": number_of_nodes_objective,
OBJECTIVES = { "average_path_length_objective": average_path_length_objective,
"number_of_nodes_objective": number_of_nodes_objective,
"number_of_leaves_objective": number_of_leaves_objective
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tpot2/tpot_estimator/steady_state_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def __init__(self, scorers= [],
3. best individual
4. warnings
>=5. full warnings trace
6. evaluations progress bar. (Temporary: This used to be 2. Currently, using evaluation progress bar may prevent some instances were we terminate a generation early due to it reaching max_time_seconds in the middle of a generation OR a pipeline failed to be terminated normally and we need to manually terminate it.)
periodic_checkpoint_folder : str, default=None
Folder to save the population to periodically. If None, no periodic saving will be done.
Expand Down

0 comments on commit b041ea8

Please sign in to comment.