Package ml.shifu.guagua.example.lnr
Class LinearRegressionMaster
- java.lang.Object
-
- ml.shifu.guagua.master.AbstractMasterComputable<LinearRegressionParams,LinearRegressionParams>
-
- ml.shifu.guagua.example.lnr.LinearRegressionMaster
-
- All Implemented Interfaces:
ml.shifu.guagua.master.MasterComputable<LinearRegressionParams,LinearRegressionParams>
public class LinearRegressionMaster extends ml.shifu.guagua.master.AbstractMasterComputable<LinearRegressionParams,LinearRegressionParams>
LinearRegressionMasterdefines logic to update global linear regression model.At first iteration, master builds a random model then send to all workers to start computing. This is to make all workers use the same model at the starting time.
At other iterations, master works:
- 1. Accumulate all gradients from workers.
- 2. Update global models by using accumulated gradients.
- 3. Send new global model to workers by returning model parameters.
-
-
Constructor Summary
Constructors Constructor Description LinearRegressionMaster()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LinearRegressionParamsdoCompute(ml.shifu.guagua.master.MasterContext<LinearRegressionParams,LinearRegressionParams> context)voidinit(ml.shifu.guagua.master.MasterContext<LinearRegressionParams,LinearRegressionParams> context)
-
-
-
Method Detail
-
init
public void init(ml.shifu.guagua.master.MasterContext<LinearRegressionParams,LinearRegressionParams> context)
- Specified by:
initin classml.shifu.guagua.master.AbstractMasterComputable<LinearRegressionParams,LinearRegressionParams>
-
doCompute
public LinearRegressionParams doCompute(ml.shifu.guagua.master.MasterContext<LinearRegressionParams,LinearRegressionParams> context)
- Specified by:
doComputein classml.shifu.guagua.master.AbstractMasterComputable<LinearRegressionParams,LinearRegressionParams>
-
-