Esempio n. 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);
        }
Esempio n. 2
0
        public void CreateCities()
        {
            double x1, x2, y1, y2;
            double alpha1, alpha2;

            distance = AIFH.Alloc2D <double>(NUM_CITIES, NUM_CITIES);

            for (var n1 = 0; n1 < NUM_CITIES; n1++)
            {
                for (var n2 = 0; n2 < NUM_CITIES; n2++)
                {
                    alpha1           = (double)n1 / NUM_CITIES * 2 * Math.PI;
                    alpha2           = (double)n2 / NUM_CITIES * 2 * Math.PI;
                    x1               = Math.Cos(alpha1);
                    y1               = Math.Sin(alpha1);
                    x2               = Math.Cos(alpha2);
                    y2               = Math.Sin(alpha2);
                    distance[n1][n2] = Math.Sqrt(sqr(x1 - x2) + sqr(y1 - y2));
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Construct the trainer.
 /// </summary>
 /// <param name="theNetwork">The network to train.</param>
 public TrainHopfieldStorkey(HopfieldNetwork theNetwork)
 {
     _network   = theNetwork;
     _sumMatrix = AIFH.Alloc2D <double>(_network.InputCount, _network.InputCount);
 }
Esempio n. 4
0
 /// <summary>
 ///     Construct the layer.
 /// </summary>
 /// <param name="theOwner">The network that owns this layer.</param>
 /// <param name="inputCount">The input count for this layer.</param>
 /// <param name="outputCount">The output count for this layer.</param>
 public DeepLayer(DeepBeliefNetwork theOwner, int inputCount, int outputCount)
 {
     _weights = AIFH.Alloc2D <double>(outputCount, inputCount);
     _bias    = new double[outputCount];
     _owner   = theOwner;
 }