use of org.apache.mahout.math.DenseVector in project pyramid by cheng-li.
the class LogisticRegressionTest method test4.
private static void test4() {
double[] prior = { 0.3, 0.7 };
LogisticRegression logisticRegression = new LogisticRegression(2, 10, prior);
Vector vector = new DenseVector(10);
for (int d = 0; d < 10; d++) {
vector.set(d, Math.random());
}
System.out.println(Arrays.toString(logisticRegression.predictClassProbs(vector)));
}
use of org.apache.mahout.math.DenseVector in project pyramid by cheng-li.
the class IntervalSplitterTest method test11.
static void test11() {
RegTreeConfig regTreeConfig = new RegTreeConfig().setNumSplitIntervals(2);
Vector vector = new DenseVector(4);
vector.set(0, Double.NaN);
vector.set(1, 1);
vector.set(2, Double.NaN);
vector.set(3, 3);
double[] probs = { 1, 0.5, 1, 0.6 };
double[] labels = { 1, 2, 3, 4 };
Splitter.GlobalStats globalStats = new Splitter.GlobalStats(labels, probs);
List<Interval> intervals = IntervalSplitter.generateIntervals(regTreeConfig, vector, probs, labels, globalStats);
System.out.println(intervals);
System.out.println(IntervalSplitter.compress(intervals));
}
Aggregations