Skip to content

Instantly share code, notes, and snippets.

@shshemi
Last active August 28, 2019 10:55
Show Gist options
  • Save shshemi/542f8aaacbc0e30ef6c973d42a2e8fc3 to your computer and use it in GitHub Desktop.
Save shshemi/542f8aaacbc0e30ef6c973d42a2e8fc3 to your computer and use it in GitHub Desktop.
def metric_space_violation(input_weights):
def space_violation(y_true, y_pred):
y_pred = K.round(y_pred)
return K.mean(K.maximum(K.batch_dot(y_pred, input_weights, 1) - 1, 0))
return space_violation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment