Car Sales Forecasting Time Series(Catboost + FastAPI + Docker)

borandabak
3 min readMay 11, 2023

--

Hello everyone, Today we will make an end-to-end project with you, using the catboost model, where we can estimate the number of vehicle sales between June 2022 and June 2023.

As you can see in the diagram above, today we will be going live the model we created using FastAPI and Docker.

Project Steps:

1-Understand Problem and Examine Dataset

2- Feature Engineering

3- Create Machine Learning Model(Catboost)

4- Create FastAPI

5- Deploy Docker

Let’s start our project :)

Step 1: Understand Problem

When we look at our dataset here, we see that we are given monthly vehicle sales figures, and it immediately reminds me that this is a seasonal time series dataset. When we look at the other columns, I see that the interest rate and the number of vehicle sales are inversely related. If my interest rate is low, I can expect my vehicle sales count to be high. When we look at this data set, the first ideas that occur in our minds.

What is asked of us is that we need to estimate the number of vehicle sales between June 2022 and June 2023.

Step 2: Feature Engineering

Here, we create our extra features based on the date values given to us.

Step 3: Machine Learning Model(Catboost)

Here we use the TimeSeriesSplit library for cross-validation because I train our model by choosing the intervals between 2020 June-2021 June, 2021 June-2022 sequentially, so that it can produce a better result when predicting between 2022 June-2023 June.

Step 4: Create FastAPI

Here we are designing it so that our users can enter the column values. the values we receive from our users; Date, Number of sales, OTV rate, Interest, Euro/TL, Credit Stock.

Step 5: Deploy Docker

Example Result:

Conclusion:

Here, we have done an end-to-end project by using multiple technologies in our project. By using up-to-date technologies such as Sklearn, Catboost, FastAPI, Docker, we can predict vehicle sales values for the next 12 months. I hope this article has helped you.

Contact me

Linkedin: https://www.linkedin.com/in/boran-oktay-dabak/

Source Code: https://github.com/oktaydbk54/Car_Sales_Prediction

Youtube: https://www.youtube.com/channel/UCsGwZ3006CuJWcA5J3UPVWw

Kaggle: https://www.kaggle.com/borandabak

--

--