Cost-Sensitive Label Embedding with Multidimensional Scaling

class skmultilearn.embedding.CLEMS(measure, is_score=False, params=None)[source]

Bases: sklearn.base.BaseEstimator

Embed the label space using a label network embedder from OpenNE

Parameters:
  • measure (Callable) – a cost function executed on two label vectors
  • dimension (int) – the dimension of the label embedding vectors
  • is_score (boolean) – set to True if measures is a score function (higher value is better), False if loss function (lower is better)
  • param_dict (dict or None) – parameters passed to the embedder, don’t use the dimension and graph parameters, this class will set them at fit

Example code for using this embedder looks like this:

from skmultilearn.embedding import CLEMS, EmbeddingClassifier
from sklearn.ensemble import RandomForestRegressor
from skmultilearn.adapt import MLkNN
from sklearn.metrics import accuracy_score
clf = EmbeddingClassifier(
 CLEMS(accuracy_score, True),
 RandomForestRegressor(n_estimators=10),
 MLkNN(k=5)
)
clf.fit(X_train, y_train)
predictions = clf.predict(X_test)
fit(X, y)[source]

Fits the embedder to data

Parameters:
  • X (array_like, numpy.matrix or scipy.sparse matrix, shape=(n_samples, n_features)) – input feature matrix
  • y (array_like, numpy.matrix or scipy.sparse matrix of {0, 1}, shape=(n_samples, n_labels)) – binary indicator matrix with label assignments
Returns:

fitted instance of self

Return type:

self

fit_transform(X, y)[source]

Fit the embedder and transform the output space

Parameters:
  • X (array_like, numpy.matrix or scipy.sparse matrix, shape=(n_samples, n_features)) – input feature matrix
  • y (array_like, numpy.matrix or scipy.sparse matrix of {0, 1}, shape=(n_samples, n_labels)) – binary indicator matrix with label assignments
Returns:

results of the embedding, input and output space

Return type:

X, y_embedded

Navigation

AltStyle によって変換されたページ (->オリジナル) /