Over the last week, I had the chance to work on my first regression problem.
It was on a used-car dataset and I wanted to predict profit/loss on reselling one of those cars depending on its usage.
I built a Streamlit app to interact with the data and results (which also helped me uncover and fix a major issue with my data processing pipeline… details in the comments). This is also my first ML-powered app.
The way I approached this was by training the model on the original scaled dataset. And for predictions, I would add the usage years to the age and distance to the miles columns, and then predict on this dataset. The results would be the resale value and the difference between the original price and resale value is the profit/loss.
However, I noticed that changing these values didn’t affect the model output whatsoever. After a considerable time checking my code for any obvious variable/dataframe misuse, I figured it was because of the scaling applied. Since the test dataset is also scaled, modifying columns by a constant value will completely cancel out the constant.
So the only fix which I could think of was to remove the scaler, and use a model which doesn’t need scaled datasets. Ended up using RandomForestRegressor.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.