private void RecalculateNeuralNetwork(string query) { if (itemsClickedInSearch == null || !itemsClickedInSearch.ContainsKey(query)) { return; } var offers = _elasticRepository.SearchOffer(query); var neuralItems = GetLeadData(offers, query); if (neuralItems == null) { return; } var neuralTrainingData = GetNeuralTrainingData(neuralItems); if (neuralTrainingData == null || neuralTrainingData.xs.Count() == 0) { return; } // TODO recalculate model and save on the training static dictionary string model = _javascriptExecutor.Fit(query, neuralTrainingData); if (trainedModels.ContainsKey(query)) { trainedModels.Remove(query); } trainedModels.Add(query, model); }