代码拉取完成,页面将自动刷新
线性回归模型(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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。