public KNN_SVM(string path, double sigma, double gamma, Kernel kernel, int k, ImageVector[] goodImages, ImageVector[] badImages) { type = "KNN & SVM"; svm = new SVM_Matlab(path, sigma, gamma, (SVM_Matlab.Kernel)kernel, goodImages, badImages); knn = new KNN_Matlab(path, k, goodImages, badImages); totalImages = 0; this.goodImages = goodImages; this.badImages = badImages; learnedTrue = new bool[goodImages.Length]; learnedFalse = new bool[badImages.Length]; restartTest(); userPath = path + "\\KNN_SVM"; resultPath = userPath + "\\sigma_" + sigma + "_gamma_" + gamma; learn = GetLearnCommand(userPath, sigma, gamma, kernel); decideSVM = GetDecideCommandSVM(userPath, kernel); decideKNN = GetDecideCommandKNN(userPath, k); matlab = new MLApp.MLApp(); cd = "cd " + smartAlbum.getMatlabDirectory(); matlab.Execute(cd); }
public bool Learn() { // Get list of files in folders string[] filesAll = Testing.GetFilesFromDirectory(decidePath).ToArray(); if (filesAll.Length <= 0) return false; ImageVector[] allImages; extractAlbum(out allImages, filesAll, false); //allImages = Internal_GetImages(filesAll); //ImageVector[] ImagesLearnedTrue = Internal_GetImages(learnedTrue); //ImageVector[] ImagesLearnedFalse = Internal_GetImages(learnedFalse); learningAlgoSvm = new SVM_Matlab(userPath, 1, 1, SVM_Matlab.Kernel.SVM_POLY, allImages); learningAlgoSvm.Learn(subset, isImageGood); return true; }