public override void Deploy(ClassifierSettings _setup) { setup = _setup; // name = setup.kNN_k + "-NN"; switch (setup.distanceFunction) { case DistanceFunctionType.SquareEuclidean: _distance = new SquareEuclidean(); break; case DistanceFunctionType.Jaccard: _distance = new Jaccard(); break; case DistanceFunctionType.Hamming: _distance = new Hamming(); break; case DistanceFunctionType.Euclidean: _distance = new Euclidean(); break; case DistanceFunctionType.Dice: _distance = new Dice(); break; case DistanceFunctionType.Cosine: _distance = new Cosine(); break; } kNearest = new KNearestNeighbors <Double[]>(k: setup.kNN_k, distance: _distance); }
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) }
public abstract void Deploy(ClassifierSettings _setup);