본문 바로가기

Programming/Machine Learning

정밀도, 재현율, F1score

from sklearn.metrics import classification_report

X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)
    
tree = DecisionTreeClassifier()
result = cross_val_score(tree, X_train, y_train, cv = 5)
print("모델성능 : {:.2f}".format(result.mean()))
    
tree.fit(X_train, y_train)
          
labels = y_test
guesses = tree.predict(X_test)
    
print(classification_report(labels, guesses))