public void Initialize(IGenomeDecoder<NeatGenome, IBlackBox> genomeDecoder, IMapClusteringDataset dataset, MapClusteringEvaluator evaluator, int nbClusters)
        {
            this.dataset = dataset;
            this.nbClusters = nbClusters;
            this.decoder = genomeDecoder;
            this.evaluator = evaluator;

            samples = dataset.GetSamplesMatrix();
            outputs = new double[nbClusters, samples.GetLength(1), samples.GetLength(2)];
            this.nbInputs = samples.GetLength(0);

            maxValue = 0.0;
            for (var i = 0; i < samples.GetLength(0); i++)
            {
                for (var j = 0; j < samples.GetLength(1); j++)
                {
                    for (var k = 0; k < samples.GetLength(2); k++)
                    {
                        var value = samples[i, j, k];
                        if (value > maxValue) maxValue = value;
                    }
                }
            }
            maxValue *= 2; // margin
        }
        public void Initialize(IGenomeDecoder <NeatGenome, IBlackBox> genomeDecoder, IMapClusteringDataset dataset, MapClusteringEvaluator evaluator, int nbClusters)
        {
            this.dataset    = dataset;
            this.nbClusters = nbClusters;
            this.decoder    = genomeDecoder;
            this.evaluator  = evaluator;

            samples       = dataset.GetSamplesMatrix();
            outputs       = new double[nbClusters, samples.GetLength(1), samples.GetLength(2)];
            this.nbInputs = samples.GetLength(0);

            maxValue = 0.0;
            for (var i = 0; i < samples.GetLength(0); i++)
            {
                for (var j = 0; j < samples.GetLength(1); j++)
                {
                    for (var k = 0; k < samples.GetLength(2); k++)
                    {
                        var value = samples[i, j, k];
                        if (value > maxValue)
                        {
                            maxValue = value;
                        }
                    }
                }
            }
            maxValue *= 2; // margin
        }
        public MapClusteringView(IGenomeDecoder <NeatGenome, IBlackBox> genomeDecoder,
                                 IMapClusteringDataset dataset,
                                 MapClusteringEvaluator evaluator,
                                 int nbClusters)
            : this()
        {
            this.dataset    = dataset;
            this.nbClusters = nbClusters;
            this.decoder    = genomeDecoder;
            this.evaluator  = evaluator;

            samples = dataset.GetSamplesMatrix();
            outputs = new double[nbClusters, samples.GetLength(1), samples.GetLength(2)];

            inputView.LabelName  = "Input";
            outputView.LabelName = "Output";

            inputView.SetDimensions(samples.GetLength(0), samples.GetLength(1), samples.GetLength(2));
            outputView.SetDimensions(nbClusters, samples.GetLength(1), samples.GetLength(2));

            maxValue = 0.0;
            minValue = double.PositiveInfinity;
            for (var i = 0; i < samples.GetLength(0); i++)
            {
                for (var j = 0; j < samples.GetLength(1); j++)
                {
                    for (var k = 0; k < samples.GetLength(2); k++)
                    {
                        var value = samples[i, j, k];
                        if (value > maxValue)
                        {
                            maxValue = value;
                        }
                        if (value < minValue)
                        {
                            minValue = value;
                        }
                    }
                }
            }
            // Add some margin
            maxValue *= 2;
            minValue *= 2;

            inputView.OnClusterChanged += (id) =>
            {
                currentInputIdx = id;
                RefreshInput();
            };
            outputView.OnClusterChanged += (id) =>
            {
                currentClusterIdx = id;
                RefreshOutput();
            };

            RefreshInput();
        }
        public override void Initialize(string name, XmlElement xmlConfig)
        {
            base.Initialize(name, xmlConfig);

            _dataset = CreateDataset();
            _dataset.LoadFromFile(DatasetFileName);

            samples = _dataset.GetSamplesMatrix();

            nbInputs = _dataset.InputCount;
            n = samples.GetLength(1);
            m = samples.GetLength(2);
        }
