• Stars
    star
    181
  • Rank 212,110 (Top 5 %)
  • Language
    Jupyter Notebook
  • License
    GNU Lesser Genera...
  • Created over 1 year ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Python Automated Machine Learning tool that optimizes machine learning pipelines using genetic programming.

TPOT2 ALPHA

Tests PyPI Downloads Conda Downloads

TPOT stands for Tree-based Pipeline Optimization Tool. TPOT2 is a Python Automated Machine Learning tool that optimizes machine learning pipelines using genetic programming. Consider TPOT2 your Data Science Assistant.

TPOT2 is a rewrite of TPOT with some additional functionality. Notably, we added support for graph-based pipelines and additional parameters to better specify the desired search space. TPOT2 is currently in Alpha. This means that there will likely be some backwards incompatible changes to the API as we develop. Some implemented features may be buggy. There is a list of known issues written at the bottom of this README. Some features have placeholder names or are listed as "Experimental" in the doc string. These are features that may not be fully implemented and may or may not work with all other features.

If you are interested in using the current stable release of TPOT, you can do that here: https://github.com/EpistasisLab/tpot/.

License

Please see the repository 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.

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

Installation

TPOT2 requires a working installation of Python.

Creating a conda environment (optional)

We recommend using conda environments for installing TPOT2, though it would work equally well if manually installed without it.

More information on making anaconda environments found here.

conda create --name tpot2env python=3.10
conda activate tpot2env

Note for M1 Mac or other Arm-based CPU users

You need to install the lightgbm package directly from conda using the following command before installing TPOT2.

This is to ensure that you get the version that is compatible with your system.

conda install --yes -c conda-forge 'lightgbm>=3.3.3'

Installing Extra Features with pip

If you want to utilize the additional features provided by TPOT2 along with scikit-learn extensions, you can install them using pip. The command to install TPOT2 with these extra features is as follows:

pip install tpot2[sklearnex]

Please note that while these extensions can speed up scikit-learn packages, there are some important considerations:

These extensions may not be fully developed and tested on Arm-based CPUs, such as M1 Macs. You might encounter compatibility issues or reduced performance on such systems.

We recommend using Python 3.9 when installing these extra features, as it provides better compatibility and stability.

Developer/Latest Branch Installation

pip install -e /path/to/tpot2repo

If you downloaded with git pull, then the repository folder will be named TPOT2. (Note: this folder is the one that includes setup.py inside of it and not the folder of the same name inside it). If you downloaded as a zip, the folder may be called tpot2-main.

Usage

See the Tutorials Folder for more instructions and examples.

Best Practices

1

TPOT2 uses dask for parallel processing. When Python is parallelized, each module is imported within each processes. Therefore it is important to protect all code within a if __name__ == "__main__" when running TPOT2 from a script. This is not required when running TPOT2 from a notebook.

For example:

#my_analysis.py

import tpot2
if __name__ == "__main__":
    X, y = load_my_data()
    est = tpot2.TPOTClassifier()
    est.fit(X,y)
    #rest of analysis

2

When designing custom objective functions, avoid the use of global variables.

Don't Do:

global_X = [[1,2],[4,5]]
global_y = [0,1]
def foo(est):
    return my_scorer(est, X=global_X, y=global_y)

Instead use a partial

from functools import partial

def foo_scorer(est, X, y):
    return my_scorer(est, X, y)

if __name__=='__main__':
    X = [[1,2],[4,5]]
    y = [0,1]
    final_scorer = partial(foo_scorer, X=X, y=y)

Similarly when using lambda functions.

Dont Do:

def new_objective(est, a, b)
    #definition

a = 100
b = 20
bad_function = lambda est :  new_objective(est=est, a=a, b=b)

Do:

def new_objective(est, a, b)
    #definition

a = 100
b = 20
good_function = lambda est, a=a, b=b : new_objective(est=est, a=a, b=b)

Tips

TPOT2 will not check if your data is correctly formatted. It will assume that you have passed in operators that can handle the type of data that was passed in. For instance, if you pass in a pandas dataframe with categorical features and missing data, then you should also include in your configuration operators that can handle those feautures of the data. Alternatively, if you pass in preprocessing = True, TPOT2 will impute missing values, one hot encode categorical features, then standardize the data. (Note that this is currently fitted and transformed on the entire training set before splitting for CV. Later there will be an option to apply per fold, and have the parameters be learnable.)

Setting verbose to 5 can be helpful during debugging as it will print out the error generated by failing pipelines.

Contributing to TPOT2

We welcome you to check the existing issues for bugs or enhancements to work on. If you have an idea for an extension to TPOT2, please file a new issue so we can discuss it.

Known issues

  • TPOT2 uses the func_timeout package to terminate long running pipelines. The early termination signal may fail on particular estimators and cause TPOT2 to run for longer than intended. If you are using your own custom configuration dictionaries, and are noticing that TPOT2 is running for longer than intended, this may be the issue. We are currently looking into it. Sometimes restarting TPOT2 resolves the issue.
  • Periodic checkpoint folder may not correctly resume if using budget and/or initial_population size.
  • Population class is slow to add new individuals. The Population class needs to be updated to use a dictionary for storage rather than a pandas dataframe.
  • Crossover may sometimes go over the size restrictions.
  • Memory caching with GraphPipeline may miss some nodes where the ordering on inputs happens to be different between two nodes.

