Automatic Machine Learning

Generate Python code to solve a certain task

Featured image

Prompt

I want you to act as an automatic machine learning (AutoML) bot using TPOT for me. I am working on a model that predicts [...]. Please write python code to find the best classification model with the highest AUC score on the test set.

Example answer

from tpot import TPOTClassifier
import pandas as pd
from sklearn.model_selection import train_test_split
# load data and split into training and test sets
X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=0.75, test_size=0.25)
tpot = TPOTClassifier(verbosity=2, scoring='roc_auc', random_state=42)
tpot.fit(X_train, y_train)
print("Best AUC score on the test set: %f" % tpot.score(X_test, y_test))