Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get classification report sklearn

>>> from sklearn.metrics import classification_report
>>> y_true = [0, 1, 2, 2, 2]
>>> y_pred = [0, 0, 2, 2, 1]
>>> target_names = ['class 0', 'class 1', 'class 2']
>>> print(classification_report(y_true, y_pred, target_names=target_names))
              precision    recall  f1-score   support

     class 0       0.50      1.00      0.67         1
     class 1       0.00      0.00      0.00         1
     class 2       1.00      0.67      0.80         3

    accuracy                           0.60         5
   macro avg       0.50      0.56      0.49         5
weighted avg       0.70      0.60      0.61         5

>>> y_pred = [1, 1, 0]
>>> y_true = [1, 1, 1]
>>> print(classification_report(y_true, y_pred, labels=[1, 2, 3]))
              precision    recall  f1-score   support

           1       1.00      0.67      0.80         3
           2       0.00      0.00      0.00         0
           3       0.00      0.00      0.00         0

   micro avg       1.00      0.67      0.80         3
   macro avg       0.33      0.22      0.27         3
weighted avg       1.00      0.67      0.80         3
Comment

PREVIOUS NEXT
Code Example
Python :: print 2d array in python 
Python :: how to change kay bindings in pycharm 
Python :: username nextcord interactions 
Python :: python way to unindent blocks of code 
Python :: dataframe row 
Python :: pandas read google sheet 
Python :: turn list of tuples into list 
Python :: python read requests response 
Python :: python input integer 
Python :: get columns that contain null values pandas 
Python :: how to increase bar width in python matplogtlib 
Python :: green fuel 
Python :: django widgets 
Python :: tkinter hello world 
Python :: get stock data in python 
Python :: scientific notation matplotlib python 
Python :: How to set font size of Entry in Tkinter 
Python :: pandas to excel add another sheet in existing excel file 
Python :: datetime year python 
Python :: python max value of list of tuples 
Python :: python catch sigterm 
Python :: data dictionary python into numpy 
Python :: discord.py get guild member list 
Python :: mob psycho 100 
Python :: how to make it so we can give unlimited parameters in python function 
Python :: shutil move overwrite 
Python :: python hello world web application 
Python :: how to convert img to gray python 
Python :: rotate image by specific angle opencv 
Python :: generate sha1 python 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =