Examples of Perceptron


Examples of aima.core.learning.neural.Perceptron

      Numerizer numerizer = new IrisDataSetNumerizer();
      NNDataSet innds = new IrisNNDataSet();

      innds.createExamplesFromDataSet(irisDataSet, numerizer);

      Perceptron perc = new Perceptron(3, 4);

      perc.trainOn(innds, 10);

      innds.refreshDataset();
      int[] result = perc.testOnDataSet(innds);
      System.out.println(result[0] + " right, " + result[1] + " wrong");
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of aima.core.learning.neural.Perceptron

    Numerizer numerizer = new IrisDataSetNumerizer();
    NNDataSet innds = new IrisNNDataSet();

    innds.createExamplesFromDataSet(irisDataSet, numerizer);

    Perceptron perc = new Perceptron(3, 4);

    perc.trainOn(innds, 10);

    innds.refreshDataset();
    perc.testOnDataSet(innds);
  }
View Full Code Here

Examples of classification.Perceptron

  }

  public static LinearClassifier trainPerceptron(boolean doAveraging,
      int numIters, ArrayList<ClassificationInstance> train, Alphabet xA,
      Alphabet yA) {
    Perceptron p = new Perceptron(doAveraging, numIters, xA, yA,
        new CompleteFeatureFunction(xA, yA));
    LinearClassifier h = p.batchTrain(train);
    return h;
  }
View Full Code Here

Examples of classification.Perceptron

  }

  public static LinearClassifier trainPerceptron(boolean doAveraging,
      int numIters, ArrayList<ClassificationInstance> train, Alphabet xA,
      Alphabet yA) {
    Perceptron p = new Perceptron(doAveraging, numIters, xA, yA,
        new CompleteFeatureFunction(xA, yA));
    LinearClassifier h = p.batchTrain(train);
    return h;
  }
View Full Code Here

Examples of org.neuroph.nnet.Perceptron

            trainingSet.addElement(new SupervisedTrainingElement(new double[]{0, 1}, new double[]{0}));
            trainingSet.addElement(new SupervisedTrainingElement(new double[]{1, 0}, new double[]{0}));
            trainingSet.addElement(new SupervisedTrainingElement(new double[]{1, 1}, new double[]{1}));

            // create perceptron neural network
            NeuralNetwork myPerceptron = new Perceptron(2, 1);
            // learn the training set
            myPerceptron.learnInSameThread(trainingSet);
            // test perceptron
            System.out.println("Testing trained perceptron");
            testNeuralNetwork(myPerceptron, trainingSet);
            // save trained perceptron
            myPerceptron.save("mySamplePerceptron.nnet");
            // load saved neural network
            NeuralNetwork loadedPerceptron = NeuralNetwork.load("mySamplePerceptron.nnet");
            // test loaded neural network
            System.out.println("Testing loaded perceptron");
            testNeuralNetwork(loadedPerceptron, trainingSet);
View Full Code Here

Examples of org.neuroph.nnet.Perceptron

         * @param outputNeuronsCount number of neurons in output layer
         * @param transferFunctionType type of transfer function to use
   * @return instance of Perceptron network
   */ 
  public static Perceptron createPerceptron(int inputNeuronsCount, int outputNeuronsCount, TransferFunctionType transferFunctionType) {
    Perceptron nnet = new Perceptron(inputNeuronsCount, outputNeuronsCount, transferFunctionType);
    return nnet;
  }
View Full Code Here

Examples of org.neuroph.nnet.Perceptron

         * @param transferFunctionType type of transfer function to use
         * @param learningRule learning rule class
   * @return instance of Perceptron network
   */
  public static Perceptron createPerceptron(int inputNeuronsCount, int outputNeuronsCount, TransferFunctionType transferFunctionType, Class learningRule) {
    Perceptron nnet = new Perceptron(inputNeuronsCount, outputNeuronsCount, transferFunctionType);

                if (learningRule.getName().equals(PerceptronLearning.class.getName()))  {
                    nnet.setLearningRule(new PerceptronLearning());
                } else if (learningRule.getName().equals(BinaryDeltaRule.class.getName())) {
                    nnet.setLearningRule(new BinaryDeltaRule());
                }

    return nnet;
  }
View Full Code Here

Examples of sequence.Perceptron

  }

  public static LinearTagger trainPerceptron(boolean doAveraging,
      int numIters, ArrayList<SequenceInstance> train, Alphabet xA,
      Alphabet yA) {
    Perceptron p = new Perceptron(doAveraging, numIters, xA, yA,
        new OneYwithXFeatureFunction(xA, yA));
    LinearTagger h = p.batchTrain(train);
    return h;
  }
View Full Code Here

Examples of sequence.Perceptron

  @SuppressWarnings("unused")
  private LinearTagger trainPerceptron(ArrayList<SequenceInstance> data,
      Alphabet xA, Alphabet yA, int numIters, boolean doAveraging) {

    Perceptron perceptron = new Perceptron(doAveraging, numIters, xA, yA,
        new OneYwithXFeatureFunction(xA, yA));
    return perceptron.batchTrain(data);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.