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;
}
use of edu.neu.ccs.pyramid.dataset.RegDataSet in project pyramid by cheng-li.
the class RegressionSynthesizer method univarBeta.
public RegDataSet univarBeta() {
BetaDistribution betaDistribution = new BetaDistribution(2, 5);
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 = betaDistribution.density(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 multivarLine.
public RegDataSet multivarLine() {
int numFeatures = 2;
RegDataSet dataSet = RegDataSetBuilder.getBuilder().numDataPoints(numDataPoints).numFeatures(2).dense(true).missingValue(false).build();
for (int i = 0; i < numDataPoints; i++) {
for (int j = 0; j < numFeatures; j++) {
double featureValue = Sampling.doubleUniform(0, 1);
dataSet.setFeatureValue(i, j, featureValue);
}
double label = 0;
for (int j = 0; j < numFeatures; j++) {
label += dataSet.getRow(i).get(j);
}
label += noise.sample();
dataSet.setLabel(i, label);
}
return dataSet;
}
use of edu.neu.ccs.pyramid.dataset.RegDataSet in project pyramid by cheng-li.
the class RegressionSynthesizer method linear.
public static RegDataSet linear() {
int numData = 50;
RegDataSet dataSet = RegDataSetBuilder.getBuilder().numDataPoints(numData).numFeatures(16000).dense(true).missingValue(false).build();
Vector weights = new DenseVector(16000);
weights.set(0, 0.001);
weights.set(1, 0.001);
weights.set(2, 0.001);
weights.set(3, 0.001);
for (int i = 0; i < numData; i++) {
for (int j = 0; j < 16000; j++) {
BernoulliDistribution bernoulliDistribution = new BernoulliDistribution(0.5);
int sample = bernoulliDistribution.sample();
if (sample == 0) {
dataSet.setFeatureValue(i, j, -1);
} else {
dataSet.setFeatureValue(i, j, 1);
}
}
double label = weights.dot(dataSet.getRow(i));
dataSet.setLabel(i, label);
}
return dataSet;
}
use of edu.neu.ccs.pyramid.dataset.RegDataSet in project pyramid by cheng-li.
the class RegressionSynthesizer method univarSine.
public RegDataSet univarSine() {
RegDataSet dataSet = RegDataSetBuilder.getBuilder().numDataPoints(numDataPoints).numFeatures(1).dense(true).missingValue(false).build();
for (int i = 0; i < numDataPoints; i++) {
double featureValue = Sampling.doubleUniform(-Math.PI, Math.PI);
double label;
label = Math.sin(featureValue);
label += noise.sample();
dataSet.setFeatureValue(i, 0, featureValue);
dataSet.setLabel(i, label);
}
return dataSet;
}
Aggregations