/// <summary>Sets multi-class Support Vector Machine classifier</summary> /// <remarks><para>Removes any existing classifier and sets mSVM with specified settings</para></remarks> /// <param name="loss">Loss function to set</param> /// <param name="model">Model to be used with SVM classifier</param> /// <seealso cref="aceOperationSetExecutorBase"/> public void aceOperation_setmSVM( [Description("Loss function to set")] Loss loss = Loss.L2, [Description("Model to be used with SVM classifier")] mSVMModels model = mSVMModels.linear) { data.classifierSettings.type = imbNLP.Toolkit.Classifiers.ClassifierType.multiClassSVM; data.classifierSettings.lossFunctionForTraining = loss; data.classifierSettings.svmModel = model; }
public override void Deploy(ClassifierSettings _setup) { setup = _setup; model = setup.svmModel; if (model == mSVMModels.linear) { // Create a one-vs-one multi-class SVM learning algorithm teacher = new MulticlassSupportVectorLearning <Linear>() { // using LIBLINEAR's L2-loss SVC dual for each SVM Learner = (p) => new LinearDualCoordinateDescent() { Loss = setup.lossFunctionForTraining } }; } if (model == mSVMModels.gaussian) { // Create the multi-class learning algorithm for the machine teacherGaussian = new MulticlassSupportVectorLearning <Gaussian>() { // Configure the learning algorithm to use SMO to train the // underlying SVMs in each of the binary class subproblems. Learner = (param) => new SequentialMinimalOptimization <Gaussian>() { // Estimate a suitable guess for the Gaussian kernel's parameters. // This estimate can serve as a starting point for a grid search. UseKernelEstimation = true } }; } //teacher.UseKernelEstimation = true; // The following line is only needed to ensure reproducible results. Please remove it to enable full parallelization // teacher.ParallelOptions.MaxDegreeOfParallelism = 1; // (Remove, comment, or change this line to enable full parallelism) }