Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I reworked the metric-handling in the
train_model
function by changing the following:scikit-learn
. It now tracks the following:return_metrics
, which defaults toFalse
to preserve the old behaviour. If set toTrue
, the function returns the best model and all training and validation metrics as a tuple of typeTuple[torch.nn.Module, dict["train": dict[...], "val": dict[...]]]
.optimizer
argument that it has to be a SAM optimizer for classification settings. The standard optimizers like Adam don't havefirst_step
andsecond_step
functionality.best_acc
could have been an actual accuracy, an MSE, or some LRAP. This functionality has been replaced by a variable calledbest_lead_metric
that is inferred from the validation ACC, MSE, or LRAP.The new code is tested for a LectinOracle training (works) and should not tamper with the old behaviour, i. e., everything possible before, is still possible. Only the selection of the best model has changed to be
loss
-based and not lead-metric-based (best_acc
before).