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

Consider using per-class weights during training #23

Open
FrancescoCasalegno opened this issue Apr 19, 2022 · 0 comments
Open

Consider using per-class weights during training #23

FrancescoCasalegno opened this issue Apr 19, 2022 · 0 comments

Comments

@FrancescoCasalegno
Copy link
Contributor

Our classification problem is often unbalanced, with some classes having much more samples than other.

If we are interested in evaluating the problem in a way that each class gets equal weight (macro average) we could consider training the model using weights per class. In sklearn, this is achieved by passing an array sample_weight when calling

model.fit(X, y, sample_weight)

where the sample_weight that gives more weight to under-represented classes can be easily computed using sklearn's compute_sample_weight.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant