public void Classification_Train(double[,] train_docrule, int[] label, string algorithm) { string classmodelpath; int attrSize = eclatlitems.Count; int attrSizeTest = eclatlitems.Count; // Specify the input variables DecisionVariable[] variables = new DecisionVariable[attrSize]; for (int i = 0; i < attrSize; i++) { variables[i] = new DecisionVariable((i + 1).ToString(), DecisionVariableKind.Discrete); } if (algorithm == "Tree") { classmodelpath = algorithm + ".model"; //RandomForest tree2 = new RandomForest(2, variables); DecisionTree tree = new DecisionTree(variables, 2); C45Learning teacher = new C45Learning(tree); var model = teacher.Learn(train_docrule.ToJagged(), label); //save model teacher.Save(Path.Combine("", classmodelpath)); } if (algorithm == "SVM") { classmodelpath = algorithm + ".model"; var learn = new SequentialMinimalOptimization() { UseComplexityHeuristic = true, UseKernelEstimation = false }; SupportVectorMachine teacher = learn.Learn(train_docrule.ToJagged(), label); //save model teacher.Save(Path.Combine("", classmodelpath)); } if (algorithm == "Logistic") { classmodelpath = algorithm + ".model"; var learner = new IterativeReweightedLeastSquares <LogisticRegression>() { Tolerance = 1e-4, // Let's set some convergence parameters Iterations = 1, // maximum number of iterations to perform Regularization = 0 }; LogisticRegression teacher = learner.Learn(train_docrule.ToJagged(), label); teacher.Save(Path.Combine("", classmodelpath)); } if (algorithm == "GA") { weights_ga_matlab(); } }