Multilabel classification
  • Description
  • Discussion
  • Reviews

This example simulates a multi-label document classification problem. The dataset is generated randomly based on the following process:

  • pick the number of labels: n ~ Poisson(n_labels)
  • n times, choose a class c: c ~ Multinomial(theta)
  • pick the document length: k ~ Poisson(length)
  • k times, choose a word: w ~ Multinomial(theta_c)

In the above process, rejection sampling is used to make sure that n is more than 2, and that the document length is never zero. Likewise, we reject classes which have already been chosen. The documents that are assigned to both classes are plotted surrounded by two colored circles.

The classification is performed by projecting to the first two principal components found by PCA and CCA for visualisation purposes, followed by using the sklearn.multiclass.OneVsRestClassifier metaclassifier using two SVCs with linear kernels to learn a discriminative model for each class. Note that PCA is used to perform an unsupervised dimensionality reduction, while CCA is used to perform a supervised one.

Note: in the plot, “unlabeled samples” does not mean that we don’t know the labels (as in semi-supervised learning) but that the samples simply do not have a label.

There are no comments yet
There are no reviews yet
0.00/5 (0)
Version: 1.0
Category: Other
Published: March 12, 2017
Author: scikit-learn developers
Publisher: marami52
License: BSD-3 clause
Try R-Brain for Free

R-Brain is a powerful data science platform, where you can build sophisticated models, collaborate with others, learn and experiment. Try for free, no credit card required.
Try for Free