Пример #1
0
        public static BayesianNetworkClassifier CreateABCClassifier(int seed, int iterations, int colonySize, int convergence, Dataset trainingSet, DataMining.ClassificationMeasures.IClassificationQualityMeasure measure, bool performLocalSearch, bool fireEvents)
        {
            DataMining.Utilities.RandomUtility.Initialize(seed);

            VariableTypeAssigmentInvalidator       invalidator             = new VariableTypeAssigmentInvalidator();
            BayesianClassificationQualityEvaluator evaluator               = new BayesianClassificationQualityEvaluator(measure);
            VariableTypeAssignmentLocalSearch      localSearch             = new VariableTypeAssignmentLocalSearch(evaluator);
            DefaultHeuristicCalculator <VariableTypeAssignment> calculator = new DefaultHeuristicCalculator <VariableTypeAssignment>();
            Problem <VariableTypeAssignment> problem = new Problem <VariableTypeAssignment>(invalidator, calculator, evaluator, localSearch);

            ABC abc = new ABC(iterations, colonySize, convergence, problem, trainingSet, performLocalSearch);


            if (fireEvents)
            {
                abc.OnPostAntSolutionContruction += new EventHandler(abclassifier_OnPostAntSolutionContruction);
                abc.OnPostColonyIteration        += new EventHandler(abclassifier_OnPostColonyIteration);
            }


            BayesianNetworks.Model.BayesianNetworkClassifier bnclassifier = abc.CreateClassifier() as BayesianNetworkClassifier;
            return(bnclassifier);
        }