#!/usr/bin/env python # coding: utf-8 # In[1]: import os os.chdir(os.path.dirname(os.getcwd())) # In[2]: from skmultilearn.problem_transform.br import BinaryRelevance # In[3]: from sklearn.datasets import fetch_rcv1 from sklearn import cross_validation from sklearn.metrics import accuracy_score from sklearn.metrics import f1_score from sklearn.metrics import precision_score # actual estimators from sklearn.naive_bayes import GaussianNB # In[4]: rvc1 = fetch_rcv1() # In[5]: clf = BinaryRelevance(GaussianNB()) # In[6]: cv = cross_validation.ShuffleSplit(rvc1.data.shape[0], n_iter=3, test_size=0.3, random_state=0) scores = cross_validation.cross_val_score(clf, rvc1.data.toarray(), rvc1.target, cv=cv, scoring='f1_macro') # In[ ]: