dnn_paddlefl_vl

package
v0.0.0-...-ebe581b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const LOCAL_MODEL_FOLDER = "model/"
View Source
const LOCAL_SAMPLE_FOLDER = "local-sample/"
View Source
const LOCAL_SAMPLE_MPC_FOLDER = "mpc-sample/"
View Source
const PADDLEFL_TASK_CONFUSED_LABEL_FILE = "label-%s" // destination address
View Source
const PADDLEFL_TASK_CONFUSED_SAMPLE_FILE = "sample-%s-to-%s" // source address to destination address

Distinguish files by prefix name

View Source
const PADDLEFL_TASK_LABEL_FILE = "labels"
View Source
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

func (*Learner) Advance

func (l *Learner) Advance(payload []byte) (*pb.TrainResponse, error)

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL