Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model interface { // Advance does calculation with local parts of samples and communicates with other nodes in cluster to predict outcomes // payload could be resolved by Model trained out by specific algorithm and samples // We'd better call the method asynchronously avoid blocking the main go-routine Advance(payload []byte) (*pb.PredictResponse, error) }
Model was trained out by a Learner, and participates in the multi-parts-calculation during prediction process If input different parts of a sample into Models on different mpc-nodes, you'll get final predicting result after some time of multi-parts-calculation
func NewModel ¶
func NewModel(id string, address string, algo pbCom.Algorithm, params *pbCom.TrainModels, samplesFile []byte, parties []string, paddleFLParams *pbCom.PaddleFLParams, rpc RpcHandler, rh ResultHandler) (Model, error)
NewModel returns a Model id is the assigned id for Model samplesFile is sample file content for prediction address indicates local mpc-node algo is the algorithm of model parties are other models who participates in MPC, assigned with mpc-node address usually rpc is used to request remote mpc-node rh handles final result which is successful or failed params are parameters for model
type ResultHandler ¶
type ResultHandler interface {
SaveResult(*pbCom.PredictTaskResult)
}
ResultHandler handles final result which is successful or failed Should be called when prediction finished
type RpcHandler ¶
type RpcHandler interface { StepPredict(req *pb.PredictRequest, peerName string) (*pb.PredictResponse, error) // StepPredictWithRetry sends prediction message to remote mpc-node // retries 2 times at most // inteSec indicates the interval between retry requests, in seconds StepPredictWithRetry(req *pb.PredictRequest, peerName string, times int, inteSec int64) (*pb.PredictResponse, error) }
RpcHandler used to request remote mpc-node