Repository navigation
How to change evaluation interval #1067
Answered
by
ottonemo
AhmedThahir
asked this question in
Q&A
|
I would like to perform evaluation of metrics in train and validation set only every Rather than changing the callback, is there an easier way to change this behavior? I am looking for something like this: |
Answered by
ottonemo
Oct 18, 2024
Replies: 1 comment 3 replies
|
I think this can be easily achieved using a custom scoring callback that invokes the scoring you want or returns Example: import numpy as np
from sklearn.mertrics import accuracy_score
import skorch
def my_score(net, X, y):
if len(net.history) % 10 != 0:
return np.nan
return accuracy_score(y, net.predict(X))
net = skorch.NeuralNetClassifier(
mymod,
callbacks=[
EpochScoring(my_score),
],
)Does this help? |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No, I assumed (wrongly, as it seems), that you have an additional score that is costly and you want to reduce cost here.
In that case, no, you'd have to overwrite the callback: