Package com.greentea.relaxation.jnmf.util.data

Examples of com.greentea.relaxation.jnmf.util.data.TrainingDataset


//      return data;
//   }

   public static TrainingDataset generateLearningData(double shift1, double shift2)
   {
      TrainingDataset data = new TrainingDataset(2, 2);
      Random rand = new Random();

      double d = 0.001;
      int count = 60;
      for (int i = 0; i < count; ++i)
      {
         double x1 = 5 + shift1 + rand.nextDouble();
         double y1 = 5 + rand.nextDouble();

         Sample v1 = new Sample(null, DataUtils.asList(x1, y1), DataUtils.asList(0, 1));

         double x2 = 5 + shift2 + rand.nextDouble();
         double y2 = 5 + rand.nextDouble();
         Sample v2 = new Sample(null, DataUtils.asList(x2, y2), DataUtils.asList(1, 0));

         data.add(v1);
         data.add(v2);
      }

      //data = DataUtils.normalize(data, VectorType.IN, -1, 1);
      return data;
   }
View Full Code Here


      //System.out.println(algorithm.feedforwardStep(DataUtils.asList(15, 29)));
   }

   TrainingDataset createLearningData()
   {
      TrainingDataset data = new TrainingDataset(2, 0);

      for (int i = 0; i < 100; ++i)
      {
         data.add(new Sample(null,
                 DataUtils.asList(RandomUtils.nextInt(30), RandomUtils.nextInt(30)), null));
      }

//      data.add(new Sample(DataUtils.asList(10, 10), null));
//      data.add(new Sample(DataUtils.asList(20, 18), null));
View Full Code Here

   }

   @Override
   protected void buildInternal()
   {
      TrainingDataset data = getLearningData();

      builder.setActivationFuncitonFactory(new IFactory<IFunction>()
      {
         public IFunction create()
         {
            return new VarSigmoidFunction();
         }
      });
      for (int i = 0; i < data.getInputsCount(); ++i)
      {
         builder.addDataInputSynapseGenerative(i, 1, i);
      }

      for (int i = 0; i < data.getInputsCount(); ++i)
      {
         for (int j = 0; j < data.getOutputsCount(); ++j)
         {
            builder.addSynapseGenerative(0, i, 1, 1, j);
         }
      }
View Full Code Here

   }

   @Override
   protected void buildInternal()
   {
      TrainingDataset data = getLearningData();

      builder.setActivationFuncitonFactory(new IFactory<IFunction>()
      {
         public IFunction create()
         {
            return new VarSigmoidFunction();
         }
      });
      for (int i = 0; i < data.getInputsCount(); ++i)
      {
         builder.addDataInputSynapseGenerative(i, 1, i);
      }

      int currentLayerIndex = 0;
      if (hidenLayersCount > 0)
      {
         for (int i = 0; i < data.getInputsCount(); ++i)
         {
            for (int j = 0; j < neuronsInEachHidenLayer; ++j)
            {
               builder.addSynapseGenerative(currentLayerIndex, i, nextRandomSynapseWeight(),
                       currentLayerIndex + 1, j);
            }
         }
      }

      for (int k = 0; k < hidenLayersCount - 1; ++k)
      {
         currentLayerIndex++;
         for (int i = 0; i < neuronsInEachHidenLayer; ++i)
         {
            for (int j = 0; j < neuronsInEachHidenLayer; ++j)
            {
               builder.addSynapseGenerative(currentLayerIndex, i, nextRandomSynapseWeight(),
                       currentLayerIndex + 1, j);
            }
         }
      }

      if (hidenLayersCount > 0)
      {
         currentLayerIndex++;
      }

      int neuronsInCurrentLayer =
              builder.getNetwork().getLayers().get(currentLayerIndex).getNeurons().size();

      for (int i = 0; i < neuronsInCurrentLayer; ++i)
      {
         for (int j = 0; j < data.getOutputsCount(); ++j)
         {
            builder.addSynapseGenerative(currentLayerIndex, i, nextRandomSynapseWeight(),
                    currentLayerIndex + 1, j);
         }
      }
View Full Code Here

      imagePanel = new ImagePanel();
   }

   public void onStartLearning(LearningAlgorithm learningAlgorithm)
   {
      TrainingDataset learningData = learningAlgorithm.getLearningData();
      if (learningData.getInputsCount() == 2 &&
              (learningData.getOutputsCount() == 1 || learningData.getOutputsCount() == 2))
      {
         enableVisualization();

         this.learningAlgorithm = learningAlgorithm;
//         learningAlgorithm.getNotGuessedLearningDataPercentListeners().add(
View Full Code Here

      this.forecastPerformer = forecastPerformer;
      this.allData = allData;
      this.learningData = learningData;
      this.testData = testData;

      TrainingDataset data = null;
      switch (useData)
      {
         case AllData:
         {
            data = allData;
            break;
         }
         case LearningData:
         {
            data = learningData;
            break;
         }
         case TestData:
         {
            data = testData;
            break;
         }
      }

      clearAllDiagramsAndTables();

      if (data.isSplitedOnClasses())
      {
         forecastPerformer.setLearningEnabled(false);
        
         analyze(forecastPerformer, data);
View Full Code Here

         testData = testLearningAndAllData.get(0);
         learningData = testLearningAndAllData.get(1);
         allData = testLearningAndAllData.get(2);

         TrainingDataset trainingTestData = testData.createTrainingDataset();
         TrainingDataset trainingLearningData = learningData.createTrainingDataset();
         TrainingDataset trainingAllData = allData.createTrainingDataset();

         prepareLearningComponent(trainingLearningData, trainingTestData);

         prepareQualityControlComponent(trainingAllData, trainingLearningData, trainingTestData);
View Full Code Here

TOP

Related Classes of com.greentea.relaxation.jnmf.util.data.TrainingDataset

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.