scikit learn output metrics.classification_report into CSV/tab-delimited format

后端 未结 17 2174
青春惊慌失措
青春惊慌失措 2021-01-31 03:08

I\'m doing a multiclass text classification in Scikit-Learn. The dataset is being trained using the Multinomial Naive Bayes classifier having hundreds of labels. Here\'s an extr

17条回答
  •  情歌与酒
    2021-01-31 03:48

    The way I have always solved output problems is like what I've mentioned in my previous comment, I've converted my output to a DataFrame. Not only is it incredibly easy to send to files (see here), but Pandas is really easy to manipulate the data structure. The other way I have solved this is writing the output line-by-line using CSV and specifically using writerow.

    If you manage to get the output into a dataframe it would be

    dataframe_name_here.to_csv()
    

    or if using CSV it would be something like the example they provide in the CSV link.

提交回复
热议问题