Search
 
SCRIPT & CODE EXAMPLE
 

C

classification report to excel

import pandas as pd

def classification_report_csv(report):
    report_data = []
    lines = report.split('
')
    for line in lines[2:-3]:
        row = {}
        row_data = line.split('      ')
        row['class'] = row_data[0]
        row['precision'] = float(row_data[1])
        row['recall'] = float(row_data[2])
        row['f1_score'] = float(row_data[3])
        row['support'] = float(row_data[4])
        report_data.append(row)
    dataframe = pd.DataFrame.from_dict(report_data)
    dataframe.to_csv('classification_report.csv', index = False)

report = classification_report(y_true, y_pred)
classification_report_csv(report)
Comment

PREVIOUS NEXT
Code Example
C :: how to use gets after scanf 
C :: adb switch to usb 
C :: como programar a area de um triangulo em c 
C :: Which of the following are Cetaceans? 
C :: convert string to float c 
C :: print boolean value in c 
C :: if statement shorthand c 
C :: octave sum all elements in matrix 
C :: lerp function c 
C :: multiplication table using c 
C :: populate a map c++ 
C :: how to add two numbers in c programming 
C :: Call by reference to pass an array to the function in C- 
C :: hashmap c 
C :: c fractional sleep 
C :: c style array 
C :: mariadb utf8mb4 
C :: char array to int c 
C :: dynamic memory in c 
C :: c memset 
C :: c substring 
C :: #define arduino 
C :: Example of Implementation of a pointer to an array in C: 
C :: keep last n bits 
C :: adjacency matrix representation maker 
C :: multiplication of matrix in c 
C :: pid of a process in c 
C :: leggere stringhe con spazio in mezzo c 
C :: command line arguments c 
C :: scan c 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =