Search in sources :

Example 1 with AngelClient

use of com.tencent.angel.client.AngelClient in project angel by Tencent.

the class GBDTLocalExample method predict.

public void predict() throws IOException {
    setConf();
    // Load Model from HDFS.
    String TMP_PATH = System.getProperty("java.io.tmpdir", "/tmp");
    conf.set("gbdt.split.feature", TMP_PATH + "/out/xxx");
    conf.set("gbdt.split.value", TMP_PATH + "/out/xxx");
    GBDTRunner runner = new GBDTRunner();
    runner.predict(conf);
    AngelClient angelClient = AngelClientFactory.get(conf);
    angelClient.stop();
}
Also used : AngelClient(com.tencent.angel.client.AngelClient) GBDTRunner(com.tencent.angel.ml.GBDT.GBDTRunner)

Example 2 with AngelClient

use of com.tencent.angel.client.AngelClient in project angel by Tencent.

the class LongKeySubmit method submit.

@Override
public void submit(Configuration conf) throws Exception {
    conf.setBoolean(AngelConf.ANGEL_AM_USE_DUMMY_DATASPLITER, true);
    AngelClient angelClient = AngelClientFactory.get(conf);
    int blockCol = conf.getInt("blockcol", 5000000);
    MatrixContext context = new MatrixContext("longkey_test", 1, 2100000000, 1, blockCol);
    context.setRowType(RowType.T_DOUBLE_SPARSE_LONGKEY);
    angelClient.addMatrix(context);
    angelClient.startPSServer();
    angelClient.run();
    angelClient.waitForCompletion();
    angelClient.stop(0);
}
Also used : MatrixContext(com.tencent.angel.ml.matrix.MatrixContext) AngelClient(com.tencent.angel.client.AngelClient)

Example 3 with AngelClient

use of com.tencent.angel.client.AngelClient in project angel by Tencent.

the class PSFTestSubmit method submit.

@Override
public void submit(Configuration conf) throws Exception {
    conf.setBoolean(AngelConf.ANGEL_AM_USE_DUMMY_DATASPLITER, true);
    AngelClient angelClient = AngelClientFactory.get(conf);
    int blockCol = conf.getInt("blockcol", 50000);
    MatrixContext context = new MatrixContext("psf_test", 2, 10000000, 1, blockCol);
    context.setRowType(RowType.T_DOUBLE_DENSE);
    angelClient.addMatrix(context);
    angelClient.startPSServer();
    angelClient.run();
    angelClient.waitForCompletion();
    angelClient.stop(0);
}
Also used : MatrixContext(com.tencent.angel.ml.matrix.MatrixContext) AngelClient(com.tencent.angel.client.AngelClient)

Example 4 with AngelClient

use of com.tencent.angel.client.AngelClient in project angel by Tencent.

the class SVMTest method incLearnTest.

private void incLearnTest() throws Exception {
    try {
        String inputPath = "./src/test/data/lr/a9a.train";
        String logPath = "./src/test/log";
        // Set trainning data path
        conf.set(AngelConf.ANGEL_TRAIN_DATA_PATH, inputPath);
        // Set load model path
        conf.set(AngelConf.ANGEL_LOAD_MODEL_PATH, LOCAL_FS + TMP_PATH + "/SVMModel");
        // Set save model path
        conf.set(AngelConf.ANGEL_SAVE_MODEL_PATH, LOCAL_FS + TMP_PATH + "/newSVMModel");
        // Set actionType incremental train
        conf.set(AngelConf.ANGEL_ACTION_TYPE, MLConf.ANGEL_ML_INC_TRAIN());
        // Set log path
        conf.set(AngelConf.ANGEL_LOG_PATH, logPath);
        SVMRunner runner = new SVMRunner();
        runner.train(conf);
        AngelClient angelClient = AngelClientFactory.get(conf);
        angelClient.stop();
    } catch (Exception x) {
        LOG.error("run incLearnTest failed ", x);
        throw x;
    }
}
Also used : AngelClient(com.tencent.angel.client.AngelClient) SVMRunner(com.tencent.angel.ml.classification.svm.SVMRunner)

Example 5 with AngelClient

use of com.tencent.angel.client.AngelClient in project angel by Tencent.

the class GBDTTest method predict.

private void predict() throws Exception {
    try {
        // Load Model from HDFS.
        conf.set(AngelConf.ANGEL_PREDICT_DATA_PATH, testInputPath);
        conf.set(AngelConf.ANGEL_LOAD_MODEL_PATH, LOCAL_FS + TMP_PATH + "/model");
        conf.set(AngelConf.ANGEL_PREDICT_PATH, LOCAL_FS + TMP_PATH + "/predict");
        conf.set(AngelConf.ANGEL_ACTION_TYPE, MLConf.ANGEL_ML_PREDICT());
        GBDTRunner runner = new GBDTRunner();
        runner.predict(conf);
        AngelClient angelClient = AngelClientFactory.get(conf);
        angelClient.stop();
    } catch (Exception x) {
        LOG.error("run predict failed ", x);
        throw x;
    }
}
Also used : AngelClient(com.tencent.angel.client.AngelClient) GBDTRunner(com.tencent.angel.ml.GBDT.GBDTRunner)

Aggregations

AngelClient (com.tencent.angel.client.AngelClient)9 GBDTRunner (com.tencent.angel.ml.GBDT.GBDTRunner)4 MatrixContext (com.tencent.angel.ml.matrix.MatrixContext)4 SVMRunner (com.tencent.angel.ml.classification.svm.SVMRunner)1