Package org.neuroph.core.learning

Examples of org.neuroph.core.learning.TrainingSet


         * @param rgbDataMap map collection of rgb data
         * @return binary black and white training set for the specified image data
         */
        public static TrainingSet createBlackAndWhiteTrainingSet(List<String> imageLabels, Map<String, FractionRgbData> rgbDataMap) throws VectorSizeMismatchException
  {
    TrainingSet trainingSet = new TrainingSet();

    for (Entry<String, FractionRgbData> entry : rgbDataMap.entrySet()) {
      double[] inputRGB = entry.getValue().getFlattenedRgbValues();
                        double[] inputBW = FractionRgbData.convertRgbInputToBinaryBlackAndWhite(inputRGB);
                        double[] response = createResponse(entry.getKey(), imageLabels);
      trainingSet.addElement(new SupervisedTrainingElement(
          VectorParser.convertToVector(inputBW),
          VectorParser.convertToVector(response)));
    }

            return trainingSet;
View Full Code Here


        }

        public void trainNet(){
            double traininput [] = new double [9];
            double trainoutput [] = new double[1];
            TrainingSet trainingSet = new TrainingSet();
            input = new File("C:/Users/Ishuah  K/NeuralTicTacToe/src/neuraltictactoe/trainingset/tictactoedata.tttd");

            try {
            r = new Scanner(input);

            System.out.println("File ok.(1)complete");
        } catch (FileNotFoundException ex) {
            JOptionPane.showMessageDialog(null, "Error reading file:"+ex);
        }
      
      
        while(r.hasNext()){
      
            System.out.println("one");
        int ind = 1;
        int index = 0;
        for( ind = 1; ind<10; ind++){
        traininput [index] = r.nextInt();
        System.out.print(traininput[index]+" ");
        index++;
        }
        trainoutput [0] = r.nextDouble();
        System.out.println(trainoutput[0]);
        trainingSet.addElement(new SupervisedTrainingElement(traininput, trainoutput));
       
        }
        if(point >= prevpoint){
            myNeuralNetwork.learnInSameThread(trainingSet);
        }else{
View Full Code Here

TOP

Related Classes of org.neuroph.core.learning.TrainingSet

Copyright © 2018 www.massapicom. 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.