concept weather datum in category deep learning

appears as: weather data, weather data
Deep Learning with Structured Data

This is an excerpt from Manning's book Deep Learning with Structured Data.

Toronto has four distinct seasons with extremes of weather in the winter and summer. These extremes can have an impact on streetcar delays. For example, even a modest snowfall can cause gridlock that delays streetcars across the network. Suppose we wanted to harness weather data to see if it yields better predictions of streetcar delays, where do we start? This section summarizes what you need to do to add weather data to the streetcar delay prediction model.

The first challenge is finding a source for weather data to incorporate in the training dataset. There are several open source data sources for weather information. Figure 9.7 shows the interface for exercising endpoints for once such source, Dark Sky. You will need to provide credentials (for example, your github id and password) to access this interface, and although you get a free allocation of API calls, in order to run a test exercise of the API you will need to provide payment information.

Once you have a trained model that incorporates the weather columns, how do you account for the weather conditions at scoring time when a user wants to know if their streetcar trip will be delayed? First, you add the new weather columns to the score_cols list in the scoring code. This is the list of columns that get scored and it is used to define score_df, the dataframe that contains the values that are run through the pipelines in the scoring code. You can call the Dark Sky API in the scoring code to get the current weather conditions using the Toronto City Hall latitude and longitude noted above and build a string for the current time in the format required by Dark Sky: [YYYY]-[MM]-[DD]T[HH]:[MM]:[SS]. So, if the current date is May 24, 2021 at noon, the date time string for the Dark Sky API is: 2020-05-24T12:00:00. Once you get the required weather fields returned from the API call, you can use these values to set the weather columns in score_df. The scoring code runs score_df through the pipelines, applies the output of the pipelines to the trained model and you get a delay prediction. Because of the simplifying assumptions stated above, you don’t need any information from the user at scoring time to get the weather data needed for scoring.

Figure 9.10 summarizes the changes required to incorporate weather data in the streetcar delay prediction deep learning project using Facebook Messenger deployment. To adapt the web deployment, you would make similar changes to the scoring code in the main Python program for web deployment, flask_server.py, as specified below for actions.py, the main Python program for Facebook Messenger deployment.

Figure 9.10 Summary of changes required to add weather data to the streetcar delay model

This exercise of adding weather data to your deep learning model not only gives you the opportunity to improve the performance of the model. It also shows you the steps you need to take to add other additional data sources to the streetcar delay deep learning model. You can extrapolate from the steps described in this section to creating a deep learning model on an entirely new dataset. Sections 9.6 to 9.8 describe the additional steps you need to take to apply the approach described in this book to an entirely new structured dataset, but before we look at a completely new project, in the next section we are going to look at two simple options to augment the training dataset for the streetcar delay prediction project.

Deep Learning with JavaScript: Neural networks in TensorFlow.js

This is an excerpt from Manning's book Deep Learning with JavaScript: Neural networks in TensorFlow.js.

The data we will use is the Jena-weather-archive dataset. It includes the measurements collected with a variety of meteorological instruments at a location in Jena, Germany, over a course of eight years (between 2009 and 2017). The dataset, which can be downloaded from the Kaggle page (see www.kaggle.com/pankrzysiu/weather-archive-jena), comes in a 42MB CSV file. It consists of 15 columns. The first column is a timestamp, while the remaining columns are weather data such as temperature (T deg(C)), air pressure (p (mbar)), relative humidity (rh (%s)), wind velocity (wv (m/s)), and so on. If you examine the timestamps, you can see that they have a 10-minute spacing, reflecting the fact that the measurements were made every 10 minutes. This is a rich dataset to visualize, explore, and try machine learning on. In the following sections, we will try making weather forecasts using various machine-learning models. In particular, we will predict the temperature of the next day using the weather data from the 10 preceding days. But before we embark on this exciting weather forecasting task, let’s follow the principle of “always look at your data before trying machine learning on it” and see how tfjs-vis can be used to plot the data in a clear and intuitive fashion.