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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations