예제 #1
0
파일: TAN.cs 프로젝트: skn123/iFourmi
        public iFourmi.DataMining.Model.IClassifier CreateClassifier()
        {
            Solution <Edge>           solution    = new Solution <Edge>();
            CyclicRelationInvalidator invalidator = new CyclicRelationInvalidator();

            invalidator.MaxDependencies = 1;

            ConstructionGraph <Edge> constructionGraph = ConstructionGraphBuilder.BuildBNConstructionGraph(this._trainingset.Metadata);
            CMICalculator            cmiCalculator     = new CMICalculator();

            cmiCalculator.Dataset = this._trainingset;

            constructionGraph.SetHeuristicValues(cmiCalculator, false);
            List <DecisionComponent <Edge> > components = constructionGraph.Components.OrderByDescending(e => e.Heuristic).ToList();

            while (components.Count != 0)
            {
                DecisionComponent <Edge> component = components[0];
                solution.Components.Add(component);
                invalidator.Invalidate(component, solution, constructionGraph);
                components = constructionGraph.Components.Where(e => e.IsValid).OrderByDescending(e => e.Heuristic).ToList();
            }


            BayesianNetworkClassifier BNClassifier = new BayesianNetworks.Model.BayesianNetworkClassifier(this._trainingset.Metadata, solution.ToList());

            BNClassifier.LearnParameters(this._trainingset);
            return(BNClassifier);
        }
예제 #2
0
파일: ACOB.cs 프로젝트: skn123/iFourmi
 public ACOB(int maxIterations, int colonySize, int convergenceIterations, Problem <Edge> problem, int maxDependencies, Dataset trainingset)
     : base(maxIterations, colonySize, convergenceIterations, ConstructionGraphBuilder.BuildBNConstructionGraph(trainingset.Metadata), problem)
 {
     this._trainingSet             = trainingset;
     this._dependencies            = maxDependencies;
     this._dependenciesProbability = new double[maxDependencies];
 }
예제 #3
0
파일: ABCMiner.cs 프로젝트: skn123/iFourmi
        public override void Initialize()
        {
            List <VariableTypeAssignment> variableTypes = new List <VariableTypeAssignment>();

            foreach (DataMining.Data.Attribute attribute in this._trainingSet.Metadata.Attributes)
            {
                variableTypes.Add(new VariableTypeAssignment(attribute.Index, VariableType.Effect));
            }
            this.SetInputVariableTypes(variableTypes);

            ((BayesianClassificationQualityEvaluator)this._problem.SolutionQualityEvaluator).ValidationSet = this._trainingSet;
            ((CMICalculator)this.Problem.HeuristicsCalculator).Dataset = this._trainingSet;
            this._graph = ConstructionGraphBuilder.BuildBNConstructionGraph(_trainingSet.Metadata);
            base.Initialize();
            for (int index = 0; index < this._dependenciesProbability.Length; index++)
            {
                this._dependenciesProbability[index] = 1 / (double)this._dependenciesProbability.Length;
            }
        }