use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testMul.
@Test
public void testMul() throws Exception {
UpdateFunc func = new Mul(w2Client.getMatrixId(), 0, 1, 3);
w2Client.update(func).get();
double[] addResult = pull(w2Client, 3);
assert (addResult.length == dim);
for (int i = 0; i < addResult.length; i++) {
Assert.assertEquals(addResult[i], localArray0[i] * localArray1[i], delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testSqrt.
@Test
public void testSqrt() throws Exception {
UpdateFunc func = new Sqrt(w2Client.getMatrixId(), 0, 3);
w2Client.update(func).get();
double[] result = pull(w2Client, 3);
assert (result.length == dim);
for (int i = 0; i < result.length; i++) {
Assert.assertEquals(result[i], Math.sqrt(localArray0[i]), delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testMaxA.
@Test
public void testMaxA() throws Exception {
w2Client.update(new Fill(w2Client.getMatrixId(), 3, 0.0)).get();
UpdateFunc func = new MaxA(w2Client.getMatrixId(), 3, localArray1);
w2Client.update(func).get();
double[] result = pull(w2Client, 3);
assert (result.length == dim);
for (int i = 0; i < result.length; i++) {
Assert.assertEquals(result[i], Math.max(localArray1[i], 0.0), delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testExpm1.
@Test
public void testExpm1() throws Exception {
UpdateFunc func = new Expm1(w2Client.getMatrixId(), 0, 3);
w2Client.update(func).get();
double[] result = pull(w2Client, 3);
assert (result.length == dim);
for (int i = 0; i < result.length; i++) {
Assert.assertEquals(result[i], Math.expm1(localArray0[i]), delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testAbs.
@Test
public void testAbs() throws InvalidParameterException, InterruptedException, ExecutionException {
UpdateFunc func = new Abs(w2Client.getMatrixId(), 1, 3);
w2Client.update(func).get();
double[] result = pull(w2Client, 3);
assert (result.length == dim);
for (int i = 0; i < result.length; i++) {
Assert.assertEquals(result[i], Math.abs(localArray1[i]), delta);
}
}
Aggregations