# https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.GradientBoostingClassifier.html from sklearn.ensemble import GradientBoostingClassifier #https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.train_test_split.html from sklearn.model_selection import train_test_split import numpy csvdata = numpy.loadtxt('sample.csv', delimiter=',', dtype='float') #https://note.nkmk.me/python-numpy-loadtxt-genfromtxt-savetxt/ X, y = numpy.delete(csvdata, csvdata.shape[1]-1, 1), numpy.delete(csvdata, slice(csvdata.shape[1]-1), 1).reshape(-1) X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=0) clf = GradientBoostingClassifier(n_estimators=100, learning_rate=1.0, max_depth=1, random_state=0).fit(X_train, y_train) clf.score(X_test, y_test)