List of usage examples for org.deeplearning4j.nn.multilayer MultiLayerNetwork setLabels
public void setLabels(INDArray labels)
From source file:org.knime.ext.dl4j.base.nodes.learn.AbstractDLLearnerNodeModel.java
License:Open Source License
/** * Performs one epoch of finetuning of the specified {@link MultiLayerNetwork}. Checks {@link LearningMonitor} of * this learner if learning should be prematurely stopped. * * @param mln the network to train/*from ww w . ja va 2 s.co m*/ * @param data the data to train on * @param exec used to check for cancelled execution and stop learning * @throws CanceledExecutionException */ protected void finetuneOneEpoch(final MultiLayerNetwork mln, final DataSetIterator data, final ExecutionContext exec) throws CanceledExecutionException { exec.setMessage("Performing Finetuning"); while (data.hasNext()) { exec.checkCanceled(); if (m_learningMonitor.checkStopLearning()) { break; } final DataSet next = data.next(); if ((next.getFeatureMatrix() == null) || (next.getLabels() == null)) { break; } mln.setInput(next.getFeatureMatrix()); mln.setLabels(next.getLabels()); mln.finetune(); } }