Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
else:
self.n_classes = 1
supervised_output = Dense(self.n_classes, activation='sigmoid',
name='supervised')(anchor_embedding)
else:
# Binary Linear SVM output
if len(Y.shape) > 1:
self.n_classes = Y.shape[-1]
else:
self.n_classes = 1
supervised_output = Dense(self.n_classes, activation='linear',
name='supervised',
kernel_regularizer=regularizers.l2())(anchor_embedding)
else:
if not is_hinge(self.supervision_metric):
validate_sparse_labels(Y)
self.n_classes = len(np.unique(Y[Y != np.array(-1)]))
# Softmax classifier
supervised_output = Dense(self.n_classes, activation='softmax',
name='supervised')(anchor_embedding)
else:
self.n_classes = len(np.unique(Y, axis=0))
# Multiclass Linear SVM output
supervised_output = Dense(self.n_classes, activation='linear',
name='supervised',
kernel_regularizer=regularizers.l2())(anchor_embedding)
else:
# Regression
if len(Y.shape) > 1:
self.n_classes = Y.shape[-1]
else:
self.n_classes = 1