本文整理汇总了Java中org.neuroph.nnet.learning.MomentumBackpropagation.setLearningRate方法的典型用法代码示例。如果您正苦于以下问题:Java MomentumBackpropagation.setLearningRate方法的具体用法?Java MomentumBackpropagation.setLearningRate怎么用?Java MomentumBackpropagation.setLearningRate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.neuroph.nnet.learning.MomentumBackpropagation
的用法示例。
在下文中一共展示了MomentumBackpropagation.setLearningRate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doRun
import org.neuroph.nnet.learning.MomentumBackpropagation; //导入方法依赖的package包/类
@Override
public void doRun() {
try {
System.out.println("Starting training thread....." + sampleDimension.toString() + " and " + imageLabels.toString());
HashMap<String, BufferedImage> imagesMap = new HashMap<String, BufferedImage>();
for (File file : srcDirectory.listFiles()) {
imageLabels.add(FilenameUtils.removeExtension(file.getName()));
if (sampleDimension.getWidth() > 0 && sampleDimension.getHeight() > 0) {
Double w = sampleDimension.getWidth();
Double h = sampleDimension.getHeight();
imagesMap.put(file.getName(), ImageUtilities.resizeImage(ImageUtilities.loadImage(file), w.intValue(), h.intValue()));
}
}
Map<String, FractionRgbData> imageRgbData = ImageUtilities.getFractionRgbDataForImages(imagesMap);
DataSet learningData = ImageRecognitionHelper.createRGBTrainingSet(imageLabels, imageRgbData);
nnet = NeuralNetwork.load(new FileInputStream(nnFile)); //Load NNetwork
MomentumBackpropagation mBackpropagation = (MomentumBackpropagation) nnet.getLearningRule();
mBackpropagation.setLearningRate(learningRate);
mBackpropagation.setMaxError(maxError);
mBackpropagation.setMomentum(momentum);
System.out.println("Network Information\nLabel = " + nnet.getLabel()
+ "\n Input Neurons = " + nnet.getInputsCount()
+ "\n Number of layers = " + nnet.getLayersCount()
);
mBackpropagation.addListener(this);
System.out.println("Starting training......");
nnet.learn(learningData, mBackpropagation);
//Training Completed
listener.batchImageTrainingCompleted();
} catch (FileNotFoundException ex) {
System.out.println(ex.getMessage() + "\n" + ex.getLocalizedMessage());
}
}
示例2: learnNeuralNet
import org.neuroph.nnet.learning.MomentumBackpropagation; //导入方法依赖的package包/类
private static void learnNeuralNet(DataSet trainingSet, DataSet testSet) {
TestSetEvaluator testEvaluator = new TestSetEvaluator(NNET_NAME, testSet, trainingSet);
MultiLayerPerceptron nnet = new MultiLayerPerceptron(TransferFunctionType.SIGMOID, INPUT_LAYER, 86, 86, OUTPUT_LAYER);
MomentumBackpropagation bp = new MomentumBackpropagation();
bp.setLearningRate(LEARINING_RATE);
bp.setMomentum(MOMENTUM);
bp.addListener(testEvaluator);
nnet.setLearningRule(bp);
nnet.learn(trainingSet);
nnet.save(NNET_NAME + "last");
}
示例3: learnNeuralNet
import org.neuroph.nnet.learning.MomentumBackpropagation; //导入方法依赖的package包/类
private static void learnNeuralNet(DataSet trainingSet, DataSet testSet) {
TestSetEvaluator testEvaluator = new TestSetEvaluator(NNET_NAME, testSet, trainingSet);
MultiLayerPerceptron nnet = new MultiLayerPerceptron(TransferFunctionType.SIGMOID, INPUT_LAYER, 140, OUTPUT_LAYER);
MomentumBackpropagation bp = new MomentumBackpropagation();
bp.setLearningRate(LEARINING_RATE);
bp.setMomentum(MOMENTUM);
bp.addListener(testEvaluator);
nnet.setLearningRule(bp);
nnet.learn(trainingSet);
nnet.save(NNET_NAME + "last");
}
示例4: learnNeuralNet
import org.neuroph.nnet.learning.MomentumBackpropagation; //导入方法依赖的package包/类
private static void learnNeuralNet(DataSet trainingSet, DataSet testSet) {
TestSetEvaluator testEvaluator = new TestSetEvaluator(NNET_NAME, testSet, trainingSet);
MultiLayerPerceptron nnet = new MultiLayerPerceptron(TransferFunctionType.SIGMOID, INPUT_LAYER, 76, 76, OUTPUT_LAYER);
MomentumBackpropagation bp = new MomentumBackpropagation();
bp.setLearningRate(LEARINING_RATE);
bp.setMomentum(MOMENTUM);
bp.addListener(testEvaluator);
nnet.setLearningRule(bp);
nnet.learn(trainingSet);
nnet.save(NNET_NAME + "last");
}