use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testPow.
@Test
public void testPow() throws Exception {
UpdateFunc func = new Pow(w2Client.getMatrixId(), 0, 3, 3.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], Math.pow(localArray0[i], 3.0), delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testFloor.
@Test
public void testFloor() throws Exception {
UpdateFunc func = new Floor(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.floor(localArray0[i]), delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testDiv.
@Test
public void testDiv() throws Exception {
UpdateFunc func = new Div(w2Client.getMatrixId(), 1, 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], 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 testAddS.
@Test
public void testAddS() throws InvalidParameterException, InterruptedException, ExecutionException {
UpdateFunc func = new AddS(w2Client.getMatrixId(), 0, 3, 2.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] + 2.0, delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testExp.
@Test
public void testExp() throws Exception {
UpdateFunc func = new Exp(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.exp(localArray0[i]), delta);
}
}
Aggregations