title: Machine Learning on encrypted Data
body: <p>I want to implement a machine learning model (KNN or random forest) with GO, on encrypted data.</p>
  
  <p>My data is encrypted with HElib (homomorphic encryption), means that i still can perform ADD &amp; MUL on the encrypted data.</p>
  
  <p><strong>My question is:</strong> Do i have to re implement all the Machine Learning algorithm with GO, or can i use a bit of "golearn" lib?</p>
  
  <p>Example of KNN implementation with GO using golearn lib:</p>
  
  <pre><code>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))
  </code></pre>
  
  <p>Thank you</p>