示例#1
0
        public static double[] Predict(this SVMProblem problem, SVMModel model)
        {
            IntPtr ptr_model = SVMModel.Allocate(model);

            double[] target = problem.X.Select(x => x.Predict(ptr_model)).ToArray();
            SVMModel.Free(ptr_model);
            return(target);
        }
示例#2
0
 public void SetModel(SVMModel model)
 {
     if (model != null)
     {
         Model      = model.Clone();
         _ptr_model = SVMModel.Allocate(Model);
     }
 }
示例#3
0
        public static double[] PredictValues(this SVMProblem problem, SVMModel model, out List <double[]> valuesList)
        {
            IntPtr ptr_model = SVMModel.Allocate(model);

            List <double[]> temp = new List <double[]>();

            double[] target = problem.X.Select(x =>
            {
                double[] estimations;
                double y = x.PredictProbability(ptr_model, out estimations);
                temp.Add(estimations);
                return(y);
            }).ToArray();

            SVMModel.Free(ptr_model);

            valuesList = temp;
            return(target);
        }