Scikit Learn Multilabel Classification, Getting back labels from MultiLabelBinarizer -


in multilabel classification problem, use multilabelbinarizer transform 20 text labels binary list of zeros , ones.

after prediction list of 20 binary values, , output corresponding text labels.

i wondering whether multilabelbinarizer() provides getting transformation or should manually.

yes, multilabelbinarizer provides method named inverse_transform() convert binarized labels original names supplied during fit().

http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.multilabelbinarizer.html#sklearn.preprocessing.multilabelbinarizer.inverse_transform

inverse_transform(yt)

transform given indicator matrix label sets parameters:     yt : array or sparse matrix of shape (n_samples, n_classes)      matrix containing 1s ands 0s.  returns:    y : list of tuples      set of labels each sample such y[i] consists of classes_[j] each yt[i, j] == 1. 

Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -