Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How works the function EasyTrain.evaluateDataset() ? #3112

Open
MohamedLEGH opened this issue Apr 23, 2024 · 2 comments
Open

How works the function EasyTrain.evaluateDataset() ? #3112

MohamedLEGH opened this issue Apr 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@MohamedLEGH
Copy link

Description

When I run EasyTrain.fit(trainer, numEpochs, trainingSet, null); I get the metrics in the standard output like this:

Training:    100% |████████████████████████████████████████| Accuracy: 1,00, SigmoidBinaryCrossEntropyLoss: 121,25
Validating:  100% |████████████████████████████████████████|

But when I run EasyTrain.evaluateDataset(trainer, testSet);
nothing is printed on the standard output and the function returns void.
How can I check the results of the evaluation?

My code

TrainingConfig config = new DefaultTrainingConfig(loss)
    .optOptimizer(sgd) // Optimizer
    .optDevices(manager.getEngine().getDevices(0)) // CPU
    .addEvaluator(new Accuracy()) // Model Accuracy
    .addTrainingListeners(TrainingListener.Defaults.logging()); // Logging

Trainer trainer = model.newTrainer(config);

trainer.initialize(new Shape(batchSize, 57)); 
Metrics metrics = new Metrics();
trainer.setMetrics(metrics);

int numEpochs = 1;

EasyTrain.fit(trainer, numEpochs, trainingSet, null);
EasyTrain.evaluateDataset(trainer, testSet);
@MohamedLEGH MohamedLEGH added the bug Something isn't working label Apr 23, 2024
@zachgk
Copy link
Contributor

zachgk commented Apr 23, 2024

The evaluateDataset is automatically run during EasyTrain.fit() at the end of each epoch. It is designed to collect the metrics to see how the validation evaluation changes. You can view those results using trainer.getTrainingResult()

@MohamedLEGH
Copy link
Author

If the function is not used outside of EasyTrain.fit(), maybe the method should be private or protected ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants