Consider using per-class weights during training

Open
#23 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python, scikit-learn

Research direction

Start by locating the training call that invokes model.fit(X, y, sample_weight) and read how labels and evaluation metrics are prepared. Review sklearn's compute_sample_weight documentation, then verify that the proposed weighting behavior is covered by the project's existing training or evaluation checks and improves macro-averaged evaluation as intended.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
12
Forks
6
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from BlueBrain/morphoclass

All issues in BlueBrain/morphoclass

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.