Federated learning for multi classes classification

I’m a new to python as well as machine learning. I’m trying to use logistic regression for federated learning program for multiclass labels (sitting, sittingdown, standing, standingup, walking) for UCI HAR Dataset. it’s working for binary classification but for multiclassification when I’m trying to find out precision and recall, it is throwing the following error:

ValueError: Target is multiclass but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted'].

Can anyone please suggest me how to proceed with it? I have tried to classify 6 labels by LG classified (multi-classes) with FL instead of using binary classification.


sklearn.metrics.precision_score uses the binary average by default, which is only defined for the binary use case.
For multi-class/-label classification, you would have to define one of the suggested average settings.
The docs give you some information about each average.

1 Like

Hey mohammed_ibrahim
I’m one of the cofounders of DataFleets.
Way to dive in on Federated Learning…was your question sufficiently addressed?

1 Like

Hey Nick

unfortunately no, I want to use the code but for 6 classes? Such that the prediction falls into one of the classes or activities (walking, walkingupstairs, walkingdownstairs, sitting, standing, lying).

Any advice or solution is highly appreciated.