Пример #1
0
        public void getInputDataToPredictSeries(DateTime date, double[] input, List<double[]> predictHistory, double airPollutionLevel)
        {
            SmartCityEntities _dbo = new SmartCityEntities();

            var tempinput = (from a in _dbo.fc_PreditInput(date, "Kathmandu")
                             select new WeatherSamples
                             {
                                 date = a.MeaureDate,
                                 station = a.Station,
                                 airPollutionLevel = a.AirPolutionLevel,
                                 rainfall = a.RainFall,
                                 maxTemp = a.MaxTemp,
                                 minTemp = a.MinTemp
                             }).ToList();

            foreach (double[] predict in predictHistory)
            {

                tempinput.RemoveAt(0);
                tempinput.Add(new WeatherSamples
               {
                   date = tempinput[8].date.AddDays(+1),
                   station = tempinput[8].station,
                   airPollutionLevel = airPollutionLevel,
                   rainfall = predict[2],
                   maxTemp = predict[1],
                   minTemp = predict[0]
               });

            }

            for (int i = 0; i < this.inputSize; i++)
            {
                WeatherSamples sample = (WeatherSamples)tempinput[i];
                input[i] = sample.airPollutionLevel;
                input[i + this.inputSize] = sample.minTemp;
                input[i + this.inputSize * 2] = sample.maxTemp;
                input[i + this.inputSize * 3] = sample.rainfall;
            }
        }
Пример #2
0
        //retutn inputset for prediction.
        public void getInputDataToPredict(DateTime date, double[] input)
        {
            SmartCityEntities _dbo = new SmartCityEntities();

            var tempinput = (from a in _dbo.fc_PreditInput(date, "Kathmandu")
                             select new WeatherSamples
                                    {
                                        date = a.MeaureDate,
                                        station = a.Station,
                                        airPollutionLevel = a.AirPolutionLevel,
                                        rainfall = a.RainFall,
                                        maxTemp = a.MaxTemp,
                                        minTemp = a.MinTemp
                                    }).ToList();

            for (int i = 0; i < this.inputSize; i++)
            {
                WeatherSamples sample = (WeatherSamples)tempinput[i];
                input[i] = sample.airPollutionLevel;
                input[i + this.inputSize] = sample.minTemp;
                input[i + this.inputSize * 2] = sample.maxTemp;
                input[i + this.inputSize * 3] = sample.rainfall;
            }
        }