Example #1
0
        public void LarningOnSingleInput(Matrix <double> input, double radius)
        {
            var bestIndex           = _network.GetIndexOfTheMostMatchesNeuron(input);
            var candidateToLearning = _network.GetCandidatesToLearning(bestIndex, radius);

            candidateToLearning.ForEach(x => TeachCandidate(x, input, radius));
        }
Example #2
0
        public override int Run(string[] remainingArguments)
        {
            InitializeArgumentsFromConfinIfItIsNecessary();

            var inputs = _dataLoader.LoadCoordinates(_fileName);

            var normalizedInputs = inputs.Select(_matrixHelpers.Normalize).ToList();

            var maxInputOne = normalizedInputs.Select(x => x.At(0, 0)).Max();

            var maxInputTwo = normalizedInputs.Select(x => x.At(0, 1)).Max();

            var network = new SOMNet(maxInputOne, maxInputTwo, inputs.Count);

            var rmax = 4;

            //var neighborhoodFunction = new Guassian();
            var neighborhoodFunction = new Guassian();

            var teacher = new Teacher(network, neighborhoodFunction, rmax);

            teacher.Learn(normalizedInputs);

            var order = new List <int>();

            foreach (var input in inputs)
            {
                order.Add(network.GetIndexOfTheMostMatchesNeuron(input));
            }

            var saver = new DataSaver();

            saver.SaveWeights(network);
            saver.SaveNormalizedInputs(normalizedInputs);
            saver.SaveOrder(order);

            if (shouldVisual)
            {
                var orderlinesses = inputs.Select((x, i) => new Orderliness(order[i], x)).ToList();

                var bm = _visualizer.Visualize(orderlinesses);

                bm.Save(ConfigurationManager.AppSettings["Visualization"]);
            }

            return(0);
        }