use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testDivS.
@Test
public void testDivS() throws Exception {
UpdateFunc func = new DivS(w2Client.getMatrixId(), 0, 3, -1.0);
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], localArray0[i] / -1.0, delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testIncrement.
@Test
public void testIncrement() throws Exception {
UpdateFunc func = new Increment(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], 0.0 + localArray1[i], delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testCeil.
@Test
public void testCeil() throws Exception {
UpdateFunc func = new Ceil(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.ceil(localArray0[i]), delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testMaxV.
@Test
public void testMaxV() throws Exception {
UpdateFunc func = new MaxV(w2Client.getMatrixId(), 0, 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.max(localArray1[i], localArray0[i]), delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testMulS.
@Test
public void testMulS() throws Exception {
UpdateFunc func = new MulS(w2Client.getMatrixId(), 0, 3, -1.0);
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] * -1.0, delta);
}
}
Aggregations