Zing Forum

Reading

Bike-sharing Demand Forecasting Based on Deep Neural Networks: A Complete Practice from Feature Engineering to Model Optimization

A master's course project in Statistics at the University of Geneva, Switzerland, using 15,211 hourly observation data points, achieved a Kaggle MAE of 35.75 through cyclic encoding, multi-model comparison, and deep neural networks.

共享单车需求预测深度神经网络特征工程循环编码机器学习时间序列Kaggle
Published 2026-04-29 15:15Recent activity 2026-04-29 15:19Estimated read 6 min
Bike-sharing Demand Forecasting Based on Deep Neural Networks: A Complete Practice from Feature Engineering to Model Optimization
1

Section 01

Introduction: Practice of Bike-sharing Demand Forecasting Based on Deep Neural Networks

This article introduces a master's course project in Statistics at the University of Geneva, Switzerland. Addressing the bike-sharing demand forecasting problem, it uses 15,211 hourly observation data points and achieves high-precision prediction with a Kaggle MAE of 35.75 through cyclic encoding, multi-model comparison, and deep neural network optimization. The project covers the complete process from feature engineering to model design, providing a reference for related practices.

2

Section 02

Project Background and Data Overview

This project is based on a Kaggle competition dataset, containing 15,211 hourly bike rental records from 2011 to 2012. Data features are divided into three categories: time features (season, year, hour, etc.), meteorological features (temperature, humidity, wind speed, etc.), and the target variable (total hourly rentals). The data spans a period of business growth, requiring capture of both periodic patterns and annual growth trends.

3

Section 03

Data Preprocessing and Feature Selection Strategy

In the preprocessing phase, differentiated handling is applied to missing values: forward filling for categorical/time variables, and k-nearest neighbor interpolation for numerical variables. In feature selection, redundant variables Id and dteday (date information is covered by other time features) are removed, and the apparent temperature (atemp) is excluded (its correlation coefficient with temperature (temp) is 0.99, avoiding multicollinearity).

4

Section 04

Cyclic Encoding: Capturing the Periodic Nature of Time

Traditional encoding cannot express the cyclic nature of time (e.g., the proximity between 23:00 and 00:00). The project uses sine/cosine cyclic encoding to process hours, weeks, and months. Taking hours as an example: hr_sin = sin(2π × hr/24), hr_cos = cos(2π × hr/24), which makes adjacent time points closer in the feature space and effectively captures the morning and evening peak patterns.

5

Section 05

Multi-model Comparison: Performance and Result Analysis

The team systematically compared seven machine learning models, with the following performance:

Model Test Set MAE Kaggle MAE
Linear Regression 91.09
Lasso Regression 91.31
Decision Tree (depth=5) 63.76
Random Forest 25.40 54.37
Gradient Boosting 24.65 43.32
Support Vector Regression (RBF Kernel) 43.19 65.85
Deep Neural Network 24.39 35.75

The results show that traditional linear models have large errors, tree models and ensemble methods improve performance, and the deep neural network takes the lead with a Kaggle MAE of 35.75, reducing the error by 17.5% compared to the second-best gradient boosting model.

6

Section 06

Deep Neural Network Architecture Design

The optimal DNN uses a three-layer fully connected structure (256→128→64 neurons). After each hidden layer, LeakyReLU activation, batch normalization, and 0.2 dropout are applied in sequence to prevent overfitting. The output layer is a single neuron for regression prediction. Training uses early stopping and learning rate decay strategies, and the architecture is determined through 5-fold cross-validation.

7

Section 07

Key Findings and Business Operation Insights

Data analysis reveals: On workdays, demand shows a bimodal pattern of morning and evening peaks; on weekends, it shows a unimodal pattern in the afternoon. Temperature is positively correlated with rental volume (correlation coefficient 0.44); demand increased significantly in 2012. These findings suggest that operators should pay attention to weather-based scheduling, peak-hour preparation, and trend changes.

8

Section 08

Summary and Project Insights

The key to the project's success lies in refined feature engineering (e.g., cyclic encoding), systematic model comparison, and a reasonable DNN architecture. For learners, it is a reference case for problem decomposition and iterative optimization in data science projects. The project code has been open-sourced on GitHub, including the complete process and technical report.