Skip to content

Commit

Permalink
Merge pull request #153 from perib/documentation
Browse files Browse the repository at this point in the history
Documentation
  • Loading branch information
nickotto authored Oct 10, 2024
2 parents 895b286 + f6d797b commit 827f08e
Show file tree
Hide file tree
Showing 21 changed files with 507 additions and 226 deletions.
20 changes: 10 additions & 10 deletions Tutorial/1_Estimators_Overview.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"X_train, X_test, y_train, y_test = sklearn.model_selection.train_test_split(X, y, train_size=0.75, test_size=0.25)\n",
"\n",
"\n",
"est = tpot2.TPOTClassifier(n_jobs=40, max_time_seconds=30, verbose=5, generations=1, population_size=5)\n",
"est = tpot2.TPOTClassifier(n_jobs=40, max_time_mins=30, verbose=5, generations=1, population_size=5)\n",
"est.fit(X_train, y_train)\n",
"\n",
"\n",
Expand Down Expand Up @@ -815,7 +815,7 @@
"X, y = sklearn.datasets.load_diabetes(return_X_y=True)\n",
"X_train, X_test, y_train, y_test = sklearn.model_selection.train_test_split(X, y, train_size=0.75, test_size=0.25)\n",
"\n",
"est = tpot2.tpot_estimator.templates.TPOTRegressor(n_jobs=4, max_time_seconds=30, verbose=2, cv=5)\n",
"est = tpot2.tpot_estimator.templates.TPOTRegressor(n_jobs=4, max_time_mins=30, verbose=2, cv=5)\n",
"est.fit(X_train, y_train)\n",
"\n",
"print(scorer(est, X_test, y_test))"
Expand Down Expand Up @@ -865,7 +865,7 @@
" X_train, X_test, y_train, y_test = sklearn.model_selection.train_test_split(X, y, train_size=0.75, test_size=0.25)\n",
"\n",
"\n",
" est = tpot2.TPOTClassifier(n_jobs=4, max_time_seconds=60, verbose=2)\n",
" est = tpot2.TPOTClassifier(n_jobs=4, max_time_mins=60, verbose=2)\n",
" est.fit(X_train, y_train)\n",
"\n",
"\n",
Expand Down Expand Up @@ -909,10 +909,10 @@
" generations : int, default=50\n",
" Number of generations to run\n",
" \n",
" max_time_seconds : float, default=float(\"inf\")\n",
" max_time_mins : float, default=float(\"inf\")\n",
" Maximum time to run the optimization. If none or inf, will run until the end of the generations.\n",
" \n",
" max_eval_time_seconds : float, default=60*5\n",
" max_eval_time_mins : float, default=60*5\n",
" Maximum time to evaluate a single individual. If none or inf, there will be no time limit per evaluation.\n",
"\n",
" n_jobs : int, default=1\n",
Expand All @@ -930,7 +930,7 @@
" 3. best individual\n",
" 4. warnings\n",
" >=5. full warnings trace\n",
" 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.)\n",
" 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_mins in the middle of a generation OR a pipeline failed to be terminated normally and we need to manually terminate it.)\n",
" \n"
]
},
Expand Down Expand Up @@ -995,8 +995,8 @@
"\n",
" classification=True,\n",
"\n",
" max_eval_time_seconds=15,\n",
" max_time_seconds=30,\n",
" max_eval_time_mins=15,\n",
" max_time_mins=30,\n",
" verbose=2)\n",
"\n",
"\n",
Expand Down Expand Up @@ -1303,8 +1303,8 @@
"\n",
" classification=True,\n",
"\n",
" max_eval_time_seconds=15,\n",
" max_time_seconds=30,\n",
" max_eval_time_mins=15,\n",
" max_time_mins=30,\n",
" verbose=2)\n",
"\n",
"\n",
Expand Down
22 changes: 11 additions & 11 deletions Tutorial/2_Search_Spaces.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5228,16 +5228,16 @@
" /* fitted */\n",
" background-color: var(--sklearn-color-fitted-level-3);\n",
"}\n",
"</style><div id=\"sk-container-id-16\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>TPOTEstimator(classification=True, generations=5, max_eval_time_seconds=300,\n",
"</style><div id=\"sk-container-id-16\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>TPOTEstimator(classification=True, generations=5, max_eval_time_mins=300,\n",
" population_size=10, scorers=[&#x27;roc_auc&#x27;], scorers_weights=[1],\n",
" search_space=&lt;tpot2.search_spaces.pipelines.graph.GraphPipeline object at 0x716246e21cf0&gt;,\n",
" verbose=2)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-22\" type=\"checkbox\" checked><label for=\"sk-estimator-id-22\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;TPOTEstimator<span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>TPOTEstimator(classification=True, generations=5, max_eval_time_seconds=300,\n",
" verbose=2)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-22\" type=\"checkbox\" checked><label for=\"sk-estimator-id-22\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;TPOTEstimator<span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>TPOTEstimator(classification=True, generations=5, max_eval_time_mins=300,\n",
" population_size=10, scorers=[&#x27;roc_auc&#x27;], scorers_weights=[1],\n",
" search_space=&lt;tpot2.search_spaces.pipelines.graph.GraphPipeline object at 0x716246e21cf0&gt;,\n",
" verbose=2)</pre></div> </div></div></div></div>"
],
"text/plain": [
"TPOTEstimator(classification=True, generations=5, max_eval_time_seconds=300,\n",
"TPOTEstimator(classification=True, generations=5, max_eval_time_mins=300,\n",
" population_size=10, scorers=['roc_auc'], scorers_weights=[1],\n",
" search_space=<tpot2.search_spaces.pipelines.graph.GraphPipeline object at 0x716246e21cf0>,\n",
" verbose=2)"
Expand Down Expand Up @@ -5277,7 +5277,7 @@
" search_space = graph_search_space,\n",
" population_size= 10,\n",
" generations = 5,\n",
" max_eval_time_seconds = 60*5,\n",
" max_eval_time_mins = 60*5,\n",
" verbose = 2,\n",
")\n",
"\n",
Expand Down Expand Up @@ -5739,16 +5739,16 @@
" /* fitted */\n",
" background-color: var(--sklearn-color-fitted-level-3);\n",
"}\n",
"</style><div id=\"sk-container-id-17\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>TPOTEstimator(classification=True, generations=5, max_eval_time_seconds=300,\n",
"</style><div id=\"sk-container-id-17\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>TPOTEstimator(classification=True, generations=5, max_eval_time_mins=300,\n",
" population_size=10, scorers=[&#x27;roc_auc&#x27;], scorers_weights=[1],\n",
" search_space=&lt;tpot2.search_spaces.pipelines.graph.GraphPipeline object at 0x716246e21cf0&gt;,\n",
" verbose=2)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-23\" type=\"checkbox\" checked><label for=\"sk-estimator-id-23\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;TPOTEstimator<span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>TPOTEstimator(classification=True, generations=5, max_eval_time_seconds=300,\n",
" verbose=2)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-23\" type=\"checkbox\" checked><label for=\"sk-estimator-id-23\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;TPOTEstimator<span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>TPOTEstimator(classification=True, generations=5, max_eval_time_mins=300,\n",
" population_size=10, scorers=[&#x27;roc_auc&#x27;], scorers_weights=[1],\n",
" search_space=&lt;tpot2.search_spaces.pipelines.graph.GraphPipeline object at 0x716246e21cf0&gt;,\n",
" verbose=2)</pre></div> </div></div></div></div>"
],
"text/plain": [
"TPOTEstimator(classification=True, generations=5, max_eval_time_seconds=300,\n",
"TPOTEstimator(classification=True, generations=5, max_eval_time_mins=300,\n",
" population_size=10, scorers=['roc_auc'], scorers_weights=[1],\n",
" search_space=<tpot2.search_spaces.pipelines.graph.GraphPipeline object at 0x716246e21cf0>,\n",
" verbose=2)"
Expand Down Expand Up @@ -6189,16 +6189,16 @@
" /* fitted */\n",
" background-color: var(--sklearn-color-fitted-level-3);\n",
"}\n",
"</style><div id=\"sk-container-id-18\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>TPOTEstimator(classification=True, generations=5, max_eval_time_seconds=300,\n",
"</style><div id=\"sk-container-id-18\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>TPOTEstimator(classification=True, generations=5, max_eval_time_mins=300,\n",
" population_size=10, scorers=[&#x27;roc_auc&#x27;], scorers_weights=[1],\n",
" search_space=&lt;tpot2.search_spaces.pipelines.sequential.SequentialPipeline object at 0x716238dc50f0&gt;,\n",
" verbose=2)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-24\" type=\"checkbox\" checked><label for=\"sk-estimator-id-24\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;TPOTEstimator<span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>TPOTEstimator(classification=True, generations=5, max_eval_time_seconds=300,\n",
" verbose=2)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-24\" type=\"checkbox\" checked><label for=\"sk-estimator-id-24\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;TPOTEstimator<span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>TPOTEstimator(classification=True, generations=5, max_eval_time_mins=300,\n",
" population_size=10, scorers=[&#x27;roc_auc&#x27;], scorers_weights=[1],\n",
" search_space=&lt;tpot2.search_spaces.pipelines.sequential.SequentialPipeline object at 0x716238dc50f0&gt;,\n",
" verbose=2)</pre></div> </div></div></div></div>"
],
"text/plain": [
"TPOTEstimator(classification=True, generations=5, max_eval_time_seconds=300,\n",
"TPOTEstimator(classification=True, generations=5, max_eval_time_mins=300,\n",
" population_size=10, scorers=['roc_auc'], scorers_weights=[1],\n",
" search_space=<tpot2.search_spaces.pipelines.sequential.SequentialPipeline object at 0x716238dc50f0>,\n",
" verbose=2)"
Expand Down Expand Up @@ -6257,7 +6257,7 @@
" search_space = search_space,\n",
" population_size= 10,\n",
" generations = 5,\n",
" max_eval_time_seconds = 60*5,\n",
" max_eval_time_mins = 60*5,\n",
" verbose = 2,\n",
")\n",
"\n",
Expand Down
10 changes: 5 additions & 5 deletions Tutorial/7_dask_parallelization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
" search_space = graph_search_space,\n",
" population_size= 10,\n",
" generations = 5,\n",
" max_eval_time_seconds = 60*5,\n",
" max_eval_time_mins = 60*5,\n",
" verbose = 3,\n",
" )\n",
" \n",
Expand Down Expand Up @@ -224,7 +224,7 @@
" search_space = graph_search_space,\n",
" population_size= 10,\n",
" generations = 5,\n",
" max_eval_time_seconds = 60*5,\n",
" max_eval_time_mins = 60*5,\n",
" verbose = 2,\n",
" n_jobs=10,\n",
" memory_limit=\"4GB\"\n",
Expand Down Expand Up @@ -346,7 +346,7 @@
" search_space = graph_search_space,\n",
" population_size= 10,\n",
" generations = 5,\n",
" max_eval_time_seconds = 60*5,\n",
" max_eval_time_mins = 60*5,\n",
" verbose = 2,\n",
")\n",
"\n",
Expand Down Expand Up @@ -429,7 +429,7 @@
" search_space = graph_search_space,\n",
" population_size= 10,\n",
" generations = 5,\n",
" max_eval_time_seconds = 60*5,\n",
" max_eval_time_mins = 60*5,\n",
" verbose = 2,\n",
" )\n",
" est.fit(X_train, y_train)\n",
Expand Down Expand Up @@ -505,7 +505,7 @@
" search_space = graph_search_space,\n",
" population_size= 10,\n",
" generations = 5,\n",
" max_eval_time_seconds = 60*5,\n",
" max_eval_time_mins = 60*5,\n",
" verbose = 2,\n",
" )\n",
" est.fit(X_train, y_train)\n",
Expand Down
2 changes: 1 addition & 1 deletion Tutorial/8_SH_and_early_termination.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
" cv = 5,\n",
" search_space = graph_search_space,\n",
" generations = 50,\n",
" max_eval_time_seconds = 60*5,\n",
" max_eval_time_mins = 60*5,\n",
" verbose = 3,\n",
"\n",
"\n",
Expand Down
8 changes: 4 additions & 4 deletions Tutorial/amltk_search_space_parser_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1285,18 +1285,18 @@
" /* fitted */\n",
" background-color: var(--sklearn-color-fitted-level-3);\n",
"}\n",
"</style><div id=\"sk-container-id-2\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>TPOTEstimator(classification=True, generations=2, max_eval_time_seconds=300,\n",
"</style><div id=\"sk-container-id-2\" class=\"sk-top-container\"><div class=\"sk-text-repr-fallback\"><pre>TPOTEstimator(classification=True, generations=2, max_eval_time_mins=300,\n",
" n_jobs=10, population_size=10, scorers=[&#x27;roc_auc&#x27;],\n",
" scorers_weights=[1],\n",
" search_space=&lt;tpot2.search_spaces.pipelines.sequential.SequentialPipeline object at 0x7d34ec1efbb0&gt;,\n",
" verbose=5)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-18\" type=\"checkbox\" checked><label for=\"sk-estimator-id-18\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;TPOTEstimator<span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>TPOTEstimator(classification=True, generations=2, max_eval_time_seconds=300,\n",
" verbose=5)</pre><b>In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook. <br />On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.</b></div><div class=\"sk-container\" hidden><div class=\"sk-item\"><div class=\"sk-estimator fitted sk-toggleable\"><input class=\"sk-toggleable__control sk-hidden--visually\" id=\"sk-estimator-id-18\" type=\"checkbox\" checked><label for=\"sk-estimator-id-18\" class=\"sk-toggleable__label fitted sk-toggleable__label-arrow fitted\">&nbsp;TPOTEstimator<span class=\"sk-estimator-doc-link fitted\">i<span>Fitted</span></span></label><div class=\"sk-toggleable__content fitted\"><pre>TPOTEstimator(classification=True, generations=2, max_eval_time_mins=300,\n",
" n_jobs=10, population_size=10, scorers=[&#x27;roc_auc&#x27;],\n",
" scorers_weights=[1],\n",
" search_space=&lt;tpot2.search_spaces.pipelines.sequential.SequentialPipeline object at 0x7d34ec1efbb0&gt;,\n",
" verbose=5)</pre></div> </div></div></div></div>"
],
"text/plain": [
"TPOTEstimator(classification=True, generations=2, max_eval_time_seconds=300,\n",
"TPOTEstimator(classification=True, generations=2, max_eval_time_mins=300,\n",
" n_jobs=10, population_size=10, scorers=['roc_auc'],\n",
" scorers_weights=[1],\n",
" search_space=<tpot2.search_spaces.pipelines.sequential.SequentialPipeline object at 0x7d34ec1efbb0>,\n",
Expand All @@ -1320,7 +1320,7 @@
" search_space = tpot_search_space, #converted search space goes here\n",
" population_size= 10,\n",
" generations = 2,\n",
" max_eval_time_seconds = 60*5,\n",
" max_eval_time_mins = 60*5,\n",
" verbose = 5,\n",
" n_jobs=10,\n",
")\n",
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def calculate_version():
'traitlets>=5.8.0',
'lightgbm>=3.3.3',
'optuna>=3.0.5',
'baikal>=0.4.2',
'networkx>=3.0',
'dask>=2024.4.2',
'distributed>=2024.4.2',
Expand Down
9 changes: 8 additions & 1 deletion tpot2/builtin_modules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,11 @@
from .passthrough import Passthrough, SkipTransformer
from .imputer import ColumnSimpleImputer
from .estimatortransformer import EstimatorTransformer
from .passkbinsdiscretizer import PassKBinsDiscretizer
from .passkbinsdiscretizer import PassKBinsDiscretizer

try:
from .nn import PytorchLRClassifier, PytorchMLPClassifier
except (ModuleNotFoundError, ImportError):
pass
# import warnings
# warnings.warn("Warning: optional dependency `torch` is not available. - skipping import of NN models.")
Loading

0 comments on commit 827f08e

Please sign in to comment.