Package org.apache.commons.math3.stat.descriptive.summary

Examples of org.apache.commons.math3.stat.descriptive.summary.Sum.increment()


    private void testSampler(final double[][] covMatrix, int samples, double epsilon) {
        CorrelatedRandomVectorGenerator sampler = createSampler(covMatrix);
       
        StorelessCovariance cov = new StorelessCovariance(covMatrix.length);
        for (int i = 0; i < samples; ++i) {
            cov.increment(sampler.nextVector());
        }

        double[][] sampleCov = cov.getData();
        for (int r = 0; r < covMatrix.length; ++r) {
            TestUtils.assertEquals(covMatrix[r], sampleCov[r], epsilon);
View Full Code Here


                    start = sample.timestamp;
                }
                if (sample.timestamp + sample.duration > finish) {
                    finish = sample.timestamp + sample.duration;
                }
                mean.increment(sample.duration);
                stdDev.increment(sample.duration);
                skewness.increment(sample.duration);
            }
        }
       
View Full Code Here

          } else if (r < 0.30) {
            client.recommendToMany(new long[] { userID, userID }, 10, true, null);
            recommendToMany.increment(System.currentTimeMillis() - stepStart);
          } else {
            client.recommend(userID, 10);
            recommend.increment(System.currentTimeMillis() - stepStart);
          }
        } catch (TasteException te) {
          log.warn("Error during request", te);
        }
        if (count % 1000 == 0) {
View Full Code Here

        long userID = entry.getKey();
        long itemID = entry.getValue().getItemID();
        // Each of which was a "1" in the factor P matrix
        double value = SimpleVectorMath.dot(X.get(userID), Y.get(itemID));
        // So store abs(1-value), except, don't penalize for reconstructing > 1. Error is 0 in this case.
        averageError.increment(FastMath.max(0.0, 1.0 - value));
      }

      return new EvaluationResultImpl(averageError.getResult());
    } finally {
      recommender.close();
View Full Code Here

          RecommendedItem rec = recs.get(i);
          double value = LN2 / Math.log(2.0 + i); // 1 / log_2(1 + (i+1))
          if (valueIDs.contains(rec.getItemID())) {
            intersectionSize++;
            score += value;
            precisionAtI.increment(1.0);
            averagePrecision += precisionAtI.getResult();           
          } else {
            precisionAtI.increment(0.0);
          }
          maxScore += value;
View Full Code Here

            intersectionSize++;
            score += value;
            precisionAtI.increment(1.0);
            averagePrecision += precisionAtI.getResult();           
          } else {
            precisionAtI.increment(0.0);
          }
          maxScore += value;
        }
        averagePrecision /= numValues;
 
View Full Code Here

               ndcg,
               100 * percentTopRecsConsidered);

      avgPercentTopRecsConsidered.increment(percentTopRecsConsidered);
      avgNDCG.increment(ndcg);
      avgPercentAllItemsConsidered.increment(percentAllItemsConsidered);
    }

    log.info("{}", avgPercentTopRecsConsidered.getResult());
    log.info("{}", avgNDCG.getResult());
    log.info("{}", avgPercentAllItemsConsidered.getResult());
View Full Code Here

    public void testMomentSmallSamples() {
        UnivariateStatistic stat = getUnivariateStatistic();
        if (stat instanceof SecondMoment) {
            SecondMoment moment = (SecondMoment) getUnivariateStatistic();
            Assert.assertTrue(Double.isNaN(moment.getResult()));
            moment.increment(1d);
            Assert.assertEquals(0d, moment.getResult(), 0);
        }
    }

    /**
 
View Full Code Here

    public void testMomentSmallSamples() {
        UnivariateStatistic stat = getUnivariateStatistic();
        if (stat instanceof SecondMoment) {
            SecondMoment moment = (SecondMoment) getUnivariateStatistic();
            Assert.assertTrue(Double.isNaN(moment.getResult()));
            moment.increment(1d);
            Assert.assertEquals(0d, moment.getResult(), 0);
        }
    }

    /**
 
View Full Code Here

        final SumOfLogs sumLog = new SumOfLogs();
       
        final Random r = new Random(0);
        for (int i = 0; i < 10; i++) {
            final int nextInt = r.nextInt(100000000);
            secondMoment.increment(nextInt);
            sum.increment(nextInt);
            sumsq.increment(nextInt);
            min.increment(nextInt);
            max.increment(nextInt);
            sumLog.increment(nextInt);
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.