use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testScale.
@Test
public void testScale() throws Exception {
w2Client.update(new Push(w2Client.getMatrixId(), 3, localArray0)).get();
UpdateFunc func = new Scale(w2Client.getMatrixId(), 3, 2.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] * 2.0, delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testLog10.
@Test
public void testLog10() throws Exception {
UpdateFunc func = new Log10(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.log10(localArray0[i]), delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testSub.
@Test
public void testSub() throws Exception {
UpdateFunc func = new Sub(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], 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 testMinA.
@Test
public void testMinA() throws Exception {
w2Client.update(new Fill(w2Client.getMatrixId(), 3, 0.0)).get();
UpdateFunc func = new MinA(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.min(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 testAdd.
@Test
public void testAdd() throws InvalidParameterException, InterruptedException, ExecutionException {
UpdateFunc func = new Add(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);
}
}
Aggregations