theAIguy commited on
Commit
910988a
1 Parent(s): 801872c
Files changed (1) hide show
  1. triplet_margin_loss.py +1 -12
triplet_margin_loss.py CHANGED
@@ -58,17 +58,6 @@ Examples:
58
 
59
 
60
  _CITATION = """
61
- @article{scikit-learn,
62
- title={Scikit-learn: Machine Learning in {P}ython},
63
- author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.
64
- and Thirion, B. and Grisel, O. and Blondel, M. and Prettenhofer, P.
65
- and Weiss, R. and Dubourg, V. and Vanderplas, J. and Passos, A. and
66
- Cournapeau, D. and Brucher, M. and Perrot, M. and Duchesnay, E.},
67
- journal={Journal of Machine Learning Research},
68
- volume={12},
69
- pages={2825--2830},
70
- year={2011}
71
- }
72
  @article{schultz2003learning,
73
  title={Learning a distance metric from relative comparisons},
74
  author={Schultz, Matthew and Joachims, Thorsten},
@@ -104,7 +93,7 @@ class TripletMarginLoss(evaluate.EvaluationModule):
104
  for a, p, n in zip(anchor, positive, negative):
105
  d_a_p_sum += (a - p)**2
106
  d_a_n_sum += (a - n)**2
107
- loss = max(np.sqrt(d_a_p_sum) - np.sqrt(d_a_n_sum) + margin, 0)
108
  return {
109
  "triplet_margin_loss": float(
110
  loss
 
58
 
59
 
60
  _CITATION = """
 
 
 
 
 
 
 
 
 
 
 
61
  @article{schultz2003learning,
62
  title={Learning a distance metric from relative comparisons},
63
  author={Schultz, Matthew and Joachims, Thorsten},
 
93
  for a, p, n in zip(anchor, positive, negative):
94
  d_a_p_sum += (a - p)**2
95
  d_a_n_sum += (a - n)**2
96
+ loss = max(np.sqrt(d_a_p_sum) - np.sqrt(d_a_n_sum) + margin, 0)
97
  return {
98
  "triplet_margin_loss": float(
99
  loss