Open MaxHalford opened 11 months ago
Hello @MaxHalford , very nice project. Congrats to you and all the contributors for the work done. @atroyanovsky and myself would like to contribute to the library and be assigned to this issue if possible.
Hey @apagliero! Thanks for the enthusiasm. Knock yourself out!
How is this comming along? Currently interested in using a PerOutputClassifier
Should be relatively trivial I suggest: ` class PerLabelClassifier(base.Wrapper, base.Classifier):
def __init__(self, classifier):
self.classifier = classifier
new_clf = functools.partial(copy.deepcopy, classifier)
self.classifiers = collections.defaultdict(new_clf)
self.classes = set()
@property
def _wrapped_model(self):
return self.classifier
@property
def _multiclass(self):
return True
@classmethod
def _unit_test_params(cls):
yield {"classifier": linear_model.LogisticRegression()}
def learn_one(self, x, y, **kwargs):
for label_name, y_label in y.items():
self.classes.add(label_name)
self.classifiers[label_name].learn_one(x, y_label)
def predict_one(self, x, **kwargs):
predictions = {}
for label in self.classifiers:
predictions[label] = self.classifiers[label].predict_one(x)
return predictions
`
Hi everyone. Sorry for the late update, unfortunately we've been too busy and haven't had time to progress on this issue.
PerOutputClassifier