<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Classification with AutoML (auto-sklearn)
Step1:  Note
Step2:  Print the final ensemble constructed by auto-sklearn
<ASSISTANT_TASK:>
Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import numpy as np
from sklearn import datasets, metrics, model_selection, preprocessing, pipeline
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
import autosklearn.classification
wine = datasets.load_wine()
print(wine.DESCR)
X = pd.DataFrame(wine.data, columns=wine.feature_names)
y = wine.target
X_train, X_test, y_train, y_test = model_selection.train_test_split(X, y, train_size=0.5, stratify=y)
df_train = pd.DataFrame(y_train, columns=['target'])
df_train['type'] = 'train'
df_test = pd.DataFrame(y_test, columns=['target'])
df_test['type'] = 'test'
df_set = df_train.append(df_test)
_ = sns.countplot(x='target', hue='type', data=df_set)     
print('train samples:', len(X_train))
print('test samples', len(X_test))
Explanation: Classification with AutoML (auto-sklearn)
End of explanation
model = autosklearn.classification.AutoSklearnClassifier(time_left_for_this_task=30, ensemble_size=3)
%%capture
# ignore oput from model fit with capture magic command
model.fit(X_train, y_train)
Explanation: Note: We do some restrictions here running time and number of ensembles, because the model fitting would not take much longer. So this is just an example how you could run AutoML.
End of explanation
for m in model.get_models_with_weights():
    print(m)
predicted = model.predict(X_test)
confusion_matrix = pd.DataFrame(metrics.confusion_matrix(y_test, predicted))
confusion_matrix
_ = sns.heatmap(confusion_matrix, annot=True, cmap="Blues")
print("accuracy: {:.3f}".format(metrics.accuracy_score(y_test, predicted)))
print("precision: {:.3f}".format(metrics.precision_score(y_test, predicted, average='weighted')))
print("recall: {:.3f}".format(metrics.recall_score(y_test, predicted, average='weighted')))
print("f1 score: {:.3f}".format(metrics.f1_score(y_test, predicted, average='weighted')))
Explanation: Print the final ensemble constructed by auto-sklearn
End of explanation
<END_TASK>