Search in sources :

Example 6 with RegDataSet

use of edu.neu.ccs.pyramid.dataset.RegDataSet in project pyramid by cheng-li.

the class RegressionSynthesizer method univarStepFeatureNoise.

public RegDataSet univarStepFeatureNoise() {
    NormalDistribution featureNoise = new NormalDistribution(0, 0.1);
    RegDataSet dataSet = RegDataSetBuilder.getBuilder().numDataPoints(numDataPoints).numFeatures(1).dense(true).missingValue(false).build();
    for (int i = 0; i < numDataPoints; i++) {
        double featureValue = Sampling.doubleUniform(0, 1);
        double label;
        if (featureValue > 0.5) {
            label = 0.7;
        } else {
            label = 0.2;
        }
        label += noise.sample();
        featureValue += featureNoise.sample();
        dataSet.setFeatureValue(i, 0, featureValue);
        dataSet.setLabel(i, label);
    }
    return dataSet;
}
Also used : NormalDistribution(org.apache.commons.math3.distribution.NormalDistribution) RegDataSet(edu.neu.ccs.pyramid.dataset.RegDataSet)

Example 7 with RegDataSet

use of edu.neu.ccs.pyramid.dataset.RegDataSet in project pyramid by cheng-li.

the class RegressionSynthesizer method univarExp.

public RegDataSet univarExp() {
    RegDataSet dataSet = RegDataSetBuilder.getBuilder().numDataPoints(numDataPoints).numFeatures(1).dense(true).missingValue(false).build();
    for (int i = 0; i < numDataPoints; i++) {
        double featureValue = Sampling.doubleUniform(0, 1);
        double label;
        label = Math.exp(featureValue);
        label += noise.sample();
        dataSet.setFeatureValue(i, 0, featureValue);
        dataSet.setLabel(i, label);
    }
    return dataSet;
}
Also used : RegDataSet(edu.neu.ccs.pyramid.dataset.RegDataSet)

Example 8 with RegDataSet

use of edu.neu.ccs.pyramid.dataset.RegDataSet in project pyramid by cheng-li.

the class RegressionSynthesizer method univarQuadratic.

public RegDataSet univarQuadratic() {
    RegDataSet dataSet = RegDataSetBuilder.getBuilder().numDataPoints(numDataPoints).numFeatures(1).dense(true).missingValue(false).build();
    for (int i = 0; i < numDataPoints; i++) {
        double featureValue = Sampling.doubleUniform(0, 1);
        double label;
        label = Math.pow(featureValue, 2);
        label += noise.sample();
        dataSet.setFeatureValue(i, 0, featureValue);
        dataSet.setLabel(i, label);
    }
    return dataSet;
}
Also used : RegDataSet(edu.neu.ccs.pyramid.dataset.RegDataSet)

Example 9 with RegDataSet

use of edu.neu.ccs.pyramid.dataset.RegDataSet in project pyramid by cheng-li.

the class RegressionSynthesizer method univarPiecewiseLinear.

public RegDataSet univarPiecewiseLinear() {
    RegDataSet dataSet = RegDataSetBuilder.getBuilder().numDataPoints(numDataPoints).numFeatures(1).dense(true).missingValue(false).build();
    for (int i = 0; i < numDataPoints; i++) {
        double featureValue = Sampling.doubleUniform(0, 1);
        double label;
        if (featureValue <= 0.5) {
            label = -featureValue + 0.5;
        } else {
            label = featureValue;
        }
        label += noise.sample();
        dataSet.setFeatureValue(i, 0, featureValue);
        dataSet.setLabel(i, label);
    }
    return dataSet;
}
Also used : RegDataSet(edu.neu.ccs.pyramid.dataset.RegDataSet)

Example 10 with RegDataSet

use of edu.neu.ccs.pyramid.dataset.RegDataSet in project pyramid by cheng-li.

the class RegressionSynthesizer method gaussianMixture.

public RegDataSet gaussianMixture() {
    NormalDistribution leftGaussian = new NormalDistribution(0.2, 0.01);
    NormalDistribution rightGaussian = new NormalDistribution(0.7, 0.1);
    RegDataSet dataSet = RegDataSetBuilder.getBuilder().numDataPoints(numDataPoints).numFeatures(1).dense(true).missingValue(false).build();
    for (int i = 0; i < numDataPoints; i++) {
        double featureValue = Sampling.doubleUniform(0, 1);
        double label;
        if (featureValue > 0.5) {
            label = leftGaussian.sample();
        } else {
            label = rightGaussian.sample();
        }
        dataSet.setFeatureValue(i, 0, featureValue);
        dataSet.setLabel(i, label);
    }
    return dataSet;
}
Also used : NormalDistribution(org.apache.commons.math3.distribution.NormalDistribution) RegDataSet(edu.neu.ccs.pyramid.dataset.RegDataSet)

Aggregations

RegDataSet (edu.neu.ccs.pyramid.dataset.RegDataSet)21 File (java.io.File)9 DataSetType (edu.neu.ccs.pyramid.dataset.DataSetType)4 RegTreeConfig (edu.neu.ccs.pyramid.regression.regression_tree.RegTreeConfig)3 NormalDistribution (org.apache.commons.math3.distribution.NormalDistribution)3 Vector (org.apache.mahout.math.Vector)3 Config (edu.neu.ccs.pyramid.configuration.Config)2 LSBoost (edu.neu.ccs.pyramid.regression.least_squares_boost.LSBoost)2 RegTreeFactory (edu.neu.ccs.pyramid.regression.regression_tree.RegTreeFactory)2 Pair (edu.neu.ccs.pyramid.util.Pair)2 ArrayList (java.util.ArrayList)2 StopWatch (org.apache.commons.lang3.time.StopWatch)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 StandardFormat (edu.neu.ccs.pyramid.dataset.StandardFormat)1 RMSE (edu.neu.ccs.pyramid.eval.RMSE)1 LSBoostOptimizer (edu.neu.ccs.pyramid.regression.least_squares_boost.LSBoostOptimizer)1 ElasticNetLinearRegOptimizer (edu.neu.ccs.pyramid.regression.linear_regression.ElasticNetLinearRegOptimizer)1 LinearRegression (edu.neu.ccs.pyramid.regression.linear_regression.LinearRegression)1 RegressionTree (edu.neu.ccs.pyramid.regression.regression_tree.RegressionTree)1 TreeRule (edu.neu.ccs.pyramid.regression.regression_tree.TreeRule)1