use of ml.shifu.shifu.core.LR in project shifu by ShifuML.
the class LogisticRegressionMaster method initOrRecoverParams.
private LogisticRegressionParams initOrRecoverParams(MasterContext<LogisticRegressionParams, LogisticRegressionParams> context) {
LOG.info("read from existing model");
LogisticRegressionParams params = null;
// read existing model weights
try {
Path modelPath = new Path(context.getProps().getProperty(CommonConstants.GUAGUA_OUTPUT));
LR existingModel = (LR) ModelSpecLoaderUtils.loadModel(modelConfig, modelPath, ShifuFileUtils.getFileSystemBySourceType(this.modelConfig.getDataSet().getSource()));
if (existingModel == null) {
params = initWeights();
LOG.info("Starting to train model from scratch.");
} else {
params = initModelParams(existingModel);
LOG.info("Starting to train model from existing model {}.", modelPath);
}
} catch (IOException e) {
throw new GuaguaRuntimeException(e);
}
return params;
}
Aggregations