简体   繁体   中英

Machine Learning on encrypted Data

I want to implement a machine learning model (KNN or random forest) with GO, on encrypted data.

My data is encrypted with HElib (homomorphic encryption), means that i still can perform ADD & MUL on the encrypted data.

My question is: Do i have to re implement all the Machine Learning algorithm with GO, or can i use a bit of "golearn" lib?

Example of KNN implementation with GO using golearn lib:

rawData, err := base.ParseCSVToInstances("../datasets/iris_headers.csv", true)
if err != nil {
    panic(err)
}

//Initialises a new KNN classifier
cls := knn.NewKnnClassifier("euclidean", "linear", 2)

//Do a training-test split
trainData, testData := base.InstancesTrainTestSplit(rawData, 0.50)
cls.Fit(trainData)

//Calculates the Euclidean distance and returns the most popular label
predictions, err := cls.Predict(testData)
if err != nil {
    panic(err)
}
fmt.Println(predictions)

// Prints precision/recall metrics
confusionMat, err := evaluation.GetConfusionMatrix(testData, predictions)
if err != nil {
    panic(fmt.Sprintf("Unable to get confusion matrix: %s", err.Error()))
}
fmt.Println(evaluation.GetSummary(confusionMat))

Thank you

You would need to create your own, decrypting version, of the base csv package; https://github.com/sjwhitworth/golearn/blob/master/base/csv.go

You could then pass the rawData output from your customer ParseCSVToInstances function to the KNN functions InstancesTrainTestSplit as normal.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM