Train local model with SVM instead of NN in federated learning


I have a dataset with numeric features and labels. I am building a federated learning model using TensorFlow (TFF).
Basically, the model that I have is the (neural network) which is always explained in the TFF tutorials.
I want to ask if there is a chance to build another model for the local clients, such as SVM? since it suits my dataset.

My neural network:

def create_keras_model():
  initializer = tf.keras.initializers.Zeros()
  return tf.keras.models.Sequential([
      tf.keras.layers.Dense(4, kernel_initializer= initializer),
def model_fn():
  keras_model = create_keras_model()
  return tff.learning.from_keras_model(


TFF supports a wide variety of models, including just about any model you can write in tf.keras.

You can also create a TFF model directly by subclassing with the code for your forward pass. If you are interested in a more functional approach, you could also define an SVM model via TFF’s FunctionalModel

Answered By – Zachary Charles

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published