本文整理了Java中org.apache.mahout.math.Matrix.aggregateRows()
方法的一些代码示例,展示了Matrix.aggregateRows()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.aggregateRows()
方法的具体详情如下:
包路径:org.apache.mahout.math.Matrix
类名称:Matrix
方法名:aggregateRows
[英]Collects the results of a function applied to each row of a matrix.
[中]收集应用于矩阵每一行的函数的结果。
代码示例来源:origin: apache/mahout
@Test
public void testAggregate() {
double total = test.aggregate(Functions.PLUS, Functions.IDENTITY);
assertEquals(test.aggregateRows(new VectorFunction() {
@Override
public double apply(Vector v) {
return v.zSum();
}
}).zSum(), total, EPSILON);
}
代码示例来源:origin: apache/mahout
@Test
public void testAggregateRows() {
Vector v = test.aggregateRows(new VectorFunction() {
@Override
public double apply(Vector v) {
return v.zSum();
}
});
for (int i = 0; i < test.numRows(); i++) {
assertEquals(test.viewRow(i).zSum(), v.get(i), EPSILON);
}
}
代码示例来源:origin: tdunning/bandit-ranking
private Vector sampleNoLink() {
final Vector theta = state.aggregateRows(new VectorFunction() {
final DoubleFunction inverseLink = new InverseLogisticFunction();
@Override
public double apply(Vector f) {
return inverseLink.apply(rand.nextDouble(f.get(0), f.get(1)));
}
});
return featureMap.times(theta);
}
代码示例来源:origin: cloudera/mahout
@Test
public void testAggregate() {
double total = test.aggregate(Functions.PLUS, Functions.IDENTITY);
assertEquals(test.aggregateRows(new VectorFunction() {
@Override
public double apply(Vector v) {
return v.zSum();
}
}).zSum(), total, EPSILON);
}
代码示例来源:origin: cloudera/mahout
@Test
public void testAggregateRows() {
Vector v = test.aggregateRows(new VectorFunction() {
@Override
public double apply(Vector v) {
return v.zSum();
}
});
for (int i = 0; i < test.numRows(); i++) {
assertEquals(test.viewRow(i).zSum(), v.get(i), EPSILON);
}
}
内容来源于网络,如有侵权,请联系作者删除!