<jupyter_start><jupyter_text><jupyter_code>!pip install deap update_checker tqdm stopit xgboost
!pip install dask[delayed] dask[dataframe] dask-ml fsspec>=0.3.3 distributed>=2.10.0
!pip install scikit-mdr skrebate
!pip install tpot
from tpot import TPOTClassifier
from sklearn.model_selection import train_test_split
from sklearn.datasets import load_digits
digits = load_digits()
print(digits.data.shape)
import matplotlib.pyplot as plt 
plt.gray() 
plt.matshow(digits.images[0]) 
plt.show() 
digits = load_digits()
X_train, X_test, y_train, y_test = train_test_split(digits.data, digits.target,train_size=0.75, test_size=0.25)

pipeline_optimizer = TPOTClassifier(generations=5, population_size=20,random_state=42, verbosity=2)
pipeline_optimizer.fit(X_train, y_train)
print(pipeline_optimizer.fitted_pipeline_)

print("TEST:")
print(pipeline_optimizer.score(X_test, y_test))
pipeline_optimizer.export('tpot_exported_pipeline.py')
from sklearn.datasets import load_iris
import numpy as np

iris = load_iris()
X_train, X_test, y_train, y_test = train_test_split(iris.data.astype(np.float64),iris.target.astype(np.float64), train_size=0.75, test_size=0.25, random_state=42)

tpot = TPOTClassifier(generations=20, population_size=50, verbosity=2, random_state=42)
tpot.fit(X_train, y_train)
print(tpot.fitted_pipeline_)

print("TEST:")
print(tpot.score(X_test, y_test))
tpot.export('tpot_iris_pipeline.py')
from mlxtend.plotting import plot_confusion_matrix
from sklearn.metrics import confusion_matrix

ypred = tpot.predict(X_test)
matriz = confusion_matrix(y_test,ypred)

plot_confusion_matrix(conf_mat=matriz, figsize=(3,3), show_normed=False)
plt.tight_layout()<jupyter_output><empty_output>