douzhan8395 2017-04-28 09:18
浏览 151

机器学习加密数据

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

  • 写回答

1条回答 默认 最新

  • doutou7286 2017-04-28 09:57
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题