Ejemplo n.º 1
0
        /// <summary>
        /// Provides the data set.
        /// </summary>
        /// <returns>IDataSet.</returns>
        public IRgbDataSet ProvideDataSet()
        {
            var colors = new Color[_size];

            for (int i = 0; i < _size; ++i)
            {
                var r = (int)_generator.GetDouble(0, 255);
                var g = (int)_generator.GetDouble(0, 255);
                var b = (int)_generator.GetDouble(0, 255);
                colors[i] = Color.FromArgb(r, g, b);
            }
            return(new RgbDataSet(colors));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Picks a random datum from the data.
        /// </summary>
        /// <param name="generator">The generator.</param>
        /// <returns>IDatum.</returns>
        public IDatum PickRandom(IRandomNumber generator)
        {
            var size  = _colors.Length;
            var index = (int)Math.Round(generator.GetDouble(0, size - 1));
            var color = _colors[index];

            return(new ColorDatum(color));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Provides the data set.
        /// </summary>
        /// <returns>IDataSet.</returns>
        public IRgbDataSet ProvideDataSet()
        {
            var discreteColors = new List <Color>(_discreteColors);
            var size           = Math.Min(_size, discreteColors.Count);
            var colors         = new Color[size];

            for (int i = 0; i < size; ++i)
            {
                var index = (int)Math.Round(_generator.GetDouble(0, discreteColors.Count - 1));
                colors[i] = discreteColors[index];
                discreteColors.RemoveAt(index);
            }

            return(new RgbDataSet(colors));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates the random.
        /// </summary>
        /// <param name="generator">The generator.</param>
        /// <returns>INeuron.</returns>
        public INeuron CreateRandom(IRandomNumber generator)
        {
            var dimensions = _dimensions;

            // create weights
            var weigths = new WeightVector(dimensions);

            for (int i = 0; i < dimensions; ++i)
            {
                weigths[i] = generator.GetDouble(0, 1);
            }

            // create neuron
            var neuron = new Kohonen.Neuron.Neuron(weigths);

            return(neuron);
        }