Exemple #5
0
        public override void Initialize(string name, XmlElement xmlConfig)
        {
            base.Initialize(name, xmlConfig);

            _dataset = CreateDataset();
            _dataset.LoadFromFile(DatasetFileName);

            samples = _dataset.GetSamplesMatrix();

            nbInputs = _dataset.InputCount;
            n        = samples.GetLength(1);
            m        = samples.GetLength(2);
        }
        public MapClusteringView(IGenomeDecoder<NeatGenome, IBlackBox> genomeDecoder,
                                IMapClusteringDataset dataset,
                                MapClusteringEvaluator evaluator,
                                int nbClusters)
            : this()
        {
            this.dataset = dataset;
            this.nbClusters = nbClusters;
            this.decoder = genomeDecoder;
            this.evaluator = evaluator;

            samples = dataset.GetSamplesMatrix();
            outputs = new double[nbClusters, samples.GetLength(1), samples.GetLength(2)];

            inputView.LabelName = "Input";
            outputView.LabelName = "Output";

            inputView.SetDimensions(samples.GetLength(0), samples.GetLength(1), samples.GetLength(2));
            outputView.SetDimensions(nbClusters, samples.GetLength(1), samples.GetLength(2));

            maxValue = 0.0;
            minValue = double.PositiveInfinity;
            for (var i = 0; i < samples.GetLength(0); i++)
            {
                for (var j = 0; j < samples.GetLength(1); j++)
                {
                    for (var k = 0; k < samples.GetLength(2); k++)
                    {
                        var value = samples[i, j, k];
                        if (value > maxValue) maxValue = value;
                        if (value < minValue) minValue = value;
                    }
                }
            }
            // Add some margin
            maxValue *= 2;
            minValue *= 2;

            inputView.OnClusterChanged += (id) =>
            {
                currentInputIdx = id;
                RefreshInput();
            };
            outputView.OnClusterChanged += (id) =>
            {
                currentClusterIdx = id;
                RefreshOutput();
            };

            RefreshInput();
        }
        public override void Initialize(string name, XmlElement xmlConfig)
        {
            base.Initialize(name, xmlConfig);

            _dataset = CreateDataset();
            _dataset.LoadFromFile(DatasetFileName);

            nbInputs = _dataset.InputCount;
            n = _dataset.InputSamples.Count(sampleRow => sampleRow.Last() == 0);
            m = _dataset.InputSamples.First().Count();
            f = filter.GetLength(0);
            f2 = filter.Length; // f^2
            t = (f - 1) / 2; // filter thickness
        }
        public override void Initialize(string name, XmlElement xmlConfig)
        {
            base.Initialize(name, xmlConfig);

            _dataset = CreateDataset();
            _dataset.LoadFromFile(DatasetFileName);

            nbInputs = _dataset.InputCount;
            n        = _dataset.InputSamples.Count(sampleRow => sampleRow.Last() == 0);
            m        = _dataset.InputSamples.First().Count();
            f        = filter.GetLength(0);
            f2       = filter.Length; // f^2
            t        = (f - 1) / 2;   // filter thickness
        }
        /// <summary>
        /// Construct evaluator with the provided task arguments/variables.
        /// </summary>
        public MapClusteringEvaluator(IMapClusteringDataset dataset, int nbClusters, Phenotype phenotype)
        {
            this.nbClusters = nbClusters;
            this.phenotype = phenotype;

            // Build input layers (samples matrices)
            nbInputs = dataset.InputCount;
            samples = dataset.GetSamplesMatrix();

            // Extract useful values
            n = samples.GetLength(1); // layers width
            m = samples.GetLength(2); // layers height
            nbInputsNN = samples.Length;
            nbOutputsNN = nbClusters * n * m;
        }
        /// <summary>
        /// Construct evaluator with the provided task arguments/variables.
        /// </summary>
        public MapClusteringEvaluator(IMapClusteringDataset dataset, int nbClusters, Phenotype phenotype)
        {
            this.nbClusters = nbClusters;
            this.phenotype  = phenotype;

            // Build input layers (samples matrices)
            nbInputs = dataset.InputCount;
            samples  = dataset.GetSamplesMatrix();

            // Extract useful values
            n           = samples.GetLength(1); // layers width
            m           = samples.GetLength(2); // layers height
            nbInputsNN  = samples.Length;
            nbOutputsNN = nbClusters * n * m;
        }
        /// <summary>
        /// Construct evaluator with the provided task arguments/variables.
        /// </summary>
        public WindowMapClusteringEvaluator(IMapClusteringDataset dataset, int nbClusters, Phenotype phenotype, bool[,] filter)
        {
            this.nbClusters = nbClusters;
            this.phenotype = phenotype;
            this.filter = filter;

            Debug.Assert(filter.GetLength(0) % 2 != 0 && filter.GetLength(1) % 2 != 0);

            // Build input layers (samples matrices)
            nbInputs = dataset.InputCount;
            samples = dataset.GetSamplesMatrix();

            // Extract useful values
            f = filter.GetLength(0); // filter width
            f2 = filter.Length; // f^2
            t = (f - 1) / 2; // filter thickness
            nbInputsNN = nbInputs * f2;
            nbOutputsNN = nbClusters * f2;
            n = samples.GetLength(1); // layers width
            m = samples.GetLength(2); // layers height
        }
        /// <summary>
        /// Construct evaluator with the provided task arguments/variables.
        /// </summary>
        public WindowMapClusteringEvaluator(IMapClusteringDataset dataset, int nbClusters, Phenotype phenotype, bool[,] filter)
        {
            this.nbClusters = nbClusters;
            this.phenotype  = phenotype;
            this.filter     = filter;

            Debug.Assert(filter.GetLength(0) % 2 != 0 && filter.GetLength(1) % 2 != 0);

            // Build input layers (samples matrices)
            nbInputs = dataset.InputCount;
            samples  = dataset.GetSamplesMatrix();

            // Extract useful values
            f           = filter.GetLength(0); // filter width
            f2          = filter.Length;       // f^2
            t           = (f - 1) / 2;         // filter thickness
            nbInputsNN  = nbInputs * f2;
            nbOutputsNN = nbClusters * f2;
            n           = samples.GetLength(1); // layers width
            m           = samples.GetLength(2); // layers height
        }
 public MapClusteringScatterPlotView(IGenomeDecoder <NeatGenome, IBlackBox> genomeDecoder, IMapClusteringDataset dataset, MapClusteringEvaluator evaluator, int nbClusters)
     : this()
 {
     Initialize(genomeDecoder, dataset, evaluator, nbClusters);
 }
 public MapClusteringScatterPlotView(IGenomeDecoder<NeatGenome, IBlackBox> genomeDecoder, IMapClusteringDataset dataset, MapClusteringEvaluator evaluator, int nbClusters)
     : this()
 {
     Initialize(genomeDecoder, dataset, evaluator, nbClusters);
 }