/* * constructor to be used for non testing code. */ public FeedForwardNeuralNetwork(NNConfig config) { int numberOfInputNeurons = config .getParameterAsint(NUMBER_OF_INPUTS); int numberOfHiddenNeurons = config .getParameterAsint(NUMBER_OF_HIDDEN_NEURONS); int numberOfOutputNeurons = config .getParameterAsint(NUMBER_OF_OUTPUTS); double lowerLimitForWeights = config .getParameterAsDouble(LOWER_LIMIT_WEIGHTS); double upperLimitForWeights = config .getParameterAsDouble(UPPER_LIMIT_WEIGHTS); hiddenLayer = new Layer(numberOfHiddenNeurons, numberOfInputNeurons, lowerLimitForWeights, upperLimitForWeights, new LogSigActivationFunction()); outputLayer = new Layer(numberOfOutputNeurons, numberOfHiddenNeurons, lowerLimitForWeights, upperLimitForWeights, new PureLinearActivationFunction()); }
public void testDataSetPopulation() { DataSet irisDataSet = DataSetFactory.getIrisDataSet(); Numerizer numerizer = new IrisDataSetNumerizer(); NNDataSet innds = new IrisNNDataSet(); innds.createExamplesFromDataSet(irisDataSet, numerizer); NNConfig config = new NNConfig(); config.setConfig(FeedForwardNeuralNetwork.NUMBER_OF_INPUTS, 4); config.setConfig(FeedForwardNeuralNetwork.NUMBER_OF_OUTPUTS, 3); config.setConfig(FeedForwardNeuralNetwork.NUMBER_OF_HIDDEN_NEURONS, 6); config.setConfig(FeedForwardNeuralNetwork.LOWER_LIMIT_WEIGHTS, -2.0); config.setConfig(FeedForwardNeuralNetwork.UPPER_LIMIT_WEIGHTS, 2.0); FeedForwardNeuralNetwork ffnn = new FeedForwardNeuralNetwork(config); ffnn.setTrainingScheme(new BackPropLearning(0.1, 0.9)); ffnn.trainOn(innds, 10); innds.refreshDataset(); ffnn.testOnDataSet(innds); }