Skip to content

How to change evaluation interval #1067

Answered by ottonemo
AhmedThahir asked this question in Q&A
Discussion options

You must be logged in to vote

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:

def my_val_score(net, X, y):
    if len(net.history) % 5 != 0:
        return np.nan
    return net.get_loss(net.forward(X, device=net.device, training=False), y, X=X).item()

net = skorch.NeuralNetClassifier(
    mymod,
    callbacks__valid_loss=skorch.callbacks.EpochScoring(my_val_score, name='valid_loss'),
)

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@AhmedThahir
Comment options

@ottonemo
Comment options

Answer selected by AhmedThahir
@AhmedThahir
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants