flennerhag / mlens

ML-Ensemble – high performance ensemble learning
http://ml-ensemble.com
MIT License
846 stars 108 forks source link

scoring function support #96

Closed 26345211 closed 6 years ago

26345211 commented 6 years ago

Does the scoring function support an extra vector as input ie A custom scoring function that takes (predicted_Y, true_Y, weight) which the weight is used to calculate the final float score

flennerhag commented 6 years ago

The scoring function does not support a third input. If this third input is fixed (say constant weights), you can wrap your scoring function:

def my_scorer(p, y):
    return original_scorer(p, y, w)

Note that you can also use this approach if the weights can be inferred from the labels:

def my_scorer(p, y):
    w = get_weights(y)
    return original_scorer(p, y, w)