Examples of ArrayDoubleList


Examples of org.apache.commons.collections.primitives.ArrayDoubleList

      averageError /= data.size();
      res.averageError = averageError;

      if (data.isSplitedOnClasses())
      {
         DoubleList notGuessedPersentByClasses = new ArrayDoubleList();
         for (int i = 0; i < data.getOutputsCount(); ++i)
         {
            double error = (double) notGuessedClasses[i] / (double) data.calcCountOfItems(i);

            if (Double.isNaN(error))
            {
               error = 0;
            }

            notGuessedPersentByClasses.add(error);
         }

         res.totalNotGuessedClassesPercent = (double) totalNotGuessedClasses / (double) data.size();
         res.notGuessedClassesPercents = notGuessedPersentByClasses;
      }
View Full Code Here

Examples of org.apache.commons.collections.primitives.ArrayDoubleList

   public DoubleList resolveClusterCenter(int clusterNum)
   {
      Layer lastLayer = getNetwork().getLayers().getLast();
      Neuron clusterNeuron = lastLayer.getNeurons().get(clusterNum);

      DoubleList res = new ArrayDoubleList(clusterNeuron.getInputSynapses().size());
      for (Synapse s : clusterNeuron.getInputSynapses())
      {
         res.add(s.getWeight());
      }

      return res;
   }
View Full Code Here

Examples of org.apache.commons.collections.primitives.ArrayDoubleList

         Sample sample = trainingData.get(j);
         DoubleList x = sample.getInput();

         Row transformedRow = new Row(metadataOfTransformedData);

         DoubleList input = new ArrayDoubleList();
         double sumP = 0;
         for (int i = 0; i < c.size(); ++i)
         {
            double d = JNMFMathUtils.distance(x, c.get(i));
            p = Math.exp(-beta * d * d);
            input.add(p);

            sumP += p;
         }

         Row row = data.get(j);
         transformedRow.add(row.get(0));

         for (int i = 0; i < c.size(); ++i)
         {
            double u = input.get(i) / sumP;
            transformedRow.add(u);
         }

         for (ColumnInfo outputColumn : data.getMetadata().resolveColumns(VariableType.OUT))
         {
View Full Code Here

Examples of org.apache.commons.collections.primitives.ArrayDoubleList

      for (int i = 0; i < learningData.getOutputsCount(); ++i)
      {
         DoubleList center = JNMFMathUtils.center(inputsForClasses.get(i));

         List<DoubleList> inputsForClass = inputsForClasses.get(i);
         final DoubleList distances = new ArrayDoubleList();
         for (int j = 0; j < inputsForClass.size(); ++j)
         {
            double distance = JNMFMathUtils.distance(center, inputsForClass.get(j));

            distances.add(distance);
         }

         IFactory<IFunction> factory = new IFactory<IFunction>()
         {
            @Override
View Full Code Here

Examples of org.apache.commons.collections.primitives.ArrayDoubleList

         }
      }

      DoubleList center = JNMFMathUtils.center(vectorsOfClass);

      DoubleList distances = new ArrayDoubleList();
      for (int i = 0; i < vectorsOfClass.size(); ++i)
      {
         distances.add(JNMFMathUtils.distance(center, vectorsOfClass.get(i)));
      }

      double result = Math.sqrt(JNMFMathUtils.dispersion(distances));
      return result;
   }
View Full Code Here

Examples of org.apache.commons.collections.primitives.ArrayDoubleList

   {
      this.id = id;

      this.input = DoubleCollections.unmodifiableDoubleList(input);
      this.output = (output != null) ? DoubleCollections.unmodifiableDoubleList(output) :
              DoubleCollections.unmodifiableDoubleList(new ArrayDoubleList());
   }
View Full Code Here

Examples of org.apache.commons.collections.primitives.ArrayDoubleList

      return result;
   }

   public static DoubleList asList(double... vals)
   {
      DoubleList list = new ArrayDoubleList();
      for (int i = 0; i < vals.length; ++i)
      {
         list.add(vals[i]);
      }

      return list;
   }
View Full Code Here

Examples of org.apache.commons.collections.primitives.ArrayDoubleList

      return Math.sqrt(result);
   }

   public static DoubleList center(List<DoubleList> values)
   {
      DoubleList center = new ArrayDoubleList();

      final int componentsCount = values.get(0).size();
      for (int k = 0; k < componentsCount; ++k)
      {
         double sum = 0;
         for (int i = 0; i < values.size(); ++i)
         {
            sum += values.get(i).get(k);
         }

         center.add(sum / (double) values.size());
      }

      return center;
   }
View Full Code Here

Examples of org.apache.commons.collections.primitives.ArrayDoubleList

      return Math.round(d * c) / c;
   }

   public static DoubleList roundDoubleList(DoubleList list, int sign)
   {
      DoubleList result = new ArrayDoubleList(list.size());

      for (int i = 0; i < list.size(); ++i)
      {
         result.add(roundDouble(list.get(i), sign));
      }

      return result;
   }
View Full Code Here

Examples of org.apache.commons.collections.primitives.ArrayDoubleList

   public Sample createSample()
   {
      Comparable id = (Comparable) get(0);

      DoubleList input = new ArrayDoubleList();
      DoubleList output = new ArrayDoubleList();

      for (int i = 1; i < size(); ++i)
      {
         ColumnInfo columnInfo = metadata.getColumn(i);
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.