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); }
public void SetModel(SVMModel model) { if (model != null) { Model = model.Clone(); _ptr_model = SVMModel.Allocate(Model); } }
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); }