Beispiel #1
0
        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);
        }
Beispiel #2
0
 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];
 }
Beispiel #3
0
 public override void Initialize()
 {
     this._graph = ConstructionGraphBuilder.BuildNNConstructionGraph(this.Dataset.Metadata, _hiddenUnitCount);
     this.ConstructionGraph.InitializePheromone(1);
     this.ConstructionGraph.SetHeuristicValues(this._problem.HeuristicsCalculator, false);
     this._bestAnt          = null;
     this._iterationBestAnt = null;
 }
Beispiel #4
0
 public override void Initialize()
 {
     ((BayesianClassificationQualityEvaluator)this._problem.SolutionQualityEvaluator).ValidationSet = this._trainingSet;
     this._graph = ConstructionGraphBuilder.BuildABCConstructionGraph(this._trainingSet.Metadata);
     ((ILocalSearch <VariableTypeAssignment>) this._problem.LocalSearch).ConstructionGraph = this._graph;
     base.Initialize();
     this.ConstructionGraph.InitializePheromone(1);
     this.ConstructionGraph.SetHeuristicValues(this._problem.HeuristicsCalculator, false);
     this._bestAnt          = null;
     this._iterationBestAnt = null;
 }
Beispiel #5
0
        public override void Initialize()
        {
            this._clusteringSolution = new ClusteringSolution(this._dataset, this._clustersNumber, this._similarityMeasure);
            this._graph = ConstructionGraphBuilder.BuildMBClusteringConstructionGraph(this.Dataset, this._clustersNumber);

            ((KMeansLocalSearch)this.Problem.LocalSearch).ClustersNumber  = this._clustersNumber;
            ((KMeansLocalSearch)this.Problem.LocalSearch).ProximityMatrix = this._clusteringSolution.ProximityMatrix;

            ((ClusteringMBInvalidator)this.Problem.ComponentInvalidator).ClustersNumber            = this._clustersNumber;
            ((ClusteringQualityEvaluator)this.Problem.SolutionQualityEvaluator).ClusteringSolution = this._clusteringSolution;
            ((ClusteringQualityEvaluator)((KMeansLocalSearch)this.Problem.LocalSearch).SolutionQualityEvaluator).ClusteringSolution = this._clusteringSolution;


            this.ConstructionGraph.InitializePheromone(1);
            this.ConstructionGraph.SetHeuristicValues(this._problem.HeuristicsCalculator, false);
            this._bestAnt          = null;
            this._iterationBestAnt = null;
        }
Beispiel #6
0
        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;
            }
        }
Beispiel #7
0
        public override void Initialize()
        {
            this._iterationBestAnt = new Ant <ConnectionDC>(0, this);
            this._bestAnt          = new Ant <ConnectionDC>(0, this);

            SetLearningAndValidationSets();

            this._graph = ConstructionGraphBuilder.BuildNNConstructionGraph(this.Dataset.Metadata, _hiddenUnitCount);

            this._solution = new Solution <ConnectionDC>();
            foreach (DecisionComponent <ConnectionDC> component in this.ConstructionGraph.Components)
            {
                if (component.Element.Include)
                {
                    this._solution.Components.Add(component);
                }
            }

            this.EvaluateSolutionQuality(this._solution);
        }