At text classification example#945
Conversation
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
l2 1e-6 > 1e-3 Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
l2 1e-3 > 1e-6 Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
…r1e-4 Signed-off-by: atuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: Andrii Tuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: Andrii Tuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: Andrii Tuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: Andrii Tuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: Andrii Tuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: Andrii Tuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: Andrii Tuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: Andrii Tuzhykov <andrewtuzhykov@gmail.com>
Signed-off-by: Andrii Tuzhykov <andrewtuzhykov@gmail.com>
AlexDBlack
left a comment
There was a problem hiding this comment.
Looking good, just a few minor improvements to make.
Can we also make a backup of the branch, then flatten + sign on this branch as described here: https://deeplearning4j.org/eclipse-contributors
Otherwise I'm happy with this 👍
| * As far model is predisposed to overfitting we also add l2 regularization and dropout for certain layers. | ||
| * To prepare reviews we use BertIterator, which is MultiDataSetIterator for training BERT (Transformer) models. | ||
| * We congigure BertIterator for supervised sequence classification: | ||
| * 0. As tokenizer we use BertWordPieceTokenizerFactory with provided BERT BASE UNCASED vocabulary. |
There was a problem hiding this comment.
Maybe let's improve this slightly, add another line under 0.:
BertIterator and BertWordPieceTokenizer implement the Word Piece sub-word tokenization algorithm, with a vocabulary size of 30522 tokens.
| int listenerFrequency = 20; | ||
| net.setListeners(new StatsListener(statsStorage, listenerFrequency), new ScoreIterationListener(50)); | ||
| //Attach the StatsStorage instance to the UI: this allows the contents of the StatsStorage to be visualized | ||
| uiServer.attach(statsStorage); |
There was a problem hiding this comment.
Maybe let's comment out the UI by default, as it adds some overhead (slows down training a bit). Users can uncomment it if they want to run it with UI. That would look like this:
/*
//Uncomment this section to run the example with the user interface
UIServer uiServer = UIServer.getInstance();
//Configure where the network information (gradients, activations, score vs. time etc) is to be stored
//Then add the StatsListener to collect this information from the network, as it trains
StatsStorage statsStorage = new FileStatsStorage(new File(System.getProperty("java.io.tmpdir"), "ui-stats-" + System.currentTimeMillis() + ".dl4j"));
int listenerFrequency = 20;
net.setListeners(new StatsListener(statsStorage, listenerFrequency), new ScoreIterationListener(50));
//Attach the StatsStorage instance to the UI: this allows the contents of the StatsStorage to be visualized
uiServer.attach(statsStorage);
*/
net.setListeners(new ScoreIterationListener(50));
| net.fit(train); | ||
|
|
||
| // Get and print accuracy, precision, recall & F1 and confusion matrix | ||
| Evaluation eval = net.doEvaluation(test, new Evaluation[]{new Evaluation()})[0]; |
There was a problem hiding this comment.
For MultiLayerNetwork, we can use net.evaluate(test)
pom.xml
Outdated
| <!-- Change the nd4j.backend property to nd4j-cuda-9.2-platform,nd4j-cuda-10.0-platform or nd4j-cuda-10.1-platform to use CUDA GPUs --> | ||
| <nd4j.backend>nd4j-native-platform</nd4j.backend> | ||
| <!-- <nd4j.backend>nd4j-cuda-10.2-platform</nd4j.backend>--> | ||
| <!-- <nd4j.backend>nd4j-cuda-10.0-platform</nd4j.backend>--> |
There was a problem hiding this comment.
Leave this commented out with 10.2
Signed-off-by: Andrii Tuzhykov <andrewtuzhykov@gmail.com>
…ation class Signed-off-by: Andrii Tuzhykov <andrewtuzhykov@gmail.com>
What changes were proposed in this pull request?
(Please fill in changes proposed in this fix)
How was this patch tested?
(Please explain how this patch was tested. E.g. unit tests, integration tests, manual tests)
Please review
https://github.com/eclipse/deeplearning4j/blob/master/CONTRIBUTING.md before opening a pull request.