Package ml.shifu.guagua.example.nn
Class NNWorker
-
public class NNWorker extends ml.shifu.guagua.worker.AbstractWorkerComputable<NNParams,NNParams,ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text>>
NNWorkeris used to compute NN model according to splits assigned. The result will be sent to master for accumulation.Gradients in each worker will be sent to master to update weights of model in worker, which follows Encog's multi-core implementation.
-
-
Constructor Summary
Constructors Constructor Description NNWorker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NNParamsdoCompute(ml.shifu.guagua.worker.WorkerContext<NNParams,NNParams> context)org.encog.ml.data.MLDataSetgetTestingData()org.encog.ml.data.MLDataSetgetTrainingData()voidinit(ml.shifu.guagua.worker.WorkerContext<NNParams,NNParams> context)voidinitRecordReader(ml.shifu.guagua.io.GuaguaFileSplit fileSplit)voidload(ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable> currentKey, ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text> currentValue, ml.shifu.guagua.worker.WorkerContext<NNParams,NNParams> workerContext)protected voidpostLoad(ml.shifu.guagua.worker.WorkerContext<NNParams,NNParams> workerContext)voidsetTestingData(org.encog.ml.data.MLDataSet testingData)voidsetTrainingData(org.encog.ml.data.MLDataSet trainingData)
-
-
-
Method Detail
-
doCompute
public NNParams doCompute(ml.shifu.guagua.worker.WorkerContext<NNParams,NNParams> context)
-
postLoad
protected void postLoad(ml.shifu.guagua.worker.WorkerContext<NNParams,NNParams> workerContext)
-
load
public void load(ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable> currentKey, ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text> currentValue, ml.shifu.guagua.worker.WorkerContext<NNParams,NNParams> workerContext)
-
initRecordReader
public void initRecordReader(ml.shifu.guagua.io.GuaguaFileSplit fileSplit) throws IOException- Specified by:
initRecordReaderin classml.shifu.guagua.worker.AbstractWorkerComputable<NNParams,NNParams,ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.LongWritable>,ml.shifu.guagua.hadoop.io.GuaguaWritableAdapter<org.apache.hadoop.io.Text>>- Throws:
IOException
-
getTrainingData
public org.encog.ml.data.MLDataSet getTrainingData()
-
setTrainingData
public void setTrainingData(org.encog.ml.data.MLDataSet trainingData)
-
getTestingData
public org.encog.ml.data.MLDataSet getTestingData()
-
setTestingData
public void setTestingData(org.encog.ml.data.MLDataSet testingData)
-
-