Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Address string // local address, like ip:port TrainTaskLimit int // indicates the upper limit of the number of training task PredictTaskLimit int // indicates the upper limit of the number of prediction task RpcTimeout time.Duration // rpc connection releases when timeout elapses. eg. 3 means 3*time.Second }
Config is used when start mpc
type ModelHolder ¶
type ModelHolder interface { // SaveModel to persist a model SaveModel(*pbCom.TrainTaskResult) error // SavePredictOut to persist predicting outcomes // outcomes will be zero-value if the holder has't target tag SavePredictOut(*pbCom.PredictTaskResult) error }
ModelHolder to save the trained models and prediction outcomes, set into Trainer and Predictor in initialization phase
type Mpc ¶
type Mpc interface { // Train to train out a model Train(*pb.TrainRequest) (*pb.TrainResponse, error) // Predict to do prediction Predict(*pb.PredictRequest) (*pb.PredictResponse, error) // StartTask starts a specific task of training or prediction StartTask(*pbCom.StartTaskRequest) error // StopTask stops a specific task of training or prediction StopTask(*pbCom.StopTaskRequest) error // Validate writes the prediction results to the Evaluator or LiveEvaluator, // then trigger the subsequent verification process. Validate(*pb.ValidateRequest) error // Stop performs any necessary termination of the node Stop() }
type P2P ¶
P2P used by local Learners to communicate with remote ones on other nodes set into mpc instance in initialization phase
type PredictCallBack ¶
type PredictCallBack struct { //modelHolder ModelHolder //taskHandler Mpc Mpc }
PredictCallBack contains some methods would be called when finish prediction
type Predictor ¶
type Predictor interface { // NewModel creates a Model instance related to TaskId NewModel(*pbCom.StartTaskRequest) error // DeleteModel deletes a model DeleteModel(*pbCom.StopTaskRequest) error // Predict dispatches requests to different Models by taskId during prediction processes // Response channel returns the result, and couldn't be set with nil Predict(*pb.PredictRequest, chan *predictor.PredictResponse) }
Predictor manages Models, such as to create or to delete a model dispatches requests to different Models by taskId, keeps the number of Models in the proper range in order to avoid high memory usage
type TrainCallBack ¶
type TrainCallBack struct { //modelHolder ModelHolder ModelHolder //taskHandler Mpc Mpc }
TrainCallBack contains some methods that would be called when finish training
type Trainer ¶
type Trainer interface { // NewLearner creates a Learner related to TaskId NewLearner(*pbCom.StartTaskRequest) error // DeleteLearner deletes a Learner DeleteLearner(*pbCom.StopTaskRequest) error // Train to dispatch requests to different Learners by taskId during training processes // Response channel returns the result, and couldn't be set with nil Train(*pb.TrainRequest, chan *trainer.TrainResponse) // Validate saves the prediction results to the Evaluator or LiveEvaluator, // then trigger the subsequent verification process. Validate(*pb.ValidateRequest, chan *trainer.TrainResponse) }
Trainer manages Learners, such as to create or to delete a learner dispatches requests to different Learners by taskId, keeps the number of Learners in the proper range in order to avoid high memory usage