Exemplo n.º 1
0
        public void GenerateJobs(ValidationSuite vs, List<Instance> instances, string notes)
        {
            ValidationJob job;

            int folds = 10, reps = 2;

            job = new ValidationJob();
            job.Validator = new KFoldValidation(instances, folds, reps);
            job.Classifier = new NaiveBayesClassifier();
            job.Notes = notes;

            vs.Jobs.Add(job);
            /*
            for (int k = 1; k <= 4; k++)
            {
                foreach (Metric metric in Enum.GetValues(typeof(Metric)))
                {
                    if (metric == Metric.HammingDistance || metric == Metric.ChebyshevDistance 
                        || metric == Metric.JaccardSimilarity || metric == Metric.DistanceSquared) continue;

                    WeightMode mode = WeightMode.InverseDistance;
                    job = new ValidationJob();
                    job.Validator = new KFoldValidation(instances, folds, reps);
                    job.Classifier = new KNearestClassifier(k, metric, mode);
                    job.Notes = notes;

                    vs.Jobs.Add(job);
                }
            }*/
        }
Exemplo n.º 2
0
        public void RunTests(string method, string inPath, string outPath)
        {
            List<Instance> training;
            ValidationSuite vs = new ValidationSuite();
            string path = inPath;
            string fr = method + ",";

            vs.Notes = "Instances loaded from: " + path;
            vs.Notes += "\nFeature Reduction: " + fr;
            
            int[] ns = new int[] {16, 32, 64, 128, 256, 512, 768, 1024};
            //int[] ns = new int[] { 16, 32, 64, 128, 256, 512 };
            foreach(int n in ns)
            {
                training = LoadInstancesFromBitmaps(path, n, method);
                GenerateJobs(vs, training, fr+" "+n);
            }

            vs.PerformAllJobs();
            vs.SaveToFile(outPath);
            Print(vs.Print());
        }