![how to install free label matrix 7 how to install free label matrix 7](https://docplayer.net/docs-images/46/21490610/images/page_2.jpg)
Print("F1 Score: ", f1_score(y_test, y_pred, average="macro")) X_train, X_test, y_train, y_test = model_ain_test_split(feature_vectors, y, test_size=test_size, random_state=seed)įrom trics import accuracy_score, f1_score, precision_score, recall_score, classification_report, confusion_matrix Plt.text(j, i, "'.format(accuracy, misclass)) Thresh = cm.max() / 1.5 if normalize else cm.max() / 2įor i, j in itertools.product(range(cm.shape), range(cm.shape)):
![how to install free label matrix 7 how to install free label matrix 7](https://support.content.office.net/en-us/media/01360282-f1c4-4629-883d-9e91b000b1c4.png)
Plt.xticks(tick_marks, target_names, rotation=45)Ĭm = cm.astype('float') / cm.sum(axis=1) Tick_marks = np.arange(len(target_names)) Plt.imshow(cm, interpolation='nearest', cmap=cmap) Title = best_estimator_name) # title of graphĪccuracy = np.trace(cm) / np.sum(cm).astype('float') Target_names = y_labels_vals, # list of names of the classes
![how to install free label matrix 7 how to install free label matrix 7](https://ars.els-cdn.com/content/image/1-s2.0-S0092867421006322-fx1.jpg)
Plot_confusion_matrix(cm = cm, # confusion matrix created by Normalize: If False, plot the raw numbers Title: the text to display at the top of the matrixĬmap: the gradient of the values displayed from Target_names: given classification classes such as Given a sklearn confusion matrix (cm), make a nice plotĬm: confusion matrix from _matrix I found a function that can plot the confusion matrix which generated from sklearn.