Documentation ¶
Index ¶
Constants ¶
const LOCAL_MODEL_FOLDER = "model/"
const LOCAL_SAMPLE_FOLDER = "local-sample/"
const LOCAL_SAMPLE_MPC_FOLDER = "mpc-sample/"
const PADDLEFL_TASK_CONFUSED_LABEL_FILE = "label-%s" // destination address
const PADDLEFL_TASK_CONFUSED_SAMPLE_FILE = "sample-%s-to-%s" // source address to destination address
Distinguish files by prefix name
const PADDLEFL_TASK_LABEL_FILE = "labels"
const PADDLEFL_TASK_SAMPLE_FILE = "samples"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Learner ¶
type Learner struct {
// contains filtered or unexported fields
}
func NewLearner ¶
func NewLearner(id string, address string, params *pbCom.TrainParams, samplesFile []byte, parties []string, paddleFLParams *pbCom.PaddleFLParams, rpc RpcHandler, rh ResultHandler) (*Learner, error)
NewLearner returns a VerticalLinearDnn Learner based PaddleFL. PaddleFL's addresses will be obtained by invoking smart contract. id is the assigned id for Learner address indicates local mpc-node parties are other learners 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 samplesFile contains samples for training model
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.TrainTaskResult)
}
ResultHandler handles final result which is successful or failed Should be called when learning finished
type RpcHandler ¶
type RpcHandler interface {
StepTrain(req *pb.TrainRequest, peerName string) (*pb.TrainResponse, error)
}
RpcHandler used to request remote mpc-node