use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testCopy.
@Test
public void testCopy() throws Exception {
UpdateFunc func = new Copy(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], localArray0[i], delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testCompress.
@Test
public void testCompress() throws Exception {
UpdateFunc func = new CompressUpdateFunc(w2Client.getMatrixId(), 5, localArray1, 8);
w2Client.update(func).get();
int maxPoint = (int) Math.pow(2, 8 - 1) - 1;
double maxMaxAbs = 0.0;
for (int i = 0; i < localArray1.length; i++) {
maxMaxAbs = Math.abs(localArray1[i]) > maxMaxAbs ? Math.abs(localArray1[i]) : maxMaxAbs;
}
double[] result = pull(w2Client, 5);
assert (result.length == dim);
for (int i = 0; i < result.length; i++) {
Assert.assertEquals(localArray1[i], 0.0 + result[i], 2 * maxMaxAbs / maxPoint);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testSubS.
@Test
public void testSubS() throws Exception {
UpdateFunc func = new SubS(w2Client.getMatrixId(), 0, 3, -1.1);
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.1), delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testLog1p.
@Test
public void testLog1p() throws Exception {
UpdateFunc func = new Log1p(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.log1p(localArray0[i]), delta);
}
}
use of com.tencent.angel.ml.matrix.psf.update.enhance.UpdateFunc in project angel by Tencent.
the class UpdateFuncTest method testLog.
@Test
public void testLog() throws Exception {
UpdateFunc func = new Log(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.log(localArray0[i]), delta);
}
}
Aggregations