Пример #1
0
        public SOMColors()
        {
            InitializeComponent();

            network = CreateNetwork();
            gaussian = new NeighborhoodRBF(RBFEnum.Gaussian, WIDTH, HEIGHT);
            train = new BasicTrainSOM(network, 0.01, null, gaussian);

            train.ForceWinner = false;
            samples = AIFH.Alloc2D<double>(15, 3);
            
            for (int i = 0; i < 15; i++)
            {
                samples[i][0] = rnd.NextDouble(-1, 1);
                samples[i][1] = rnd.NextDouble(-1, 1);
                samples[i][2] = rnd.NextDouble(-1, 1);
            }

            train.SetAutoDecay(100, 0.8, 0.003, 30, 5);
        }
        public SOMColors()
        {
            InitializeComponent();

            network = CreateNetwork();
            gaussian = new NeighborhoodRBF(RBFEnum.Gaussian, WIDTH, HEIGHT);
            train = new BasicTrainSOM(network, 0.01, null, gaussian);

            train.ForceWinner = false;

            samples = new List<IMLData>();
            for (int i = 0; i < 15; i++)
            {
                IMLData data = new BasicMLData(3);
                data.Data[0] = RangeRandomizer.Randomize(-1, 1);
                data.Data[1] = RangeRandomizer.Randomize(-1, 1);
                data.Data[2] = RangeRandomizer.Randomize(-1, 1);
                samples.Add(data);
            }

            train.SetAutoDecay(100, 0.8, 0.003, 30, 5);
        }
Пример #3
0
 public BasicTrainSOM(SOMNetwork network, double learningRate, IMLDataSet training, INeighborhoodFunction neighborhood)
     : base(TrainingImplementationType.Iterative)
 {
     this._x3d0ce91dbd8e0b1b = neighborhood;
     while (true)
     {
         this.Training = training;
         while (0 == 0)
         {
             this._x9b481c22b6706459 = learningRate;
             this._x87a7fc6a72741c2e = network;
             this._x57202a8751db8895 = network.InputCount;
             this._x0c37ff3adde9bc44 = network.OutputCount;
             this._xf7c1f63ae5cd87f7 = false;
             this.Error = 0.0;
             this._x42cc0dadfb982948 = new Matrix(this._x57202a8751db8895, this._x0c37ff3adde9bc44);
             this._x703660d5c67ed8fb = new BestMatchingUnit(network);
             if (0 == 0)
             {
                 return;
             }
         }
     }
 }
        /// <summary>
        /// Create an instance of competitive training.
        /// </summary>
        /// <param name="network">The network to train.</param>
        /// <param name="learningRate">The learning rate, how much to apply per iteration.</param>
        /// <param name="training">The training set (unsupervised).</param>
        /// <param name="neighborhood">The neighborhood function to use.</param>
        public CompetitiveTraining(BasicNetwork network,
                 double learningRate, INeuralDataSet training,
                 INeighborhoodFunction neighborhood)
        {
            this.neighborhood = neighborhood;
            Training = training;
            this.LearningRate = learningRate;
            this.network = network;
            this.inputLayer = network.GetLayer(BasicNetwork.TAG_INPUT);
            this.outputLayer = network.GetLayer(BasicNetwork.TAG_OUTPUT);
            this.synapses = network.Structure.GetPreviousSynapses(
                    this.outputLayer);
            this.inputNeuronCount = this.inputLayer.NeuronCount;
            this.outputNeuronCount = this.outputLayer.NeuronCount;
            this.ForceWinner = false;
            Error = 0;

            // setup the correction matrix
            foreach (ISynapse synapse in this.synapses)
            {
                Matrix matrix = new Matrix(synapse.WeightMatrix.Rows,
                       synapse.WeightMatrix.Cols);
                this.correctionMatrix[synapse] = matrix;
            }

            // create the BMU class
            this.bmuUtil = new BestMatchingUnit(this);
        }
Пример #5
0
        /// <summary>
        /// Create an instance of competitive training.
        /// </summary>
        /// <param name="network">The network to train.</param>
        /// <param name="learningRate">The learning rate, how much to apply per iteration.</param>
        /// <param name="training">The training set (unsupervised).</param>
        /// <param name="neighborhood">The neighborhood function to use.</param>
        public BasicTrainSOM(SOMNetwork network, double learningRate,
                             IMLDataSet training, INeighborhoodFunction neighborhood)
            : base(TrainingImplementationType.Iterative)
        {
            _neighborhood = neighborhood;
            Training = training;
            LearningRate = learningRate;
            _network = network;
            _inputNeuronCount = network.InputCount;
            _outputNeuronCount = network.OutputCount;
            ForceWinner = false;

            // setup the correction matrix
            _correctionMatrix = new Matrix(_outputNeuronCount, _inputNeuronCount);

            // create the BMU class
            _bmuUtil = new BestMatchingUnit(network);
        }
Пример #6
0
        /// <summary>
        ///     Create an instance of competitive training.
        /// </summary>
        /// <param name="network">The network to train.</param>
        /// <param name="learningRate">The learning rate, how much to apply per iteration.</param>
        /// <param name="training">The training set (unsupervised).</param>
        /// <param name="neighborhood">The neighborhood function to use.</param>
        public BasicTrainSOM(SelfOrganizingMap network, double learningRate,
            IList<BasicData> training, INeighborhoodFunction neighborhood)
        {
            _neighborhood = neighborhood;
            _training = training;
            LearningRate = learningRate;
            _network = network;
            _inputNeuronCount = network.InputCount;
            _outputNeuronCount = network.OutputCount;
            ForceWinner = false;
            _error = 0;

            // setup the correction matrix
            _correctionMatrix = DenseMatrix.Create(_outputNeuronCount, _inputNeuronCount, 0);

            // create the BMU class
            _bmuUtil = new BestMatchingUnit(network);
        }