public static void Gethistoricaldata(double[] testpointsx, List <double[]> userfeedbacks, out double usery)
 {
     usery = -1;
     foreach (var fb in userfeedbacks)
     {
         var fbx = OnlineGPupdating.GetXfromTraining(OnlineGPupdating.RowtoMatrix(fb));
         if (EvaluationForBinaryTree.IsSameImputs(testpointsx, fbx))
         {
             usery = fb[fb.Length - 1];
             break;
         }
         else
         {
             usery = -1;
         }
     }
 }
        public static void WriteUserFeedback(double[] newdata, string csvaddress)
        {
            var  fxnew        = OnlineGPupdating.GetXfromTraining(newdata);
            var  fynew        = newdata[newdata.Length - 1];
            var  olddata      = ReadUserFeedback(csvaddress);
            int  deletindex   = 0;
            bool needtodelete = false;

            for (int i = 0; i < olddata.Count; i++)
            {
                var f     = olddata[i];
                var fxold = OnlineGPupdating.GetXfromTraining(f);
                if (EvaluationForBinaryTree.IsSameImputs(fxold, OnlineGPupdating.RowtoMatrix(fxnew)))
                {
                    f[f.Length - 1] = fynew;
                    needtodelete    = true;
                    deletindex      = i;
                    break;
                }
            }
            if (needtodelete)
            {
                olddata.RemoveAt(deletindex);
            }
            olddata.Add(newdata);
            System.IO.File.Delete(csvaddress);
            var csv = new StringBuilder();

            foreach (var value in olddata)
            {
                var str = "";
                for (int i = 0; i < value.Length; ++i)
                {
                    str += value[i].ToString();
                    if (i < value.Length - 1)
                    {
                        str += ",";
                    }
                }
                csv.AppendLine(str);
            }
            //   csv.AppendLine("Name,age");
            File.AppendAllText(csvaddress, csv.ToString());
            csv.Clear();
        }