[MRG+1] Implements Multiclass hinge loss

Implements multiclass hinge loss. Fixes #3451 
yes.

On Tue, Oct 28, 2014 at 5:08 PM, Saurabh Jha <notifications@github.com>
wrote:

> In sklearn/metrics/classification.py:
>
> > -    # are encoded as +1 and -1 respectively
> > -    lbin = LabelBinarizer(neg_label=-1)
> > -    y_true = lbin.fit_transform(y_true)[:, 0]
> > -
> > -    if len(lbin.classes_) > 2 or (pred_decision.ndim == 2
> > -                                  and pred_decision.shape[1] != 1):
> > -        raise ValueError("Multi-class hinge loss not supported")
> > -    pred_decision = np.ravel(pred_decision)
> > -
> > -    try:
> > -        margin = y_true * pred_decision
> > -    except TypeError:
> > -        raise TypeError("pred_decision should be an array of floats.")
> > +    y_true_unique = np.unique(y_true)
> > +    if np.size(y_true_unique) > 2:
> > +        if (labels is None and len(pred_decision.shape) > 1 and
>
> Please correct me if I am wrong. So your concern the calling of shape on
> pred_decision if it's not numpy array
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/scikit-learn/scikit-learn/pull/3607/files#r19481610>.
>



-- 
Godspeed,
Manoj Kumar,
Intern, Telecom ParisTech
Mech Undergrad
http://manojbits.wordpress.com