Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weights per datapoint #41

Open
baggepinnen opened this issue Feb 6, 2020 · 2 comments
Open

Weights per datapoint #41

baggepinnen opened this issue Feb 6, 2020 · 2 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@baggepinnen
Copy link

baggepinnen commented Feb 6, 2020

Hey and thanks for this package!

Do you have any idea on how to incorporate different weights for each datapoints, in the sense that datapoints with low weights should be less important for the model to fit than those with high weights?

For instance, by specifying the loss as WeightedLogitLogLoss(weights) etc.'

LossFunction.jl has some support for this, e.g.

value(LogitLogLoss(), Y, Y, AggMode.WeightedSum(ones(length(Y))))
@xiaodaigh
Copy link
Owner

xiaodaigh commented Feb 6, 2020

Thanks for the question: I had a think about this and went through the code. Due to how the XGBoost algorithm works, weights are not inputable using the approach you mentioned. Rather, it needs a weight parameter to the jlboost function.

See discussion for increasing the weight for the gradient and hessian. And based on my understanding, this would be the approach too. dmlc/xgboost#144 (comment)

I will support weights soon once I am done with my other OS responsibilities.

For now, unfortunately, it's not possible unless you hack the code. In particular by adding weights to the g and h functions and by passing weights to where g and h are called

@xiaodaigh xiaodaigh added enhancement New feature or request question Further information is requested labels Feb 6, 2020
@baggepinnen
Copy link
Author

I took the approach you suggested in the DecisionTree package
https://github.com/bensadeghi/DecisionTree.jl/pull/113
it seems like it is working alright

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants