Using Linear Regression Model With Flower

This question was migrated from Github Discussions.

Original questions:
“Hi, I want to use Federated Learning with my one of the existing classification machine learning models in which I had used Linear regression model for classification. Now, I’m trying to use that model with Flower for implementing Federated Learning.

As in flower there is .setWeight() and .getWeight() used under Fit() and get_parameters() methods, so how can I use Linear regression or other machine learning models with Federated Learning using Flower? Thanks a mill in advance”

Are you talking about the tensorflow quickstarter example?
First of all, you have to differentiate between Flower methods and TF methods.
The method .get_weight() and .set_weight() are coming from tensorflow. They access or set the weights from the AI model created by Tensorflow. Fit() and get_parameters() are methods from Flower. The Fit() function first sets the weights coming from the server. Then the model is trained with fit() (method from Tensorflow). Afterward, we get the updated weights with get_weights() and send them to the server for aggregation.
Linear regression model is as well defined by weight and bias. As soon as you define the model architecture, you defined as well the weight and bias for linear regression. Depending on the machine learning framework you can call the weight and bias.
Tensorflow is really convenient since it already has the method set_weights() and get_weights(). You sometimes have to figure out how an ML framework access the parameters (weight and bias).
You can look to the Jax example ( (…) where we used linear regression.”