/// <summary> /// Ининциализация обученияю /// </summary> /// <param name="data">Данные.</param> private void Initialize(List <double> data, int countOfLayerNeurons) { _dataSets = new Dictionary <int, List <double> >(); // TODO: Создание датасетов. var countOfRepeats = data.Count - TrainingConstants.COUNT_OF_VALUES; for (var repeat = 0; repeat < countOfRepeats; ++repeat) { var currentData = data.GetRange(repeat, TrainingConstants.COUNT_OF_VALUES); var currentValues = new List <double>(); for (var index = 0; index < currentData.Count; ++index) { var nextIndex = index + 1; if (nextIndex.Equals(currentData.Count)) { continue; } var value = currentData[nextIndex] - currentData[index]; currentValues.Add(MathFunctionsHelper.HTanFunction(value)); } _dataSets.Add(repeat, currentValues); var lastDayValue = data[repeat + TrainingConstants.COUNT_OF_VALUES]; var lastCurrentValue = currentData.Last(); var result = MathFunctionsHelper.HTanFunction(lastDayValue - lastCurrentValue); _idealResults.Add(result); } _configuration.IterationsInEpochCount = _idealResults.Count; _configuration.IdealResult = _idealResults[0]; var hiddenLayer = new HiddenLayer(_dataSets[0], countOfLayerNeurons); hiddenLayer.Initialize(); var outputLyer = new OutputLayer(hiddenLayer.GetData()); outputLyer.Initialize(); _layers = new List <Layer> { hiddenLayer, outputLyer }; }
/// <summary> /// Нормализация входных данных. /// </summary> /// <param name="inputData">Входные данные.</param> private void NormilizeData(List <double> inputData) { _data = new List <double>(); for (var index = 0; index < inputData.Count; ++index) { var nextIndex = index + 1; if (nextIndex.Equals(inputData.Count)) { continue; } var value = inputData[nextIndex] - inputData[index]; _data.Add(MathFunctionsHelper.HTanFunction(value)); } }