Documentation ¶
Index ¶
Constants ¶
const LOCAL_OUTPUT_FOLDER = "output/"
const PADDLEFL_TASK_TRAIN_SAMPLE_CONFUSED_FILE = "from-%s-to-%s-sample-predict"
const PADDLEFL_TASK_TRAIN_SAMPLE_FILE = "samples-predict"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
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, params *pbCom.TrainModels, samplesFile []byte, parties []string, paddleFLParams *pbCom.PaddleFLParams, rpc RpcHandler, rh ResultHandler) (*Model, error)
NewModel returns a VerticalLinearRegression Model id is the assigned id for Model samplesFile is sample file content for prediction address indicates local mpc-node parties are other models who participates in MPC, assigned with mpc-node address usually paddleFLParams are array of nodes in mpc network, and the role of the current node. rpc is used to request remote mpc-node rh handles final result which is successful or failed params are parameters for training model
func (*Model) Advance ¶
func (model *Model) Advance(payload []byte) (*pb.PredictResponse, error)
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
type PSI ¶
type PSI interface { // EncryptSampleIDSet to encrypt local IDs EncryptSampleIDSet() ([]byte, error) // SetReEncryptIDSet sets re-encrypted IDs from other party, // and tries to calculate final re-encrypted IDs // returns True if calculation is Done, otherwise False if still waiting for others' parts // returns Error if any mistake happens SetReEncryptIDSet(party string, reEncIDs []byte) (bool, error) // ReEncryptIDSet to encrypt encrypted IDs for other party ReEncryptIDSet(party string, encIDs []byte) ([]byte, error) // SetOtherFinalReEncryptIDSet sets final re-encrypted IDs of other party SetOtherFinalReEncryptIDSet(party string, reEncIDs []byte) error // IntersectParts tries to calculate intersection with all parties' samples // returns True with final result if calculation is Done, otherwise False if still waiting for others' samples // returns Error if any mistake happens // You'd better call it when SetReEncryptIDSet returns Done or SetOtherFinalReEncryptIDSet finishes IntersectParts() (bool, [][]string, []string, error) }
PSI is for vertical learning, initialized at the beginning of training by Learner
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)
}
RpcHandler used to request remote mpc-node