Horje
classification report to excel Code Example
classification report to excel
import pandas as pd

def classification_report_csv(report):
    report_data = []
    lines = report.split('\n')
    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)




C

Related
postgres login mac Code Example postgres login mac Code Example
adb switch to usb Code Example adb switch to usb Code Example
code: 'EADDRINUSE', [0]   errno: 'EADDRINUSE', [0]   syscall: 'listen', [0]   address: '::', [0]   port: 5000 Code Example code: 'EADDRINUSE', [0] errno: 'EADDRINUSE', [0] syscall: 'listen', [0] address: '::', [0] port: 5000 Code Example
npm rxjs Code Example npm rxjs Code Example
whoami bash file Code Example whoami bash file Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
15