Created
September 11, 2016 19:13
-
-
Save claytantor/f1782e3dd93963c13357e4e781bdadae to your computer and use it in GitHub Desktop.
alt approach to training
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ----- Train the network, evaluating the test set performance at each epoch ----- | |
int nEpochs = 400; | |
for (int i = 0; i < nEpochs; i++) { | |
net.fit(trainData); | |
trainData.reset(); | |
} | |
//Evaluate on the test set: | |
List<String> labels = new ArrayList<>(); | |
List<Integer> keys = new ArrayList(classifiers.keySet()); | |
Collections.sort(keys); | |
for(Integer i:keys){ | |
labels.add(classifiers.get(i)); | |
} | |
Evaluation evaluation = net.evaluate(testData, labels); | |
String str = "Test set evaluation at epoch %d: Accuracy = %.2f, F1 = %.2f"; | |
log.info(String.format(str, nEpochs, evaluation.accuracy(), evaluation.f1())); | |
testData.reset(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment