2017-11-13 6 views
0

naive bayes python codeでの混乱マトリクスの追加方法をお聞きしたいと思います。 私はnaive bayesコードを持っています naive bayes for iris datanaive bayesでの混乱マトリクスの追加python code

私は混乱マトリックスを追加するためにいくつかの変更が必要です。 私は混乱行列のコードを分けましたが、私はこれを私のコードに置く場所を知らず、何を置き換えるべきかわかりません。ものによって。

y_actu = pd.Series(???, name='Actual') 
y_pred = pd.Series(???, name='Predicted') 
df_confusion = pd.crosstab(y_actu, y_pred, rownames=['Actual'], colnames=['Predicted'], margins=True) 

print df_confusion 

英語を間違えて申し訳ありません。

答えて

0

私はあなたがsklearnのconfusion_matrix機能

from sklearn.metrics import confusion_matrix 

y_actu = pd.Series(???, name='Actual') 
y_pred = pd.Series(???, name='Predicted') 

confusionMatrix = confusion_matrix(y_actu, y_pred) 
print(confusionMatrix) 

Documentation hereを使用することをお勧め!

乾杯!

関連する問題