Esempio n. 1
0
        public WTAMLModel GetDataFromFiles()
        {
            var result = new WTAMLModel();

            result.Neurons    = GetNeurons();
            result.Iterations = GetIterationData();
            return(result);
        }
Esempio n. 2
0
        private WTAMLModel GetNewWeight(WTAMLModel data, WinningNeuronModel winningNeuron, List <double> iteration)
        {
            var weight = data.Neurons.Find(p => p.Id == winningNeuron.Id).InputsWeight.ToList();

            for (int i = 0; i < weight.Count(); i++)
            {
                weight[i] = Math.Round(weight[i] + (0.5 * (iteration[i] - weight[i])), 3);
            }
            data.Neurons.Find(p => p.Id == winningNeuron.Id).InputsWeight = weight;
            return(data);
        }
Esempio n. 3
0
        public void Calc(WTAMLModel data)
        {
            _outputService.InitInformation(data.Neurons);
            for (var it = 0; it < data.Iterations.Count; it++)
            {
                var iteration = data.Iterations[it];

                _outputService.WriteIterationData(iteration, it + 1);

                WinningNeuronModel winningNeuron = this.winningNeuron(data.Neurons, iteration);

                _outputService.WriteWinningNeuron(winningNeuron.Id + 1);

                data = GetNewWeight(data, winningNeuron, iteration);

                _outputService.WriteNeuronState(data.Neurons);
            }
            ;
        }
        public void WTA_Generate()
        {
            WTAMLModel data = _MLDataService.GetMLData(MLDataService.MLRepos.Lab1);

            _networkService.Calc(data);
        }