Documentation ¶
Index ¶
- func CostFromBytes(encCostByes []byte) (map[int]*big.Int, error)
- func CostToBytes(encCost map[int]*big.Int) ([]byte, error)
- func EncryptSampleIDSet(IDSet []string, publicKey *ecdsa.PublicKey) ([]byte, error)
- func GenerateHomoKeyPair() (*paillier.PrivateKey, []byte, error)
- func GeneratePSIKeyPair() (*ecdsa.PrivateKey, error)
- func GetBatchSetBySize(trainSet [][]float64, params pb_common.TrainParams, round int, ...) ([][]float64, [][]float64)
- func GradListFromBytes(gradsBytes []byte) ([]map[int]*big.Int, error)
- func GradListToBytes(grads []map[int]*big.Int) ([]byte, error)
- func HomoPubkeyFromBytes(keyBytes []byte) (*paillier.PublicKey, error)
- func HomoPubkeyToBytes(key *paillier.PublicKey) ([]byte, error)
- func IntersectTwoParts(sampleID []string, reEncSetLocal []byte, reEncSetOthers []byte) ([]string, error)
- func LinearEncGradientPartFromBytes(encPartBytes []byte) (*linear_vertical.EncLocalGradientPart, error)
- func LinearEncGradientPartToBytes(encPart *linear_vertical.EncLocalGradientPart) ([]byte, error)
- func LogicEncGradAndCostPartFromBytes(encPartBytes []byte) (*logic_vertical.EncLocalGradAndCostPart, error)
- func LogicEncGradAndCostPartToBytes(encPart *logic_vertical.EncLocalGradAndCostPart) ([]byte, error)
- func PSIEncSetFromBytes(setBytes []byte) (*linear_vertical.EncSet, error)
- func PSIEncSetToBytes(set *linear_vertical.EncSet) ([]byte, error)
- func PredictResultFromBytes(resultBytes []byte) ([][]string, error)
- func PredictResultToBytes(idName string, IDs []string, values []float64) ([]byte, error)
- func ReEncryptIDSet(encSet []byte, privateKey *ecdsa.PrivateKey) ([]byte, error)
- func RearrangeFileWithIntersectIDs(fileRows [][]string, idName string, IDs []string) ([][]string, error)
- func RetrieveIDsFromFile(fileRows [][]string, idName string) ([]string, error)
- func TrainModelsFromBytes(modelsBytes []byte) (*pb_common.TrainModels, error)
- func TrainModelsToBytes(thetas []float64, trainDataSet *ml_common.TrainDataSet, ...) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CostFromBytes ¶
CostFromBytes retrieve costs from bytes
func CostToBytes ¶
CostToBytes convert costs to bytes
func EncryptSampleIDSet ¶
EncryptSampleIDSet encrypt local sample ID set by own public key IDSet is retrieved from local sample file, encrypted by local public key
func GenerateHomoKeyPair ¶
func GenerateHomoKeyPair() (*paillier.PrivateKey, []byte, error)
GenerateHomoKeyPair generate paillier key pair, return private key and public key bytes(for transfer)
func GeneratePSIKeyPair ¶
func GeneratePSIKeyPair() (*ecdsa.PrivateKey, error)
GeneratePSIKeyPair generate ecc private and public key pair for PSI using default elliptic curve key pair is used for ID list encryption and intersection
func GetBatchSetBySize ¶
func GetBatchSetBySize(trainSet [][]float64, params pb_common.TrainParams, round int, needCheckReorder bool) ([][]float64, [][]float64)
GetBatchSetBySize get train set for specific round by batch size - trainSet is sample set for training - params is training task params - round is loop round for training task - needCheckReorder indicates whether reorder is needed
func GradListFromBytes ¶
GradListFromBytes retrieve gradient list from bytes
func GradListToBytes ¶
GradListToBytes convert gradient list to bytes
func HomoPubkeyFromBytes ¶
HomoPubkeyFromBytes retrieve homomorphic public key from bytes
func HomoPubkeyToBytes ¶
HomoPubkeyToBytes convert homomorphic public key to bytes
func IntersectTwoParts ¶
func IntersectTwoParts(sampleID []string, reEncSetLocal []byte, reEncSetOthers []byte) ([]string, error)
IntersectTwoParts get intersection of two parts' ID set sampleID is ID list retrieved from local sample file reEncSetLocal is local ID list that was already encrypted twice reEncSetOthers is other party's ID list that was already encrypted twice
func LinearEncGradientPartFromBytes ¶
func LinearEncGradientPartFromBytes(encPartBytes []byte) (*linear_vertical.EncLocalGradientPart, error)
LinearEncGradientPartFromBytes retrieve enc gradient part from bytes
func LinearEncGradientPartToBytes ¶
func LinearEncGradientPartToBytes(encPart *linear_vertical.EncLocalGradientPart) ([]byte, error)
LinearEncGradientPartToBytes convert enc gradient part to bytes
func LogicEncGradAndCostPartFromBytes ¶
func LogicEncGradAndCostPartFromBytes(encPartBytes []byte) (*logic_vertical.EncLocalGradAndCostPart, error)
LogicEncGradAndCostPartFromBytes retrieve enc gradientAndCost part from bytes
func LogicEncGradAndCostPartToBytes ¶
func LogicEncGradAndCostPartToBytes(encPart *logic_vertical.EncLocalGradAndCostPart) ([]byte, error)
LogicEncGradAndCostPartToBytes convert enc gradientAndCost part to bytes
func PSIEncSetFromBytes ¶
func PSIEncSetFromBytes(setBytes []byte) (*linear_vertical.EncSet, error)
PSIEncSetFromBytes retrieve enc set from bytes
func PSIEncSetToBytes ¶
func PSIEncSetToBytes(set *linear_vertical.EncSet) ([]byte, error)
PSIEncSetToBytes convert enc set to bytes
func PredictResultFromBytes ¶
PredictResultFromBytes retrieve predict values from bytes
func PredictResultToBytes ¶
PredictResultToBytes convert ID and predict values to bytes for storage
func ReEncryptIDSet ¶
func ReEncryptIDSet(encSet []byte, privateKey *ecdsa.PrivateKey) ([]byte, error)
ReEncryptIDSet re-encrypt others ID set by own private key encSet is the encryption of ID list, received from other party, already encrypted once encrypt encSet once more using local private key
func RearrangeFileWithIntersectIDs ¶
func RearrangeFileWithIntersectIDs(fileRows [][]string, idName string, IDs []string) ([][]string, error)
RearrangeFileWithIntersectIDs re-arrange file by hash(ID) ascending order fileRows is original sample rows, including feature list and sample values idName is the name of ID feature IDs is the ID list after PSI
func RetrieveIDsFromFile ¶
RetrieveIDsFromFile retrieve ID set from file rows by id name fileRows is original sample rows, including feature list and sample values idName is the name of ID feature, like "id", "card_number"...
func TrainModelsFromBytes ¶
func TrainModelsFromBytes(modelsBytes []byte) (*pb_common.TrainModels, error)
TrainModelsFromBytes retrieve train models from bytes
func TrainModelsToBytes ¶
func TrainModelsToBytes(thetas []float64, trainDataSet *ml_common.TrainDataSet, params pb_common.TrainParams) ([]byte, error)
TrainModelsToBytes convert train models to bytes for transfer and save
Types ¶
This section is empty.