use of com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult in project angel by Tencent.
the class AggrFuncTest method testMin.
@Test
public void testMin() throws InvalidParameterException, InterruptedException, ExecutionException {
GetFunc func = new Min(w2Client.getMatrixId(), 1);
double result = ((ScalarAggrResult) w2Client.get(func)).getResult();
double min = Double.MAX_VALUE;
for (double x : localArray1) {
if (min > x)
min = x;
}
Assert.assertEquals(result, min, delta);
}
use of com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult in project angel by Tencent.
the class AggrFuncTest method testAsum.
@Test
public void testAsum() throws InvalidParameterException, InterruptedException, ExecutionException {
GetFunc func = new Asum(w2Client.getMatrixId(), 1);
double result = ((ScalarAggrResult) w2Client.get(func)).getResult();
double sum = 0.0;
for (double x : localArray1) {
sum += Math.abs(x);
}
Assert.assertEquals(result, sum, delta);
}
use of com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult in project angel by Tencent.
the class AggrFuncTest method testNrm2.
@Test
public void testNrm2() throws InvalidParameterException, InterruptedException, ExecutionException {
GetFunc func = new Nrm2(w2Client.getMatrixId(), 1);
double result = ((ScalarAggrResult) w2Client.get(func)).getResult();
double nrm2 = 0;
for (double x : localArray1) {
nrm2 += x * x;
}
nrm2 = Math.sqrt(nrm2);
Assert.assertEquals(result, nrm2, delta);
}
use of com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult in project angel by Tencent.
the class AggrFuncTest method testMax.
@Test
public void testMax() throws InvalidParameterException, InterruptedException, ExecutionException {
GetFunc func = new Max(w2Client.getMatrixId(), 1);
double result = ((ScalarAggrResult) w2Client.get(func)).getResult();
double max = Double.MIN_VALUE;
for (double x : localArray1) {
if (max < x)
max = x;
}
Assert.assertEquals(result, max, delta);
}
use of com.tencent.angel.ml.matrix.psf.aggr.enhance.ScalarAggrResult in project angel by Tencent.
the class AggrFuncTest method testAmin.
@Test
public void testAmin() throws InvalidParameterException, InterruptedException, ExecutionException {
GetFunc func = new Amin(w2Client.getMatrixId(), 1);
double result = ((ScalarAggrResult) w2Client.get(func)).getResult();
double min = Double.MAX_VALUE;
for (double x : localArray1) {
if (min > Math.abs(x))
min = Math.abs(x);
}
Assert.assertEquals(result, min, delta);
}
Aggregations