Я работаю над анализом настроений, я использовал вектор числа пиплайнов и TFIDF. Можно ли построить график с помощью отчета о классификации matplotlib?Давайте предположим, что я распечатываю отчет о классификации следующим образом:
mnb = MultinomialNB()
countvect = CountVectorizer()
# MultinomialNB
best_mnb_countvect = grid_vect(mnb, parameters_mnb, X_train, X_test, parameters_text=parameters_vect, vect=countvect)
и получаю это:
Performing grid search...
pipeline: ['features', 'clf']
parameters:
{'clf__alpha': (0.25, 0.5, 0.75),
'features__pipe__vect__max_df': (0.25, 0.5, 0.75),
'features__pipe__vect__min_df': (1, 2),
'features__pipe__vect__ngram_range': ((1, 1), (1, 2))}
Fitting 5 folds for each of 36 candidates, totalling 180 fits
[Parallel(n_jobs=-1)]: Using backend LokyBackend with 2 concurrent workers.
[Parallel(n_jobs=-1)]: Done 46 tasks | elapsed: 50.2s
[Parallel(n_jobs=-1)]: Done 180 out of 180 | elapsed: 3.2min finished
done in 201.063s
Best CV score: 0.783
Best parameters set:
clf__alpha: 0.25
features__pipe__vect__max_df: 0.25
features__pipe__vect__min_df: 1
features__pipe__vect__ngram_range: (1, 2)
Test score with best_estimator_: 0.797
Classification Report Test Data
precision recall f1-score support
NEG 0.79 0.80 0.80 2227
POS 0.80 0.80 0.80 2301
accuracy 0.80 4528
macro avg 0.80 0.80 0.80 4528
weighted avg 0.80 0.80 0.80 4528