Exemplo n.º 1
0
 private static void hcblassifier_OnPostEvaluation(object sender, EventArgs e)
 {
     if (sender is GHC)
     {
         GHC classifier = sender as GHC;
         Console.WriteLine("Counter: " + classifier.EvaluationsCounter.ToString());
     }
     else
     {
         K2Algorithm classifier = sender as K2Algorithm;
         Console.WriteLine("Counter: " + classifier.EvaluationsCounter.ToString());
     }
 }
Exemplo n.º 2
0
 static void hcblassifier_OnProgress(object sender, EventArgs e)
 {
     if (sender is GHC)
     {
         GHC classifier = sender as GHC;
         Console.WriteLine("-----------------------------------");
         Console.WriteLine("Quality: " + classifier.BestSolution.Quality);
         Console.WriteLine("-----------------------------------");
     }
     else
     {
         K2Algorithm classifier = sender as K2Algorithm;
         Console.WriteLine("-----------------------------------");
         Console.WriteLine("Quality: " + classifier.BestSolution.Quality);
         Console.WriteLine("-----------------------------------");
     }
 }
Exemplo n.º 3
0
        public static BayesianNetworkClassifier CreateK2BayesianClassifier(int maxDependencies, int maxEvaluations, Dataset trainingSet, bool fireEvents)
        {
            CyclicRelationInvalidator invalidator = new CyclicRelationInvalidator();

            invalidator.MaxDependencies = maxDependencies;


            Problem <Edge> problem = new Problem <Edge>(invalidator, null, null, null);

            K2Algorithm k2blassifier = new K2Algorithm(0, 0, 0, problem, maxEvaluations, trainingSet, trainingSet);


            if (fireEvents)
            {
                k2blassifier.OnPostEvaluation += new EventHandler(hcblassifier_OnPostEvaluation);
                k2blassifier.OnProgress       += new EventHandler(hcblassifier_OnProgress);
            }


            k2blassifier.Work();

            BayesianNetworks.Model.BayesianNetworkClassifier bnclassifier = k2blassifier.BayesianNetworkClassifier;
            return(bnclassifier);
        }