## 3 The Bike-Share Case
### Evaluation--Formulation of Simulation and ML Models
#### 3.4.1 Demand Forecasting
Machine Learning Forecast  
Given that various contextual factors--such as temporal patterns, weather, local events and urban dynamics--affect bike-share demand, predicting it is a complex function of these inputs, making machine learning approaches like RNN ideal. A crucial design decision in the RNN architecture is determining the type of inputs passed to the Dense output layer. The last recurrent layer can either return sequences, passing outputs across all timesteps, or return only the final timestep's output as a vector [55]. As we will explore later, this proved a significant leverage point for improving forecast accuracy in the bike-share case study. **Implementation details. ** The outlier-corrected base demands for rentals and returns served as the primary inputs for training the RNN on the bike-share data. We also downloaded historical weather data for August 2023 from OpenWeather ([[https://openweather.co.uk/about](https://openweather.co.uk/about)]([https://openweather.co.uk/about](https://openweather.co.uk/about)) (accessed on 10 October 2024)) using location details around the nodal station (E 17 St and Broadway). Besides weather, we also experimented with other correlates such as lagged demands (supplying demands with an n-period lag as additional features in the current timestep), demands of nearby stations with symmetric demands and temporal signals. Table 13 in the Appendix A details the data inputs, model architecture, parameters and features we tested and used for the final evaluation. Figure 6: Data pipeline detailing the flow from raw demand and incentive data collection to the processing steps that generate critical input for forecasting models. Weather data had a marginal impact on forecast accuracy, likely due to training on a single month's data. Similarly, nearby station demands and lagged demands showed no significant contribution. After several trials, we settled on using temporal signals and rental demands (to forecast returns and vice versa) as key features. By applying sine and cosine transformations on the time of day and day of the week, we created six features per prediction type (rental or return). Traditional RNNs suffer from memory loss over long sequences due to repeated transformations, which leads to information degradation ([56], pp. 297-300). Given the granular nature of bike-share data (144 periods per day), we used Long Short-Term Memory (LSTM), a type of RNN, for the model architecture, which mitigates this by carrying information across timesteps. Acting like a \"conveyor belt\" ([56], pp. 297-300) that selectively retains or discards memory, LSTM improves accuracy by focusing on relevant data. Another key improvement came from training the network on every timestep (sequence-to-sequence) rather than only the final timestep. A sequence-to-vector approach would output a tensor shaped as (samples, forecast horizon). In a sequence-to-sequence setup, in contrast, each timestep generates a tensor shaped as (samples, timesteps, forecasts horizon). This structure enhances performance, as omitting sequences can reduce accuracy by 40%. With predictions and losses at each timestep, more error gradients flow back, and shorter gradient travel distances (via _Backpropagation Through Time_) reduce information loss, further improving performance. To evaluate the effectiveness of our chosen machine learning approach, we compared the LSTM model's performance with that of naive and exponential smoothing (EXS) methods. The LSTM model demonstrated significant improvements, with an average performance enhancement of approximately 26% for rental forecasts and 25% for return forecasts over EXS. These results underscore LSTM's superior ability to model complex temporal patterns and relationships, contributing to more accurate bike-share demand predictions.