/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package neurondemo;

import org.neuroph.core.NeuralNetwork;
import org.neuroph.core.data.DataSet;
import org.neuroph.nnet.Perceptron;

/**
 *
 * @author student1
 */
public class PerceptronDemo {

    public static void main(String[] args) {
        
        DataSet dataSet = new DataSet(2, 1);
        dataSet.addRow(new double[] {0, 0}, new double[] {0});
        dataSet.addRow(new double[] {0, 1}, new double[] {1});
        dataSet.addRow(new double[] {1, 0}, new double[] {1});
        dataSet.addRow(new double[] {1, 1}, new double[] {1});
        
        NeuralNetwork perceptron = new Perceptron(2, 1);
        perceptron.learn(dataSet);
        
        perceptron.setInput(1, 1);
        perceptron.calculate();
        double[] out = perceptron.getOutput();
        
        System.out.println("Out: "+out[0]);
        
        
    }
    
}
