How to adapt sklearn.semi_supervised.SelfTrainingClassifier() to train a semi-supervised model of multi-label dataset?

24 views Asked by At

I am working on creating a semi-supervised model using multi-label dataset.

I have tried using sklearn.semi_supervised.SelfTrainingClassifier() (sklearn version 1.4.1):

clf = SelfTrainingClassifier(base_classifier())
clf.fit(X_labeled, y_labeled)

which returns the following error:

"ValueError: y should be a 1d array, got an array of shape (n_samples, n_labels) instead."

It seems the function does not directly support multi-output data. I tried inserting MultiOutputClassifier(clf) before clf.fit(X_labeled, y_labeled). It works and can generate a model but cannot check the results of the model with attributes like clf.transduction_(clf is now a multi-output classifier, not a semi-supervised classifier).

So, can you explain whether we can adapt the code for the method to work with multi-label data? Thank you in advance.

0

There are 0 answers