Hi Dr. Vadim,
In your Keras example, the CancelOut loss does not contain the variance term
def call(self, inputs):
if self.cancelout_loss:
self.add_loss( self.lambda_1 * tf.norm(self.w, ord=1) + self.lambda_2 * tf.norm(self.w, ord=2))
return tf.math.multiply(inputs, self.activation(self.w))
May I ask why we need to sum up the L1-norm and L2-norm of the weight here?
Also, in your Pytorch notebook, it is mentioned that the variance term is optional. So we can set that term to 0?
Regards,
Tan
Hi Dr. Vadim,
In your Keras example, the CancelOut loss does not contain the variance term
def call(self, inputs):
if self.cancelout_loss:
self.add_loss( self.lambda_1 * tf.norm(self.w, ord=1) + self.lambda_2 * tf.norm(self.w, ord=2))
return tf.math.multiply(inputs, self.activation(self.w))
May I ask why we need to sum up the L1-norm and L2-norm of the weight here?
Also, in your Pytorch notebook, it is mentioned that the variance term is optional. So we can set that term to 0?
Regards,
Tan