BlueBrain / BlueBrain/morphoclass

Consider using per-class weights during training

Open
#23 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
12
Forks
6
PR merge metrics
No merged PRs in 30d

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
```python
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`](https://scikit-learn.org/stable/modules/generated/sklearn.utils.class_weight.compute_sample_weight.html).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.