use of com.tencent.angel.ml.matrix.psf.get.base.GetFunc in project angel by Tencent.
the class AggrFuncTest method testNnz.
@Test
public void testNnz() throws InvalidParameterException, InterruptedException, ExecutionException {
GetFunc func = new Nnz(w2Client.getMatrixId(), 1);
double result = ((ScalarAggrResult) w2Client.get(func)).getResult();
int count = 0;
for (double x : localArray1) {
if (Math.abs(x - 0.0) > delta)
count++;
}
Assert.assertEquals((int) result, count);
}
use of com.tencent.angel.ml.matrix.psf.get.base.GetFunc 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.get.base.GetFunc 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.get.base.GetFunc 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);
}
use of com.tencent.angel.ml.matrix.psf.get.base.GetFunc 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);
}
Aggregations