What do you want to save?
Add Code snippet
New code examples
-
Python 2022-02-21 06:20:05
best algorithm for classification
for clf in classifiers: clf.fit(X_train, y_train) y_pred= clf.predict(X_test) acc = accuracy_score(y_test, y_pred) print("Accuracy of %s is %s"%(clf, acc)) cm = confusion_matrix(y_test, y_pred) print("Confusion Matrix of %... Add solution -
Python 2021-11-19 19:27:14
accuracy for each class
from sklearn.metrics import confusion_matrix import numpy as np y_true = [0, 1, 2, 2, 2] y_pred = [0, 0, 2, 2, 1] target_names = ['class 0', 'class 1', 'class 2'] #Get the confusion matrix cm = confusion_matrix(y_true, y_pred) #array([[1, 0, 0], # [1,... Add solution -
Python 2021-09-21 18:04:04
True Positive, True Negative, False Positive, False Negative in scikit learn
#According to scikit-learn documentation, #http://scikit-learn.org/stable/modules/generated/sklearn.metrics.confusion_matrix.html#sklearn.metrics.confusion_matrix #By definition a confusion matrix C is such that C[i, j] is equal to the number of observa... Add solution
Best helpers
Ranking is empty