Created regression_system and updated check_loss#71
Conversation
modified: malpolon/models/standard_prediction_systems.py modified: malpolon/models/utils.py
| return loss | ||
| raise ValueError(f"Loss must be of type nn.modules.loss. " | ||
| elif isinstance(loss, str): | ||
| return eval(loss) |
There was a problem hiding this comment.
We are aiming at removing all calls to eval() for security purposes. Please take a look at functions check_optimizer(), check_scheduler() or check_metrics(), on our new branch "no-more-evals" to get an understanding at what a similar check_loss() function should look like
| lr: float = 1e-2, | ||
| weight_decay: float = 0, | ||
| metrics: Optional[dict[str, Callable]] = None, | ||
| task: str = 'regression_multilabel', |
|
|
||
| class RegressionSystem(GenericPredictionSystem): | ||
| """Regression task class.""" | ||
| def __init__( |
There was a problem hiding this comment.
Some arguments (optimizer kwargs) are not used because incompatible with the proposed default optimizer. I suggest replacing them with the default optimizer's; or simply removing them.
Please update the docstring accordingly too
tlarcher
left a comment
There was a problem hiding this comment.
The RegressionSystem class might be redundant with #66 but as the later is scheduler to take more time to be fully completed, and considering this PR is a smaller I think I'll merge this one 1st.
Also, it raises the quesiton of updating check_loss() in a similar fashion as has been done with the other "check" functions, which is good.
modified: malpolon/models/standard_prediction_systems.py modified: malpolon/models/utils.py
modified: malpolon/models/utils.py
Merge changes from version 2.1.1
Stay up to date with upstream
Merging upstream changes
Updated loss check in RegressionSystem.__init__ to allow custom losses
📝 Changelog
In malpolon/models/standard_prediction_systems.py: Added a generic RegressionSystem
In malpolon/models/utils.py: