public static BayesianNetworkClassifier CreateABCMinerPlusIClassifier(int seed, int iterations, int colonySize, int localColonySize, int convergence, int maxParents, Dataset trainingSet, DataMining.ClassificationMeasures.IClassificationQualityMeasure measure, bool performLocalSearch, bool fireEvents) { DataMining.Utilities.RandomUtility.Initialize(seed); VariableTypeAssigmentInvalidator invalidator1 = new VariableTypeAssigmentInvalidator(); BayesianClassificationQualityEvaluator evaluator = new BayesianClassificationQualityEvaluator(measure); SimpleVariableTypeAssignmentLocalSearch localSearch1 = new SimpleVariableTypeAssignmentLocalSearch(evaluator); DefaultHeuristicCalculator <VariableTypeAssignment> calculator1 = new DefaultHeuristicCalculator <VariableTypeAssignment>(); Problem <VariableTypeAssignment> problem1 = new Problem <VariableTypeAssignment>(invalidator1, calculator1, evaluator, localSearch1); CyclicRelationInvalidator invalidator2 = new CyclicRelationInvalidator(); BackwardRemovalLocalSearch localSearch2 = new BackwardRemovalLocalSearch(evaluator); CMICalculator calculator = new CMICalculator(); Problem <Edge> problem2 = new Problem <Edge>(invalidator2, calculator, evaluator, localSearch2); ABCMinerPlusI abcMinerPlusI = new ABCMinerPlusI(iterations, colonySize, localColonySize, convergence, problem2, problem1, maxParents, trainingSet, performLocalSearch); if (fireEvents) { abcMinerPlusI.ABCAlgorithm.OnPostAntSolutionContruction += new EventHandler(abclassifier_OnPostAntSolutionContruction); abcMinerPlusI.ABCAlgorithm.OnPostColonyIteration += new EventHandler(abclassifier_OnPostColonyIteration); abcMinerPlusI.ABCMinerAlgorithm.OnPostAntSolutionContruction += new EventHandler(abclassifier_OnPostAntSolutionContruction); abcMinerPlusI.ABCMinerAlgorithm.OnPostColonyIteration += new EventHandler(abclassifier_OnPostColonyIteration); } BayesianNetworks.Model.BayesianNetworkClassifier bnclassifier = abcMinerPlusI.CreateClassifier() as BayesianNetworkClassifier; return(bnclassifier); }
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); }