Skip to content
Snippets Groups Projects

Replace sampler balancing by loss balancing

Merged Daniel CARRON requested to merge loss-balancing into main

This MR removes balancing of the training sampler and replaces it by loss balancing, if the loss function allows it (= contains a pos_weight parameter). Binary and exclusive, multi-class targets are supported. Using a database with multi-class, non-exclusive targets will raise a NotImplementedError for now.

Models now expect the class and arguments of the loss used instead of an instance, just like it is done with the optimizer. It is instantiated in trainer.py::run() and balanced if possible.

A base Model class has been created that other models should inherit from.

closes #6 (closed)

Edited by Daniel CARRON

Merge request reports

Merge request pipeline #86794 passed

Merge request pipeline passed for 236447ec

Test coverage 77.50% (-0.50%) from 4 jobs
Approval is optional

Merged by Daniel CARRONDaniel CARRON 10 months ago (May 3, 2024 8:30am UTC)

Merge details

Pipeline #86803 failed

Pipeline failed for 57048d9b on main

Test coverage 76.50% (-0.50%) from 4 jobs

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • André Anjos
  • André Anjos
  • André Anjos
  • André Anjos
  • @dcarron: thanks for this useful set of changes. I left some minor comments, but this looks great already.

  • Author Maintainer

    Thanks for the feedback, I'll simplify things and use a single loss.

  • added 1 commit

    • 6f04a219 - [model] Use a single type of loss for train and validation

    Compare with previous version

  • added 1 commit

    • 9aff0292 - [logging] Prevent PL from adding dataloader index to logged metrics

    Compare with previous version

  • André Anjos
  • @dcarron: thanks for this useful set of changes. I left some minor comments, but this looks great already.

  • added 1 commit

    • 918a86bf - [trainer] Hardcode name of loss to monitor

    Compare with previous version

  • @dcarron: thanks for the reaction - are we ready?

  • André Anjos requested review from @andre.anjos

    requested review from @andre.anjos

  • André Anjos approved this merge request

    approved this merge request

  • assigned to @dcarron

  • mentioned in issue #6 (closed)

  • Also, it would be interesting to rebase before the merge, I guess.

  • André Anjos resolved all threads

    resolved all threads

  • Daniel CARRON changed the description

    changed the description

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading