public static float Predict(this IStatModel model, IInputArray samples, IOutputArray results = null, int flags = 0) { using (InputArray iaSamples = samples.GetInputArray()) using (OutputArray oaResults = results == null ? OutputArray.GetEmpty() : results.GetOutputArray()) { return(MlInvoke.StatModelPredict(model.StatModelPtr, iaSamples, oaResults, flags)); } }
/// <summary> /// Trains the statistical model. /// </summary> /// <param name="model">The stat model.</param> /// <param name="samples">The training samples.</param> /// <param name="layoutType">Type of the layout.</param> /// <param name="responses">Vector of responses associated with the training samples.</param> /// <returns></returns> public static bool Train(this IStatModel model, IInputArray samples, DataLayoutType layoutType, IInputArray responses) { using (InputArray iaSamples = samples.GetInputArray()) using (InputArray iaResponses = responses.GetInputArray()) { return(MlInvoke.StatModelTrain(model.StatModelPtr, iaSamples, layoutType, iaResponses)); } }
/* * /// <summary> * /// Load the statistic model from file * /// </summary> * /// <param name="fileName">The file to load the model from</param> * public void Load(String fileName) * { * using (CvString fs = new CvString(fileName)) * MlInvoke.StatModelLoad(_ptr, fs); * }*/ /// <summary> /// Clear the statistic model /// </summary> public static void Clear(this IStatModel model) { MlInvoke.StatModelClear(model.StatModelPtr); }
public static bool Train(this IStatModel model, TrainData trainData, int flags = 0) { return(MlInvoke.StatModelTrainWithData(model.StatModelPtr, trainData, flags)); }
/// <summary> /// Save the statistic model to file /// </summary> /// <param name="fileName">The file name where this StatModel will be saved</param> public static void Save(this IStatModel model, String fileName) { using (CvString fs = new CvString(fileName)) MlInvoke.StatModelSave(model.StatModelPtr, fs); }