決定木
1 2 3 4 5 6 7 8 9 10 11 12 13 |
train_X = df.drop('Survived', axis=1) train_y = df.Survived (train_X, test_X ,train_y, test_y) = train_test_split(train_X, train_y, test_size = 0.3, random_state = 666) #決定木 clf = DecisionTreeClassifier(random_state=0) clf = clf.fit(train_X, train_y) pred = clf.predict(test_X) #決定木のモデルスコア fpr, tpr, thresholds = roc_curve(test_y, pred, pos_label=1) auc(fpr, tpr) accuracy_score(pred, test_y) |
コメントを残す