0
votes

I'd like to do multilabel classification (with values 0 and 1 per label) for a bunch of text (but that's not really important, the vectorisation already works fine).

However, some of my label columns will also contain null/NaN (whatever representation for "there is no information").

Is this possible with scikit-learn?

My (working) code for a regular dataset: (rough edited snippet)

clf = OneVsRestClassifier(ComplementNB(alpha=.01))
clf.fit(x_train, train_labels)
preds = clf.predict(x_val)
f1_score = metrics.f1_score(val_labels, preds, average="micro")

So I'm offloading a lot of the work to scikit-learn. I can't just go about dropping all records that have a null somewhere in their labels, or I'd lose out on a bunch of information.

I guess what I want is "when learning a model for each label separately (which is what OneVsRest does, afaik), then only learn from the records that have actual values". So like a local dropna()? I'm not interested in imputing the missing values, that would make no sense. The information given is "we don't know if this label applies or not, so just ignore it for this record".