gunnwu 2023. 5. 29. 23:09

Auto ML copysheet / 개념은 추후 정리해서 업로드 예정

! pip install tpot

import pandas as pd
from tpot import TPOTClassifier
from sklearn.model_selection import train_test_split

# load and prepare the data
## 학습데이터와 검증데이터는 모두 준비가 되었다고 가정
# train and test the model using TPOT


tpot = TPOTClassifier(generations=5, population_size=20, verbosity=2)
tpot.fit(s_x_train, s_y_train)
score = tpot.score(x_test, y_test)
print('Accuracy:', score)

# evaluate the model performance
predictions = tpot.predict(x_test)
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score
print('Accuracy:', accuracy_score(y_test, predictions))
print('Precision:', precision_score(y_test, predictions))
print('Recall:', recall_score(y_test, predictions))
print('F1 Score:', f1_score(y_test, predictions))