12 minutes read
Table of contents:
Only ⅓ of the working day, taxi drivers do their actual job of transporting people, and the rest of the time, they drive around the city blindly trying to get orders. On the other hand, there are times when so many people order taxis that there're not enough cars on the roads to give them all a ride. Integrating the surge pricing model into the taxi ordering application can minimize these unfavorable situations.
In this article, we will tell you how the Reviro team solved the problem that was slowing NaviTaxi's growth using machine learning techniques.
NaviTaxi is an Uber-like cab aggregator startup that aims to provide comfort and safety for passengers, regular income for drivers, and environmental friendliness for the country.
Reviro has developed for NaviTaxi Android and iOS mobile applications and a web admin panel. Applications offer passengers to order a taxi ride in a few clicks, drivers to receive orders quickly, and administrators a tool to manage the entire company.
Dynamic pricing, also known as surge pricing, is a time-based pricing strategy in which flexible prices are set depending on the expected or estimated real-time peak of high demand in the market. Although surge pricing is found in all industries, such as tourism, entertainment, retail, and taxi services, airline ticket pricing is one of the most successful and widely known examples.
Cab aggregators use a surge pricing algorithm to determine supply and demand in a particular area to set reasonable fares. As a result, taxi fares go up when the number of requests for a ride exceeds the number of available taxis in a particular area. The added cost to the fare is determined using complex algorithms based on the current real-time level of demand and supply.
The surge pricing model is beneficial and important for taxi company efficiency for several reasons:
Restoring balance in the market The surge pricing model encourages more drivers to serve a busy area, providing them with orders, so they won't be idle or riding around town looking for potential passengers. In turn, it reduces the motivation of riders to take a taxi because not everyone is willing to pay a higher price for a ride, so those passengers who are not urgent can wait and give chances to those in a hurry. The result is an ideal market with enough taxi drivers to meet every customer's need within minutes.
Super local algorithm working in real-time The surge pricing is automatically activated by algorithms that detect changes in ride demand and driver availability in real-time across the city at a hyperlocal level, increasing the price predictions' accuracy.
More than 50% of all taxi orders made using NaviTaxi apps were canceled by passengers, based on data processed for several months of order history.
The main reason was that the riders waited too long because there were not enough cars available in the area where the orders came. The majority of cancellations occurred precisely during rush hours in the morning and evening, when everyone was going to work or coming back home from work.
(it’s UTC+-0, to get KG time + 6)
Thus, the supply, i.e., the number of available drivers, hasn't been meeting passengers’ demand for taxi services.
(red = demand, blue = supply)
We decided to use strategies based on machine learning in order to find a solution to this issue.
If you run into the same issue limiting your business's growth, we're here to help you improve your company's operations using our expertise in software development.
There are many assumptions about how the surge pricing mechanism works, but the logic behind it is simple. When an imbalance occurs between the number of passengers ordering a cab and the number of available drivers in a particular location at one specific time, the algorithm checks the incoming data, and the trip's cost increases until the taxi's supply and demand reach equilibrium.
By dividing the city into hyperlocal zones, which are small hexagonal blocks, we began to develop a prediction of what time there would be increased demand for each hexagon. The darker blue shade indicates high demand zones on the application map, determined by the algorithm predicting the volume of taxi orders in that area. The more orders are predicted for a given area, the darker the zone will be, and vice versa for expected fewer orders zones.
The Reviro team relies heavily on machine learning to create a robust and reliable dynamic pricing system.
Using historical data on taxi orders, we found a definite tendency of when, at what time, and where there is high demand for taxi services. For this, we used several machine learning models. We chose the one with the highest accuracy - the CatBoost, a modified and advanced gradient-boosting library on decision trees developed by researchers and engineers.
We used the H3 module to create a hexagonal grid system for data analysis. This geospatial indexing system breaks down the world into hexagonal cells. H3 supports sixteen resolutions, and each smaller resolution has a one-seventh cell in the area of the larger one. Level 7 was used for predictions, and resolution 8 was used to determine surge pricing.
All high-demand zones are displayed on the driver's map and in the admin panel. Although passengers do not see these zones on their app map, a surcharge will be shown in the final price when ordering a cab ride.
So with the surge pricing model, the cab aggregator can quickly connect the passenger with the driver, increasing productivity and restoring equilibrium in the market.
Choosing the most suitable grid system to overlay on the map for better data analysis was our biggest challenge while building the surge pricing model for NaviTaxi.
All data in order can be overlaid on a city map and presented as points for spatial analysis. However, algorithms cannot, like humans, distinguish and notice where data is grouped and where it is not. Instead, they must calculate distances between neighboring points to group them and get an accurate visual representation of the data on the map.
However, the analysis of each point does not give valuable information as there is no clear classification of points in a particular region. Therefore, we needed a coordinate grid system where the points are contained within a specific area without overlapping each other. In this way, we would analyze the behavior of the grid itself and the individual cells representing the data of the points underneath it.
During the development process, we chose circles as the grid system, thereby not completely covering the entire city. This caused inaccuracies in the algorithms, as there were points not included in any circle and, therefore, not analyzed.
We solved this problem by replacing our circles with hexagons as a grid system for data analysis. We could have chosen a triangle, a square, and a hexagon to cover all points on the map for a complete and accurate analysis. Still, we preferred hexagons for obvious superiority for our purposes.
Hexagons have only one distance between the central point and its neighboring hexagons. This property of hexagons significantly simplifies the analysis and smooths out the gradient. The same efficiency is difficult to obtain with triangles and squares because squares have two different distances to the center, and triangles have three.
This way, we have covered all points of order on the map and increased the algorithm's accuracy. Since each hexagon can be treated as a separate object, and each object can be accessed in a very short time, given its ID.
Using more and more data, this prediction model will improve and expand its capability over time.
Overall, NaviTaxi's dynamic pricing strikes a good balance between supply and demand, ensuring that customers don’t have to wait without a ride, and includes a method to attract more drivers in high-demand areas, which prevents orders from being canceled during peak hours.
Discover more about the NaviTaxi development here.
Reviro is an IT product development and outsourcing company offering a full range of services for automating and scaling ready-made businesses and creating IT startups, from the initial idea and formulation of product strategy, through prototyping and testing to further product support and enhancement.
“H3 Hexagonal hierarchical geospatial indexing system,” H3. Available: https://h3geo.org/
I. Brodsky, “H3: Uber's hexagonal hierarchical spatial index,” Uber Blog, 27-Jun-2018. Available: https://www.uber.com/blog/h3/
“Gradient Boosting Library with categorical features support - CatBoost,” CatBoost. Available: https://catboost.ai/