Challenge - Auto Insurance Prediction

In this challenge, you need to use the simplest linear regression to do the prediction.

We'll cover the following

Challenge - Auto Insurance Prediction

Note: In this challenge, the dataset is Auto Insurance in Sweden. You can see more information at this link.

This dataset has two columns, x and y. x stands for the number of claims, y stands for total payment for all the claims in thousands of Swedish Kronor for geographical zones in Sweden. Your task is to use x to predict y.

This file doesn’t have a header. The first column is x, and the second one is y.

Your task is kind of easy in this challenge:

  • Load the dataset from the file auto_insurance_sweden.csv.
  • Split the data into two parts, the test accounts for 20%. You can use 42 as the random seed.
  • Build a linear regression model and fit it.
  • Return the MSE metric.

Note: You can just load auto_insurance_sweden.csv, this file is already on this platform. The label is the column y.

If you are already familiar with pandas library, it’s easy for you to load this dataset. If not, you can click the Hint to get the code of loading data.

Get hands-on with 1400+ tech skills courses.