ctlearn-project / ctlearn

Deep Learning for IACT Event Reconstruction
BSD 3-Clause "New" or "Revised" License
52 stars 43 forks source link

Enable the usage of the focal loss function #144

Open nietootein opened 2 years ago

nietootein commented 2 years ago

Focal loss may be useful to our classification use case, where there is a significant imbalance between classes. We should try to implement it as a selectable loss function and benchmark its impact on classification.

TjarkMiener commented 4 months ago

I just came across this lately. In the keras loss API, this focal loss is available under CategoricalFocalCrossentropy. Also for the regression tasks we might want to explore different loss functions. I think quite promising is the LogCosh. That one is more robust to outliers than mean absolute error, which might be very helpful during training. I guess our outliers are proton-like (diffuse) gammas which we later discard anyway for the (high-level) analysis. So we probably want our loss function to ignore those predictions which should disturb the learning. Just food for thoughts but we should move back to allow the user to pass different keras built-in loss functions and run some experiments.