jonbarron / robust_loss_pytorch

A pytorch port of google-research/google-research/robust_loss/
Apache License 2.0
666 stars 88 forks source link

Matlab implementation of the adaptive version #27

Open federicoparra opened 3 years ago

federicoparra commented 3 years ago

Hi Jon, thank you for this amazing loss function! Any hopes for a Matlab implementation of the adaptive version? If you could get me started with the essential pseudocode, I could code it as a custom Deep Learning Toolbox custom layer and post it on Matlab FileExchange, so that Matlab coders using that framework would benefit just by replacing MSE regression layer for this custom layer.

Thank you! Federico

jonbarron commented 3 years ago

Hi Federico, thanks for the kind words! I have no plans to write a matlab implementation of this code, but I'm happy to help support any effort you might have to implement one. I'd recommend just porting the general version of the loss before the adaptive version, as it's much simpler. The implementation order I'd recommend is: general.py, distribution.py, AdaptiveLossFunction in adaptive.py, and then AdaptiveImageLossFunction in adaptive.py (which depends on wavelet.py), as this is how the dependency of the code is structured.

federicoparra commented 3 years ago

Thank you Jon! I would really like to do this (and might need to anyways, as my PhD dissertation code is in Matlab and I definitely want to use this loss function).

Just a note: I don't intend to use this with images, but rather just with regression problems with tabular data as features.

Would you still recommend the same (i.e., general.py, distribution.py, AdaptiveLossFunction in adaptive.py, and then AdaptiveImageLossFunction in adaptive.py) or it is simpler if no images are involved?

Thank you, Federico

jonbarron commented 3 years ago

Cool, if you don't care about images, then ignore AdaptiveImageLossFunction. If your output is always 1D, you could probably get away with an abridged version of AdaptiveLossFunction in which you just have a single alpha and scale instead of a whole vector of them.

caolei2000 commented 1 year ago

Thank you Jon! I would really like to do this (and might need to anyways, as my PhD dissertation code is in Matlab and I definitely want to use this loss function).

Just a note: I don't intend to use this with images, but rather just with regression problems with tabular data as features.

Would you still recommend the same (i.e., general.py, distribution.py, AdaptiveLossFunction in adaptive.py, and then AdaptiveImageLossFunction in adaptive.py) or it is simpler if no images are involved?

Thank you, Federico

Hello, have you implemented this matlab code yet?