use of ml.shifu.shifu.message.NormPartRawDataMessage in project shifu by ShifuML.
the class DataLoadWorker method handleMsg.
/*
* (non-Javadoc)
*
* @see akka.actor.UntypedActor#onReceive(java.lang.Object)
*/
@Override
public void handleMsg(Object message) {
if (message instanceof ScanStatsRawDataMessage) {
log.info("DataLoaderActor Starting ...");
ScanStatsRawDataMessage msg = (ScanStatsRawDataMessage) message;
Scanner scanner = msg.getScanner();
int totalMsgCnt = msg.getTotalMsgCnt();
List<String> rawDataList = readDataIntoList(scanner);
log.info("DataLoaderActor Finished: Loaded " + rawDataList.size() + " Records.");
nextActorRef.tell(new StatsPartRawDataMessage(totalMsgCnt, rawDataList), getSelf());
} else if (message instanceof ScanNormInputDataMessage) {
log.info("DataLoaderActor Starting ...");
ScanNormInputDataMessage msg = (ScanNormInputDataMessage) message;
Scanner scanner = msg.getScanner();
int totalMsgCnt = msg.getTotalMsgCnt();
List<String> rawDataList = readDataIntoList(scanner);
log.info("DataLoaderActor Finished: Loaded " + rawDataList.size() + " Records.");
nextActorRef.tell(new NormPartRawDataMessage(totalMsgCnt, rawDataList), getSelf());
} else if (message instanceof ScanTrainDataMessage) {
ScanTrainDataMessage msg = (ScanTrainDataMessage) message;
Scanner scanner = msg.getScanner();
int totalMsgCnt = msg.getTotalMsgCnt();
List<MLDataPair> mlDataPairList = readTrainingData(scanner, msg.isDryRun());
log.info("DataLoaderActor Finished: Loaded " + mlDataPairList.size() + " Records for Training.");
nextActorRef.tell(new TrainPartDataMessage(totalMsgCnt, msg.isDryRun(), mlDataPairList), getSelf());
} else if (message instanceof ScanEvalDataMessage) {
log.info("DataLoaderActor Starting ...");
ScanEvalDataMessage msg = (ScanEvalDataMessage) message;
Scanner scanner = msg.getScanner();
int streamId = msg.getStreamId();
int totalStreamCnt = msg.getTotalStreamCnt();
splitDataIntoMultiMessages(streamId, totalStreamCnt, scanner, Environment.getInt(Environment.RECORD_CNT_PER_MESSAGE, 100000));
/*
* List<String> evalDataList = readDataIntoList(scanner);
*
* log.info("DataLoaderActor Finished: Loaded " + evalDataList.size() + " Records.");
* nextActorRef.tell( new RunModelDataMessage(totalMsgCnt, evalDataList), getSelf());
*/
} else {
unhandled(message);
}
}
use of ml.shifu.shifu.message.NormPartRawDataMessage in project shifu by ShifuML.
the class DataNormalizeWorker method handleMsg.
/*
* (non-Javadoc)
*
* @see akka.actor.UntypedActor#onReceive(java.lang.Object)
*/
@Override
public void handleMsg(Object message) {
if (message instanceof NormPartRawDataMessage) {
NormPartRawDataMessage msg = (NormPartRawDataMessage) message;
List<String> rawDataList = msg.getRawDataList();
int targetMsgCnt = msg.getTotalMsgCnt();
List<List<Double>> normalizedDataList = normalizeData(rawDataList);
nextActorRef.tell(new NormResultDataMessage(targetMsgCnt, rawDataList, normalizedDataList), this.getSelf());
} else {
unhandled(message);
}
}
use of ml.shifu.shifu.message.NormPartRawDataMessage in project shifu by ShifuML.
the class DataFilterWorker method handleMsg.
/* (non-Javadoc)
* @see ml.shifu.shifu.actor.worker.AbstractWorkerActor#handleMsg(java.lang.Object)
*/
@Override
public void handleMsg(Object message) throws Exception {
if (message instanceof StatsPartRawDataMessage) {
StatsPartRawDataMessage msg = (StatsPartRawDataMessage) message;
purifyData(msg.getRawDataList());
nextActorRef.tell(msg, getSelf());
} else if (message instanceof NormPartRawDataMessage) {
NormPartRawDataMessage msg = (NormPartRawDataMessage) message;
purifyData(msg.getRawDataList());
nextActorRef.tell(msg, getSelf());
} else if (message instanceof RunModelDataMessage) {
RunModelDataMessage msg = (RunModelDataMessage) message;
purifyData(msg.getEvalDataList());
nextActorRef.tell(msg, getSelf());
} else {
unhandled(message);
}
}
Aggregations