public WTAMLModel GetDataFromFiles() { var result = new WTAMLModel(); result.Neurons = GetNeurons(); result.Iterations = GetIterationData(); return(result); }
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); }
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); }