/*
 * Encog(tm) Core v3.3 - Java Version
 * http://www.heatonresearch.com/encog/
 * https://github.com/encog/encog-java-core
 
 * Copyright 2008-2014 Heaton Research, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *   
 * For more information on Heaton Research copyrights, licenses 
 * and trademarks visit:
 * http://www.heatonresearch.com/copyright
 */

package org.encog.ensemble.training;

import org.encog.ensemble.EnsembleTrainFactory;
import org.encog.ml.MLMethod;
import org.encog.ml.data.MLDataSet;
import org.encog.ml.train.MLTrain;
import org.encog.neural.networks.BasicNetwork;
import org.encog.neural.networks.training.propagation.resilient.ResilientPropagation;

public class ResilientPropagationFactory implements EnsembleTrainFactory {

	private double dropoutRate = 0;
	
	@Override
	public MLTrain getTraining(MLMethod mlMethod, MLDataSet trainingData) {
		ResilientPropagation rp = new ResilientPropagation((BasicNetwork) mlMethod, trainingData);
		rp.setDroupoutRate(dropoutRate);
		return (MLTrain) rp;
	}

	@Override
	public String getLabel() {
		String l = "resprop";
		if(dropoutRate > 0)
		{
			l += "-" + dropoutRate;
		}
		return l;
	}

	@Override
	public void setDropoutRate(double rate) {
		dropoutRate = rate;
	}

}

@@ -1101,16 +1101,91 @@
 etwork;%0A
+import org.encog.neural.networks.training.propagation.resilient.RPROPType;%0A
 import o
@@ -1262,16 +1262,16 @@
 gation;%0A
-
 %0Apublic 
@@ -1372,16 +1372,41 @@
 te = 0;%0A
+%09private RPROPType type;%0A
 %09%0A%09@Over
@@ -1576,16 +1576,46 @@
 gData);%0A
+%09%09rp.setRPROPType(this.type);%0A
 %09%09rp.set
@@ -1858,16 +1858,16 @@
 rate) %7B%0A
-
 %09%09dropou
@@ -1884,10 +1884,132 @@
 te;%0A%09%7D%0A%0A
+%09public RPROPType getRPROPType() %7B%0A%09%09return type;%0A%09%7D%0A%0A%09public void setRPROPType(RPROPType type) %7B%0A%09%09this.type = type;%0A%09%7D%0A%0A
 %7D%0A

allow RPROP type to be specified