# Learning from Imbalanced Datasets: The Bike-Sharing Inventory Problem Using Sparse Information +
## 1 Introduction  
Bike-sharing systems are one of the most popular and environmentally friendly forms of shared mobility. Traditional sharing systems allow the pickup and drop-off of bikes at fixed stations (or throughout an operational area if the system is free-floating) and have proven to be an effective solution for first-/last-mile mobility [1]. To keep a high quality of service, bike-sharing operators face two major problems, namely, the _optimal inventory problem_ and the _rebalancing problem_[2]. The fact that bike-sharing users can take a bicycle from and return it to any station in the system leads to an imbalanced state, in which some stations are full while others stay empty. This non-homogeneous distribution of bicycles lowers the overall level of service of the system [3]. The _rebalancing problem_ consists in reorganizing the fleet location in time and space tore-establish the optimal level of service [4], an operation that can be performed when the system is shut down or the demand is low (static rebalancing) or while it is running (dynamic rebalancing) [1; 5]. To reduce operational costs generated by rebalancing operations, it is fundamental to know the correct number of bicycles (and available docks if the service is station-based) required to achieve the optimal level of service, i.e., the target inventory values for the rebalancing procedure. This problem is known as the _optimal inventory problem_[6], and since inventory levels depend on user behavior [7], it is extremely challenging. While many rebalancing studies assume that the target inventory level for each station is known, to the best of the authors' knowledge, only a few studies have focused on combining rebalancing with target-level computation. This paper tests specific machine learning (ML) techniques that estimate the inventory level required to address the station-based bike-sharing static rebalancing problem. Specifically, the use of decision tree classifiers--most notably a random forest classifier (RFC) and gradient tree-boosting classifier (GTBC)--is investigated. Due to the vast amount of data publicly available, decision trees have already been used to study bike-sharing systems [8; 9]. However, the majority of machine learning models adopted in the literature (e.g., decision trees but also neural networks and support vector machines) assume the data to be well-balanced. This assumption is not met in the case of the inventory problem [10]. Therefore, in this paper, we propose an _ad hoc_ iterative resampling procedure that allows to accurately predict inventory levels using several features, including historical data, in the case of imbalanced datasets. The main contributions of this paper are summarized below:  
1. The inventory problem is formulated as a classification problem that can be easily solved using decision trees (or any other state-of-the-art classifier);
2. While traditional classifiers over-represent the majority class, this paper presents a novel resampling technique that better leverages data and provides better estimates for rare observations;
3. The proposed algorithm can be used to compute both an upper-bound and a lower-bound value for the bike-sharing inventory problem, thus yielding to different possible configurations;
4. Although mainly based on historical data, the proposed approach can also be used to solve the inventory problem for new stations, for which historical information is not available;
5. The proposed model is easily implementable into an ITS-based decision support system for also supporting bike-sharing companies in a day-to-day framework, thus helping in improving operations. Points 4 and 5, i.e., predictions for new stations and the proposal of a rolling horizon approach to make day-to-day forecasts, are completely new developments with respect to the previous presentation of this work [10]. The method has been applied and validated using the data of the New York City Bike service.