skmultilearn.ensemble package

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:

class skmultilearn.ensemble.RakelD(classifier=None, labelset_size=None, require_dense=None)[source]

Bases: skmultilearn.ensemble.partition.LabelSpacePartitioningClassifier

Distinct RAndom k-labELsets multi-label classifier.

generate_partition(X, y)[source]

Randomly partition the label space

This function randomly partitions the label space of n_labels into n_label/k equipartitions of size k.

Parameters:
  • X – not used, maintained for api compatibility
  • y (dense or sparse matrix of {0, 1} (n_samples, n_labels)) – binary indicator matrix with label assignments

Sets self.partition, self.model_count and self.label_count.

class skmultilearn.ensemble.RakelO(classifier=None, model_count=None, labelset_size=None, require_dense=None)[source]

Bases: skmultilearn.ensemble.rakeld.RakelD

Overlapping RAndom k-labELsets multi-label classifier.

generate_partition(X, y)[source]

Randomly divide the label space

This function randomly divides the label space of n_labels into model_count equal subspaces of size labelset_size.

Parameters:
  • X – not used, maintained for api compatibility
  • y (dense or sparse matrix of {0, 1} (n_samples, n_labels)) – binary indicator matrix with label assignments

Sets self.partition, self.label_count.

predict(X)[source]

Predict probabilities of label assignments for X

Internally this method uses a sparse CSC representation for X (scipy.sparse.csr_matrix).

Parameters:X (dense or sparse matrix (n_samples, n_labels)) – input features
Returns:matrix with label assignment probabilities
Return type:sparse matrix of float (n_samples, n_labels)
class skmultilearn.ensemble.LabelSpacePartitioningClassifier(classifier=None, clusterer=None, require_dense=None)[source]

Bases: skmultilearn.problem_transform.br.BinaryRelevance

Community detection base classifier

Parameters:

classifier : scikit classifier type

The base classifier that will be used in a class, will be automagically put under self.classifier for future access.

clusterer: an skmultilearn.cluster.base object that partitions the output space

require_dense : [boolean, boolean]

Whether the base classifier requires input as dense arrays, False by default for

generate_partition(X, y)[source]
predict(X)[source]

Predict labels for X, see base method’s documentation.

class skmultilearn.ensemble.FixedLabelPartitionClassifier(classifier=None, require_dense=None, partition=None)[source]

Bases: skmultilearn.ensemble.partition.LabelSpacePartitioningClassifier

Classify given a fixed Label Space partition

generate_partition(X, y)[source]

Assign fixed partition of the label space

Mock function, the partition is assigned in the constructor.

Parameters:
  • X – not used, maintained for api compatibility
  • y (dense or sparse matrix of {0, 1} (n_samples, n_labels)) – binary indicator matrix with label assignments

Sets self.model_count and self.label_count.

class skmultilearn.ensemble.LabelSpacePartitioningClassifier(classifier=None, clusterer=None, require_dense=None)[source]

Bases: skmultilearn.problem_transform.br.BinaryRelevance

Community detection base classifier

Parameters:

classifier : scikit classifier type

The base classifier that will be used in a class, will be automagically put under self.classifier for future access.

clusterer: an skmultilearn.cluster.base object that partitions the output space

require_dense : [boolean, boolean]

Whether the base classifier requires input as dense arrays, False by default for

generate_partition(X, y)[source]
predict(X)[source]

Predict labels for X, see base method’s documentation.

Submodules

skmultilearn.ensemble.fixed module

class skmultilearn.ensemble.fixed.FixedLabelPartitionClassifier(classifier=None, require_dense=None, partition=None)[source]

Bases: skmultilearn.ensemble.partition.LabelSpacePartitioningClassifier

Classify given a fixed Label Space partition

generate_partition(X, y)[source]

Assign fixed partition of the label space

Mock function, the partition is assigned in the constructor.

Parameters:
  • X – not used, maintained for api compatibility
  • y (dense or sparse matrix of {0, 1} (n_samples, n_labels)) – binary indicator matrix with label assignments

Sets self.model_count and self.label_count.

skmultilearn.ensemble.partition module

class skmultilearn.ensemble.partition.LabelSpacePartitioningClassifier(classifier=None, clusterer=None, require_dense=None)[source]

Bases: skmultilearn.problem_transform.br.BinaryRelevance

Community detection base classifier

Parameters:

classifier : scikit classifier type

The base classifier that will be used in a class, will be automagically put under self.classifier for future access.

clusterer: an skmultilearn.cluster.base object that partitions the output space

require_dense : [boolean, boolean]

Whether the base classifier requires input as dense arrays, False by default for

generate_partition(X, y)[source]
predict(X)[source]

Predict labels for X, see base method’s documentation.

skmultilearn.ensemble.rakeld module

class skmultilearn.ensemble.rakeld.RakelD(classifier=None, labelset_size=None, require_dense=None)[source]

Bases: skmultilearn.ensemble.partition.LabelSpacePartitioningClassifier

Distinct RAndom k-labELsets multi-label classifier.

generate_partition(X, y)[source]

Randomly partition the label space

This function randomly partitions the label space of n_labels into n_label/k equipartitions of size k.

Parameters:
  • X – not used, maintained for api compatibility
  • y (dense or sparse matrix of {0, 1} (n_samples, n_labels)) – binary indicator matrix with label assignments

Sets self.partition, self.model_count and self.label_count.

skmultilearn.ensemble.rakelo module

class skmultilearn.ensemble.rakelo.RakelO(classifier=None, model_count=None, labelset_size=None, require_dense=None)[source]

Bases: skmultilearn.ensemble.rakeld.RakelD

Overlapping RAndom k-labELsets multi-label classifier.

generate_partition(X, y)[source]

Randomly divide the label space

This function randomly divides the label space of n_labels into model_count equal subspaces of size labelset_size.

Parameters:
  • X – not used, maintained for api compatibility
  • y (dense or sparse matrix of {0, 1} (n_samples, n_labels)) – binary indicator matrix with label assignments

Sets self.partition, self.label_count.

predict(X)[source]

Predict probabilities of label assignments for X

Internally this method uses a sparse CSC representation for X (scipy.sparse.csr_matrix).

Parameters:X (dense or sparse matrix (n_samples, n_labels)) – input features
Returns:matrix with label assignment probabilities
Return type:sparse matrix of float (n_samples, n_labels)