SHARE
TWEET

Untitled

a guest May 25th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. classifier = OneVsRestClassifier(SGDClassifier(loss='log', alpha=0.00001, penalty='l1', class_weight="balanced"), n_jobs=-1)
  2. classifier.fit(x_train_multilabel, y_train)
  3. predictions = classifier.predict (x_test_multilabel)
  4.  
  5. precision = precision_score(y_test, predictions, average='micro')
  6. recall = recall_score(y_test, predictions, average='micro')
  7. f1 = f1_score(y_test, predictions, average='micro')
  8.  
  9. print("Micro-average quality numbers")
  10. print("Precision: {:.4f}, Recall: {:.4f}, F1-measure: {:.4f}".format(precision, recall, f1))
  11.  
  12. precision = precision_score(y_test, predictions, average='macro')
  13. recall = recall_score(y_test, predictions, average='macro')
  14. f1 = f1_score(y_test, predictions, average='macro')
  15.  
  16. print("Macro-average quality numbers")
  17. print("Precision: {:.4f}, Recall: {:.4f}, F1-measure: {:.4f}".format(precision, recall, f1))
  18. print (metrics.classification_report(y_test, predictions))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top