Support for TPOT2

TPOT2 was developed in the Artificial Intelligence Innovation (A2I) Lab at Cedars-Sinai with funding from the NIH under grants U01 AG066833 and R01 LM010098. We are incredibly grateful for the support of the NIH and the Cedars-Sinai during the development of this project.

The TPOT logo was designed by Todd Newmuis, who generously donated his time to the project.

More Repositories

1

tpot

A Python Automated Machine Learning tool that optimizes machine learning pipelines using genetic programming.
Python
9,638
star
2

pmlb

PMLB: A large, curated repository of benchmark datasets for evaluating supervised machine learning algorithms.
Python
802
star
3

KRAGEN

Software to implement GoT with a weviate vectorized database
Python
577
star
4

scikit-rebate

A scikit-learn-compatible Python implementation of ReBATE, a suite of Relief-based feature selection algorithms for Machine Learning.
Python
408
star
5

Aliro

Aliro: AI-Driven Data Science
JavaScript
224
star
6

ClinicalDataSources

Open or Easy Access Clinical Data Sources for Biomedical Research
168
star
7

scikit-mdr

A sklearn-compatible Python implementation of Multifactor Dimensionality Reduction (MDR) for feature construction.
Python
125
star
8

ReBATE

Relief Based Algorithms of ReBATE implemented in Python with Cython optimization. This repository is no longer being updated. Please see scikit-rebate.
Python
32
star
9

MIMIC_trajectories

Jupyter Notebook
30
star
10

digen

Diverse and generative ML benchmarks
Jupyter Notebook
14
star
11

ml-analyst

Analysis pipeline for quick ML analyses.
Python
11
star
12

3DHeatmap

3D Heatmap tool in Unity3D. Inst. for Biomed. Informatics, Univ. of PA
C#
10
star
13

imputation

https://www.biorxiv.org/content/early/2017/07/24/167858
Jupyter Notebook
9
star
14

interpret_ehr

Interpretation of machine learning predictions for patient outcomes in electronic health records
Jupyter Notebook
9
star
15

AlzKB

Python
8
star
16

hibachi

Data simulation software that creates data sets with particular characteristics
Python
8
star
17

autoqtl

Automated Quantitative Trait Locus Analysis (AutoQTL)
Python
8
star
18

EBIC.jl

EBIC - a biclustering algorithm in Julia
Julia
7
star
19

EpistasisLab.github.io

Identifying the complex genetic architectures of disease
6
star
20

qsar-gnn

TeX
6
star
21

SAFE

The SAFE Algorithm: Solution and Fitness Evolution
Python
4
star
22

DTox

A knowledge-guided deep learning model for prediction and interpretation of drug toxicity
HTML
4
star
23

regens

Recombines real genomic segments to simulate whole genomes
Python
4
star
24

rebate-benchmark

A centralized repository to benchmark ReBATE performance across a variety of parameter settings and datasets.
Jupyter Notebook
4
star
25

gecco2017-new-benchmarking-standards

Pages for workshops run by Epistasis Lab members
3
star
26

evolved-stats

A research project using genetic programming to discover and optimize statistical tests.
Jupyter Notebook
3
star
27

penn-lpc-scripts

Scripts that I wrote for use on the Penn LPC
Python
2
star
28

LPC

Documentation and informational resources for LPC use
2
star
29

tpot-kaggle

tpot applications on kaggle datasets
Jupyter Notebook
2
star
30

OMNIREP

The OMNIREP algorithm: Coevolving encodings and representations
Python
2
star
31

SimpleModelView

A Unity package for a simplified model-view system to help with code<->UI management.
ShaderLab
2
star
32

epistasis_detection

Implementation of an efficient algorithm to compute linear regression models for epistasis that permit varied genetic encodings (penetrance functions) of the interactions of loci and provide statistical evidence for epistasis.
Jupyter Notebook
2
star
33

GPT4_and_Review

Using GPT-4 to write a scientific review article: a pilot evaluation study
Python
2
star
34

STAR_outliers

Python
1
star
35

regens-analysis

Shell
1
star
36

PICV

Proportional instance cross validation
1
star
37

PennAI-Ed

Materials for PennAI-Ed - an initiative to enhance AI and data science education built on PennAI
Shell
1
star
38

TINY

Tiny Genetic Algorithm (GA) and Tiny Genetic Programming (GP)
Python
1
star
39

escargot

Python
1
star
40

AlzKB-updates

Jupyter Notebook
1
star
41

EVE

ENSEMBL VEP on EC2
1
star
42

Conservation-Machine-Learning

Conservation Machine Learning
Python
1
star
43

pennai-arm64-deps

Pre-compiled dependencies for building PennAI Docker images on 64-bit ARM OSs (e.g., raspberry pi)
1
star
44

latent_phenotype_project

Python
1
star
45

PAGER

Python
1
star
46

VEPDB_populator

Population utilities for the VEPDB distributed annotation database, with an annotator written in Python
Python
1
star