[BUG] hinge_loss multi
See original GitHub issue>>> sklearn.metrics.hinge_loss(y_true=[2,1,0,1,0,1,1], pred_decision=[0,1,2,1,0,2,1])
2378 y_true = le.transform(y_true)
2379 mask = np.ones_like(pred_decision, dtype=bool)
-> 2380 mask[np.arange(y_true.shape[0]), y_true] = False
2381 margin = pred_decision[~mask]
2382 margin -= np.max(pred_decision[mask].reshape(y_true.shape[0], -1),
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
4. Hinge Loss/Multi-class SVM Loss - YouTube
Hinge Loss / Multi -class SVM Loss is used for maximum-margin classification, especially for support vector machines or SVM. Hinge loss at ...
Read more >How can I use Hinge loss for Multi-class Support Vector ...
I have coded a Multi-class SVM classifier using Hinge loss as loss function. I worked on the knowledge in this article: ...
Read more >How to Choose Loss Functions When Training Deep Learning ...
Binary Classification Loss Functions. Binary Cross-Entropy; Hinge Loss; Squared Hinge Loss. Multi-Class Classification Loss Functions.
Read more >Categorical hinge loss · Issue #2830 · keras-team/keras - GitHub
If the hinge loss were multiclass (=multiple classes, single correct label) in keras then it should implement:.
Read more >How to implement multi-class hinge loss in tensorflow
I find it difficult to get the second max prediction probability when the prediction is correct. I tried to use tf.nn.top_k to calculate...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, so I take and raise an Error if the shape of
pred_decision
is not consistent withy_true
(orlabels
) like said @thomasjpfan.No, the hinge loss requires the real-valued decision function, not the predicted classes
where pred_decision is