In [1]:
    
from tpot import TPOT
from sklearn.datasets import load_iris
from sklearn.cross_validation import train_test_split
    
Load the IRIS data set and explore its contents.
In [2]:
    
iris = load_iris()
iris.data[0:5], iris.target
    
    Out[2]:
Split the data set in train and test.
In [3]:
    
X_train, X_test, y_train, y_test = train_test_split(iris.data, iris.target,
                                                    train_size=0.75, test_size=0.25)
X_train.shape, X_test.shape, y_train.shape, y_test.shape
    
    Out[3]:
In [4]:
    
tpot = TPOT(generations=5)
tpot.fit(X_train, y_train)
print(tpot.score(X_test, y_test))
    
    
In [5]:
    
tpot.export('tpot_iris_pipeline.py')
    
In [ ]: