scikit-multilearn API Reference

Scikit-multilearn is a BSD-licensed library for multi-label classification that is built on top of the well-known scikit-learn ecosystem.

Classifiers and tools

Algorithm Adaptation approaches

The skmultilearn.adapt module implements algorithm adaptation approaches to multi-label classification.

Algorithm adaptation methods for multi-label classification concentrate on adapting single-label classification algorithms to the multi-label case usually by changes in cost/decision functions.

Currently the following algorithm adaptation classification schemes are available in scikit-multilearn:

Classifier Description
BRkNNaClassifier a Binary Relevance kNN classifier that assigns a label if at least half of the neighbors are also classified with the label
BRkNNbClassifier a Binary Relevance kNN classifier that assigns top m labels of neighbors with m - average number of labels assigned to neighbors
MLkNN a multi-label adapted kNN classifier with bayesian prior corrections
MLARAM a multi-Label Hierarchical ARAM Neural Network
MLTSVM twin multi-Label Support Vector Machines

Problem Transformation approaches

The skmultilearn.problem_transform module provides classifiers that follow the problem transformation approaches to multi-label classification.

The problem transformation approach to multi-label classification converts multi-label problems to single-label problems: single-class or multi-class.

Classifier Description
BinaryRelevance treats each label as a separate single-class classification problem
ClassifierChain treats each label as a part of a conditioned chain of single-class classification problems
LabelPowerset treats each label combination as a separate class with one multi-class classification problem

Multi-label embeddings

The skmultilearn.embedding module provides implementations of label space embedding methods and a general embedding based classifier.

Name Description
CLEMS Cost-Sensitive Label Embedding with Multidimensional Scaling
OpenNetworkEmbedder Label Network Embedding for Multilabel Classification
SKLearnEmbedder Wrapper for scikit-learn embedders
EmbeddingClassifier A general embedding-based classifier

Ensembles of classifiers

The skmultilearn.ensemble module implements ensemble classification schemes that construct an ensemble of base multi-label classifiers.

Currently the following ensemble classification schemes are available in scikit-multilearn:

Classifier name Description
RakelD Distinct RAndom k-labELsets multi-label classifier
RakelO Overlapping RAndom k-labELsets multi-label classifier.
LabelSpacePartitioningClassifier a label space partitioning classifier that trains a classifier per label subspace as clustered using methods from skmultilearn.cluster.
MajorityVotingClassifier a label space division classifier that trains a classifier per label subspace as clustered using methods from skmultilearn.cluster and assign labels if the majority of classifiers that contain the label agree on the assignment.

Label Space Clusterers

The skmultilearn.cluster module gathers label space clustering methods.

Name Description
FixedLabelSpaceClusterer Return a predefined fixed clustering, usually driven by expert knowledge
MatrixLabelSpaceClusterer Cluster the label space using a scikit-compatible matrix-based clusterer
GraphToolLabelGraphClusterer Fits a Stochastic Block Model to the Label Graph and infers the communities
StochasticBlockModel A Stochastic Blockmodel class
IGraphLabelGraphClusterer Clusters label space using igraph community detection
RandomLabelSpaceClusterer Randomly divides label space into equally-sized clusters
NetworkXLabelGraphClusterer Cluster label space with NetworkX community detection

External classifiers

The skmultilearn.ext provides wrappers for other multi-label classification libraries. Currently it provides a wrapper for:

Currently the available classes include:

Name Description
Meka Wrapper for the Multilabel Extension to WEKA - MEKA library
Keras Wrapper for the Python Deep Learning library - KERAS
download_meka() Helper function for installing MEKA

Model selection and data manipulation

The skmultilearn.model_selection module provides implementations multi-label stratification methods useful for parameter estimation.

Currently the available modules include:

Name Description
iterative_stratification Iterative stratification
measures Stratification quality measures package