Skip to content

New projects default to train.loss_weight_exp: 1.0, silently overriding the documented default of 0.25 #181

Open

Description

@DMZ0

Summary

Every project created by initialize_project() gets train.loss_weight_exp: 1.0, which silently overrides the framework default of 0.25. Because of Hydra composition order, the project template always wins, so in practice no project ever trains with 0.25 unless the user edits project_config.yaml by hand or passes a command-line override.

Where

  • deepethogram/conf/train.yaml:55 → loss_weight_exp: 0.25
  • deepethogram/conf/project/project_config_default.yaml:46 → loss_weight_exp: 1.0

configuration.make_config() documents the composition order as:

1. Defaults
2. Preset
3. Project configuration
4. Command line

The project configuration is composed after the defaults, so 1.0 overrides 0.25 for every project.

Why it looks unintended

deepethogram/conf/tune/feature_extractor.yaml sweeps this parameter over [0.0, 1.0] with current_best: 0.25, which suggests 0.25 is the intended value.

Effect

data/utils.make_loss_weight() computes, per class:

pos_weight = (num_neg / num_pos) ** weight_exp

The exponent interpolates between no correction (0) and full inverse-frequency weighting (1). For a behavior at 1% prevalence:

loss_weight_exp pos_weight
0.25 (documented default) 3.2
1.0 (actual default) 99.0

That is a ~30x difference in how strongly rare-class positives are upweighted in BCEWithLogitsLoss, which is a substantial and silent change in training behavior for anyone with rare behaviors.

Suggested fix

Change deepethogram/conf/project/project_config_default.yaml to loss_weight_exp: 0.25 so the template matches the framework default. (Existing projects keep whatever is already written into their project_config.yaml.)

Version

master @ 1541eec (v0.4.0)

Activity

  1. DMZ0 commented on Sep 17, 2026

    @DMZ0
    Author

    @jbohnslav Can you confirm that you still generally recommend using 0.25 (rather than 1.0) as a default value for loss_weight_exp, as per the methods section of your paper?

    We empirically found that with rare behaviors 𝛽 =1 drastically increased the levels of false positives, while with 𝛽 =0 many false negatives occurred. For all datasets, we set 𝛽 =0.25.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions