Exemplo n.º 1
0
    def predict(self):
        self.set_conf()
        input_path = "../data/exampledata/LinearRegression/LinearReg100.train"
        LOCAL_FS = LocalFileSystem.DEFAULT_FS
        TMP_PATH = tempfile.gettempdir()

        # Set trainning data path
        self.conf.set(AngelConf.ANGEL_TRAIN_DATA_PATH, inputPath)
        # Set load model path
        self.conf.set(AngelConf.ANGEL_LOAD_MODEL_PATH,
                      LOCAL_FS + TMP_PATH + "/model")
        # Set predict result path
        self.conf.set(AngelConf.ANGEL_PREDICT_PATH,
                      LOCAL_FS + TMP_PATH + "/predict")
        # Set actionType prediction
        self.conf.set(AngelConf.ANGEL_ACTION_TYPE, MLConf.ANGEL_ML_PREDICT())
        runner = LinearRegRunner()

        runner.predict(self.conf)
Exemplo n.º 2
0
    def train_on_local_cluster(self):
        self.set_conf()
        input_path = "./src/test/data/fm/food_fm_libsvm"
        LOCAL_FS = LocalFileSystem.DEFAULT_FS
        TMP_PATH = tempfile.gettempdir()
        save_path = LOCAL_FS + TMP_PATH + "/model"
        log_path = LOCAL_FS + TMP_PATH + "/LRlog"

        # Set trainning data path
        self.conf.set(AngelConf.ANGEL_TRAIN_DATA_PATH, input_path)
        # Set save model path
        self.conf.set(AngelConf.ANGEL_SAVE_MODEL_PATH, save_path)
        # Set log path
        self.conf.set(AngelConf.ANGEL_LOG_PATH, log_path)
        # Set actionType train
        self.conf.set(AngelConf.ANGEL_ACTION_TYPE, MLConf.ANGEL_ML_TRAIN())

        runner = FMRunner()
        runner.train(self.conf)

        angel_client = AngelClientFactory.get(self.conf)
        angel_client.stop()
Exemplo n.º 3
0
    def inc_train(self):
        self.set_conf()
        input_path = "../data/exampledata/LinearRegression/LinearReg100.train"
        LOCAL_FS = LocalFileSystem.DEFAULT_FS
        TMP_PATH = tempfile.gettempdir()
        log_path = "./src/test/log"

        # Set trainning data path
        self.conf.set(AngelConf.ANGEL_TRAIN_DATA_PATH, inputPath)
        # Set load model path
        self.conf.set(AngelConf.ANGEL_LOAD_MODEL_PATH,
                      LOCAL_FS + TMP_PATH + "/model")
        # Set save model path
        self.conf.set(AngelConf.ANGEL_SAVE_MODEL_PATH,
                      LOCAL_FS + TMP_PATH + "/newmodel")
        # Set actionType incremental train
        self.conf.set(AngelConf.ANGEL_ACTION_TYPE, MLConf.ANGEL_ML_INC_TRAIN())
        # Set log path
        self.conf.set(AngelConf.ANGEL_LOG_PATH, logPath)

        runner = LinearRegRunner()
        runner.incTrain(self.conf)
Exemplo n.º 4
0
    def predict(self):
        self.set_conf()
        input_path = "../data/exampledata/LRLocalExampleData/a9a.test"
        LOCAL_FS = LocalFileSystem.DEFAULT_FS
        TMP_PATH = System.getProperty("java.io.tmpdir", "/tmp")
        load_path = LOCAL_FS + TMP_PATH + "/model"
        save_path = LOCAL_FS + TMP_PATH + "/model"
        log_path = LOCAL_FS + TMP_PATH + "/log"
        predict_path = LOCAL_FS + TMP_PATH + "/predict"

        # Set trainning data path
        self.conf.set(AngelConf.ANGEL_TRAIN_DATA_PATH, input_path)
        # Set load model path
        self.conf.set(AngelConf.ANGEL_LOAD_MODEL_PATH, load_path)
        # Set predict result path
        self.conf.set(AngelConf.ANGEL_PREDICT_PATH, predict_path)
        # Set log path
        self.conf.set(AngelConf.ANGEL_LOG_PATH, log_path)
        # Set actionType prediction
        self.conf.set(AngelConf.ANGEL_ACTION_TYPE, MLConf.ANGEL_ML_PREDICT())

        runner = LRRunner()

        runner.predict(self.conf)
Exemplo n.º 5
0
 def __init__(self):
     self.conf = Configuration()
     self.MLConf = MLConf()