Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Below is the assignment details. It is written in Python. I also included a screenshot of the dataset route needed for the assignment on Colab.

Below is the assignment details. It is written in Python. I also included a screenshot of the dataset route needed for the assignment on Colab. Thank You.

image text in transcribed

image text in transcribed

For this assignment, you need to first build and overfit a polynomial regression. Then, you need to use different regularization methods to prevent the overfitting of that model. Below is a detailed instruction of what you may need to do. - Dataset Preparation - A dataset is given. If you use Google Colab, you need to upload the dataset to your Google Drive, and access the data in Google Colab. - Polynomial Regression Design and Overfitting - You need to design a polynomial regression model, then, overfit the polynomial model on the given dataset. - You could use the scikit-learn build-in functions to fit the polynomial model. - (Optional) You could develop the polynomial regression model from scratch. - Bonus points will be given if you build your model from scratch. - Prevent Overfitting - After you overfitted the polynomial regression model, you may apply L1 norm, L 2 norm, and the combination of L 1 and L2 norms to prevent overfitting. - You could use scikit-learn build-in functions such as - skdearn.linear_model._Lasso to build a polynomial regression model with L 1 norm - skdearn.linear_model.Ridge to build a polynomial regression model with L 2 norm - sktearn.linear_model.ElasticNet to build a polynomial regression model with the combination of L 1 norm L 2 norm - You could also implement this step from scratch. - Bonus points will be given if you build your model from scratch. - Load Google Drive [15] \# Mount Google Drive from google.colab import drive drive.mount(' /content/drive') Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount("/content/drive", force_remount=True). Is /content/drive/MyDrive/Demo/dataset/kaggle_linear_regression_data readme.md test.csv train.csv [25] I cat /content/drive/MyDrive/Demo/dataset/kaggle_linear_regression_data/readme.md The dataset has been taken from [Kaggle] (https://Ww.kaggle.com/andonians/random-linear-regression). - Load CSV File [26] import pandas as pd [32] \#Load CSV df_train = pd.read_csv('/content/drive/MyDrive/Demo/dataset/kaggle_linear_regression_data/train.csv') df_test = pd.read_csv('/content/drive/MyDrive/Demo/dataset/kaggle_linear_regression_data/test.csv' ) \#Drop Duplication Rows df train =dftrain.dropna() df test =df test.dropna() df_train

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions