Package quickml.supervised.regressionModel.IsotonicRegression

Examples of quickml.supervised.regressionModel.IsotonicRegression.PoolAdjacentViolatorsModel


            PoolAdjacentViolatorsModel.Observation observation = new PoolAdjacentViolatorsModel.Observation
                    (csvReader.dataLists.get("target_cpc_customers").get(i), csvReader.dataLists.get("effective_cust_daily_spend").get(i));
            observations.add(observation);
        }

        PoolAdjacentViolatorsModel pav = new PoolAdjacentViolatorsModel(observations, 4);
        PoolAdjacentViolatorsModel.Observation prev = null;
     //   observations.sort(Comparator.<PoolAdjacentViolatorsModel.Observation>naturalOrder());
        for (PoolAdjacentViolatorsModel.Observation observation : observations) {

            PoolAdjacentViolatorsModel.Observation obsToAdd = new PoolAdjacentViolatorsModel.Observation(observation.input, pav.predict(observation.input));
            predictions.add(obsToAdd);

        if (prev !=null && prev.output < observation.output)
                System.out.println("prev out: " + prev.toString() + ". obs.input: " + obsToAdd.toString());
            prev = obsToAdd;
        }


        TreeSet<PoolAdjacentViolatorsModel.Observation> calibrationSet = pav.getCalibrationSet();
        TreeSet<PoolAdjacentViolatorsModel.Observation> preSmoothingSet = pav.getPreSmoothingSet();
        System.out.println("calibration set: " + calibrationSet.toString());
        LinePlotter linePlotter = new LinePlotterBuilder().chartTitle("pav trial").xAxisLabel("cpc").yAxisLabel("rate").buildLinePlotter();
        linePlotter.addSeries(calibrationSet, "unweigted linear interpolation");
        linePlotter.addSeries(predictions, "weighted linear interpolation");
        linePlotter.addSeries(preSmoothingSet, "binned observations with weight 4");
View Full Code Here


      List<PoolAdjacentViolatorsModel.Observation> observationList = Lists.newArrayList();
      observationList.add(new PoolAdjacentViolatorsModel.Observation(1, 1));
      observationList.add(new PoolAdjacentViolatorsModel.Observation(2, 0.5));
      observationList.add(new PoolAdjacentViolatorsModel.Observation(3, 2));

      PoolAdjacentViolatorsModel poolAdjacentViolatorsModel = new PoolAdjacentViolatorsModel(observationList);
      TreeSet<PoolAdjacentViolatorsModel.Observation> calibrationSet = poolAdjacentViolatorsModel.createCalibrationSet(observationList);
      Assert.assertTrue(calibrationSet.first().input == 1.5);
      Assert.assertTrue(calibrationSet.first().output == 0.75);

      Assert.assertTrue(calibrationSet.last().input == 3);
      Assert.assertTrue(calibrationSet.last().output == 2);
View Full Code Here

        List<PoolAdjacentViolatorsModel.Observation> observationList = Lists.newArrayList();
        observationList.add(new PoolAdjacentViolatorsModel.Observation(1, 1, 3));
        observationList.add(new PoolAdjacentViolatorsModel.Observation(2, 0.5, 1));
        observationList.add(new PoolAdjacentViolatorsModel.Observation(3, 2, 1));

        PoolAdjacentViolatorsModel poolAdjacentViolatorsModel = new PoolAdjacentViolatorsModel(observationList);
        TreeSet<PoolAdjacentViolatorsModel.Observation> calibrationSet = poolAdjacentViolatorsModel.createCalibrationSet(observationList);
        Assert.assertTrue(calibrationSet.first().input == 1.25);
        Assert.assertTrue(calibrationSet.first().output == 0.875);
        Assert.assertTrue(calibrationSet.first().weight == 4);

        Assert.assertTrue(calibrationSet.last().input == 3);
View Full Code Here

        if (wrappedPredictiveModel.isPresent()) {
            predictiveModel = wrappedPredictiveModel.get();
        } else {
            predictiveModel = wrappedPredictiveModelBuilder.buildPredictiveModel(trainingData);
        }
        PoolAdjacentViolatorsModel calibrator;
        calibrator = createCalibrator(trainingData);

        logger.info("calibration set: " + calibrator.getCalibrationSet().toString());
        return new CalibratedPredictiveModel(predictiveModel, calibrator);
    }
View Full Code Here

            Classifier predictiveModel = wrappedPredictiveModelBuilder.buildPredictiveModel(trainingInstances);
            List<PoolAdjacentViolatorsModel.Observation> foldObservations = getObservations(predictiveModel, calibrationInstances);
            storedObservations.addAll(foldObservations);
        }

        return new PoolAdjacentViolatorsModel(storedObservations, (int)Math.max(1, storedObservations.size() /(double) binsInCalibrator));
    }
View Full Code Here

TOP

Related Classes of quickml.supervised.regressionModel.IsotonicRegression.PoolAdjacentViolatorsModel

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.