docs/algo/linear_on_angel.md
线性回归模型(linear regression model)利用最小二乘函数对一个或多个自变量与一个因变量之间的关系进行建模,是一种常见的预测模型。
线性回归模型(linear regression model)是一种回归模型。给一个随机样本 , 一个线性回归模型假设回归子和回归量 之间的关系是除了X的影响以外,还有其他的变量存在。我们加入一个误差项(也是一个随机变量)来捕获除了 之外任何对的影响,一个多变量线性回归模型表示为以下的形式:
线性回归模型使用最小二乘法计算损失,其目标是最小化残差平方和,目标函数如下所示:
其中:为一组样本数据。
Angel MLLib提供了用Mini-Batch Gradient Descent优化方法求解的Linear Regression算法,其算法逻辑如下其中
其说明如下:
其中, α为衰减系数, T为迭代次数
算法参数
输入输出参数
资源参数
提交命令
./bin/angel-submit \
--action.type=train \
--angel.app.submit.class=com.tencent.angel.ml.core.graphsubmit.GraphRunner \
--ml.model.class.name=com.tencent.angel.ml.regression.LinearRegression \
--angel.train.data.path=$input_path \
--angel.save.model.path=$model_path \
--angel.log.path=$log_path \
--ml.data.is.classification=false \
--ml.model.is.classification=false \
--ml.epoch.num=10 \
--ml.feature.index.range=$featureNum+1 \
--ml.data.validate.ratio=0.1 \
--ml.learn.rate=0.1 \
--ml.reg.l2=0.001 \
--ml.num.update.per.epoch=10 \
--ml.worker.thread.num=4 \
--ml.data.type=libsvm \
--ml.model.type=T_FLOAT_DENSE \
--angel.workergroup.number=2 \
--angel.worker.memory.mb=5000 \
--angel.worker.task.number=1 \
--angel.ps.number=2 \
--angel.ps.memory.mb=5000 \
--angel.job.name=linearReg_network \
--angel.output.path.deleteonexist=true
./bin/angel-submit \
--action.type=inctrain \
--angel.app.submit.class=com.tencent.angel.ml.core.graphsubmit.GraphRunner \
--ml.model.class.name=com.tencent.angel.ml.regression.LinearRegression \
--angel.train.data.path=$input_path \
--angel.load.model.path=$model_path \
--angel.save.model.path=$model_path \
--angel.log.path=$log_path \
--ml.model.is.classification=false \
--ml.data.is.classification=false \
--ml.epoch.num=10 \
--ml.feature.index.range=$featureNum+1 \
--ml.data.validate.ratio=0.1 \
--ml.learn.rate=0.1 \
--ml.reg.l2=0.001 \
--ml.num.update.per.epoch=10 \
--ml.worker.thread.num=4 \
--ml.data.type=libsvm \
--ml.model.type=T_FLOAT_DENSE \
--angel.workergroup.number=2 \
--angel.worker.memory.mb=5000 \
--angel.worker.task.number=1 \
--angel.ps.number=2 \
--angel.ps.memory.mb=5000 \
--angel.job.name=linearReg_network \
--angel.output.path.deleteonexist=true
./bin/angel-submit \
--action.type=predict \
--angel.app.submit.class=com.tencent.angel.ml.core.graphsubmit.GraphRunner \
--ml.model.class.name=com.tencent.angel.ml.regression.LinearRegression \
--angel.predict.data.path=$input_path \
--angel.save.model.path=$model_path \
--angel.predict.out.path $predict_path \
--angel.log.path=$log_path \
--ml.feature.index.range=$featureNum+1 \
--ml.data.type=libsvm \
--ml.model.type=T_FLOAT_DENSE \
--ml.worker.thread.num=4 \
--angel.workergroup.number=2 \
--angel.worker.memory.mb=5000 \
--angel.worker.task.number=1 \
--angel.ps.number=2 \
--angel.ps.memory.mb=5000 \
--angel.job.name=linearReg_network_predict \
--angel.output.path.deleteonexist=true