Colorful Abstract Geometric Company Linkedin Banner(3)

Supervised Learning — Linear Regression (Using R)

Problem Statement:- Generate a proper 2-D data set of N points. Split the data set into the Training Data set and Test Data set. i) Perform linear regression analysis with Least Squares Method. ii) Plot the graphs for Training MSE and Test MSE and comment on Curve Fitting and Generalization Error. iii) Verify the Effect of Data Set Size and Bias-Variance Tradeoff. iv) Apply Cross-Validation and plot the graphs for errors. v) Apply the Subset Selection Method and plot the graphs for errors. vi) Describe your findings in each case.

Link to the program and Datasets is given below

What is a Linear Regression?

Mathematical Representation of Linear Regression

Simple Linear Regression

Multiple Linear Regression

In multiple linear regression, we have two or more independent variables (x) and one dependent variable (y). So, instead of a single feature column, we have multiple feature columns and a target column.

Mean Squared Error Cost Function

Program for Linear Regression using Advertisement Dataset-

Step 1: Load the required dataset.

Input:-

 

Output:-

 

 

Step 2: Extracting the required data.

Input:

 

Output:

 

Step 3: Dividing the dataset into Training and Testing Datasets.

Input:

 

Output:

 

 

Step 4: Binding all the columns using cbind function.

Input:

 

Output:

 

 

Step 5: Plotting the graph for individual object.

Input:

 

Output:

 

 

Step 6: Predicting the values of data.

Input:

 

Output:

 

 

Step 7: Finally plotting a model for the training and testing datasets

Input:

 

Output:

 

 

About Us

Thinksprout Infotech is leading IT Solutions company providing excellent services with great efforts. The Company also deals in Online Application and Custom Software Development. Moreover, we have an extensively experienced team in programming databases and back-end solutions. In the same vein, we develop user-friendly applications for our clients for better operations and outputs.

Partnered with

About Us

Thinksprout Infotech is leading IT Solutions company providing excellent services with great efforts. The Company also deals in Online Application and Custom Software Development. Moreover, we have an extensively experienced team in programming databases and back-end solutions. In the same vein, we develop user-friendly applications for our clients for better operations and outputs.

partnered with