fabianp / mord

Ordinal regression algorithms
Other
263 stars 71 forks source link

Add predict_proba #7

Closed njwhite closed 6 years ago

njwhite commented 6 years ago

Fixes #6

njwhite commented 6 years ago

@fabianp I've added sample weights to the threshold-based algorithms. Could you check the maths? I think the obj_margin is correct, but am not so sure about grad_margin. FWIW:

z = mord.LogisticAT(alpha=1.)
z.fit(X, y, sample_weight=np.arange(len(X)))
print('Mean Absolute Error of LogisticAT %s' %
      metrics.mean_absolute_error(z.predict(X), y))

Gives Mean Absolute Error of LogisticAT 0.6252230814991077, better than the unweighted fit of 0.6287923854848304!

fabianp commented 6 years ago

thanks! I'm sorry I don't have time to check the math, but I'm going to merge and if there are errors we can fix them later :-)