Model Building and Evaluation
Explore the process of building a customer revenue prediction model using linear regression. Learn to separate features and labels, train and test the model, and evaluate its accuracy with metrics like RMSE and visual comparisons to actual spending data.
Finally, the dataset has been prepared, and we have observed the underlying relationships between the features. Now, we can build our regression model and start predicting customer spending for the year 2020.
In this lesson, we’ll build our first version of the model, evaluate its performance, and test different ways to improve the model’s performance.
As always, let's import all the necessary libraries and the wrangled dataset.
Model building
We’ll separate the features from the label first. Then we’ll split the dataset into training and test datasets, keeping 20% of the dataset for testing. This is a standard process in most model-building scenarios.
We'll use revenue_2020 as our target prediction label and the following as our feature columns:
revenue_2019...