python tpot做回归

tpot做回归模型

import numpy as np
from tpot import TPOTRegressor

heart_data = np.load('data/heart_preproc.npz')

X_train = heart_data['X_train']
X_test = heart_data['X_test']
y_train = heart_data['y_train']
y_test = heart_data['y_test']

tpot = TPOTRegressor(generations=5, population_size=20, verbosity=1, scoring='r2')  
tpot.fit(X_train, y_train.ravel())
print(tpot.score(X_test, y_test.ravel()))

你可能感兴趣的:(机器学习)