I want to build a multi-class classification model using Keras. My data is containing 7 features and 4 labels. If I am using Keras I have seen two ways to apply the Support vector Machine (SVM) algorithm.
First: A Quasi-SVM in Keras By using the (RandomFourierFeatures layer) presented here I have built the following model:
def create_keras_model():
initializer = tf.keras.initializers.GlorotNormal()
return tf.keras.models.Sequential([
layers.Input(shape=(7,)),
RandomFourierFeatures(output_dim=4822, kernel_initializer=initializer),
layers.Dense(units=4, activation='softmax'),
])
Second: Using the last layer in the network as described here as follows:
def create_keras_model():
return tf.keras.models.Sequential([
tf.keras.layers.Input(shape=(7,)),
tf.keras.layers.Dense(64),
tf.keras.layers.Dense(4, kernel_regularizer=l2(0.01)),
tf.keras.layers.Softmax()
])
note: CategoricalHinge()
was used as the loss function.
My question is: are these approaches appropriate and can be defined as applying of SVM model or it is just an approximation of the model architecture? in short, can I say this is applying of SVM model?