0% found this document useful (0 votes)
26 views10 pages

Safi ML Lab6

This document describes an experiment implementing multi-linear regression in Python to predict house rent based on multiple features. The student generated synthetic data with multiple house features and rent prices, preprocessed the data, used gradient descent to learn regression coefficients that minimize mean squared error, and plotted the error values over iterations to analyze model performance and convergence. Overall, the student gained experience applying multi-variable regression and understanding how different features collectively influence an outcome variable.

Uploaded by

safiullahf20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views10 pages

Safi ML Lab6

This document describes an experiment implementing multi-linear regression in Python to predict house rent based on multiple features. The student generated synthetic data with multiple house features and rent prices, preprocessed the data, used gradient descent to learn regression coefficients that minimize mean squared error, and plotted the error values over iterations to analyze model performance and convergence. Overall, the student gained experience applying multi-variable regression and understanding how different features collectively influence an outcome variable.

Uploaded by

safiullahf20
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

National University of technology

Name: Muhammad Safi Ullah Adam


ID: F20604031
Batch: CEN-20
Subject: ML & AI LAB

Submitted to: Engr. Abdul Qadeer


Experiment 6

Implementation of Multi-Liner Regression in Python

Objectives:
The objective of this lab is to
 To understand the concept of Multi-Variable Regression.
 Learn how to formulate and apply regression models with multiple independent variables.

 Implementing Multi-Variable Regression using Python.

Software:

 Python Idle 3.6 or 3.9


 Jupyter Notebook

Theory:
Multi-variable Regression is a powerful technique in Machine Learning that allows us to analyze the
relationship between multiple independent variables and a dependent variable. It extends the concept
of Simple Linear Regression, where only one independent variable is considered. In this experiment, we
will explore the fundamental concepts behind Multi-Variable Regression and implement a regression
model using Python. This will enhance our understanding of how different features impact the
prediction of a target variable in a more realistic and complex scenario.

Steps:
 Data Generation: Synthetic data for house features and rent was generated, simulating a
dataset with multiple features.
 Data Preprocessing: Missing values were handled by filling them with the mean, and features
were scaled using Standard Scaler to ensure convergence efficiency.
 Gradient Descent: The gradient descent algorithm was applied to learn the coefficients for the
linear regression model, iterating over a specified number of iterations.
 MSE Calculation: Mean Squared Error (MSE) was calculated at each iteration on the test set to
evaluate the model's performance.
 Visualization: The MSE values over iterations were plotted to provide a visual representation of
the model's learning process and convergence. Adjustments to hyperparameters were made
based on the observed MSE trends.

lab Tasks

1. Write a Python Code to predict rent of a house for the dataset given by the instructor having
multiple features.
Conclusion

In this lab task, I delved into the intricacies of Multi-Variable Linear Regression, exploring how multiple
independent variables can collectively influence a dependent variable. I developed a deeper understanding
of the regression coefficients and how they quantify the relationship between predictors and the outcome.
By implementing gradient descent, I gained practical experience in optimizing the regression model to fit
our data, adjusting weights, and biases to minimize the cost function. The hands-on experience cemented
my comprehension of the theory and its application in real-world scenarios. Although powerful, I
recognized the necessity to critically evaluate the assumptions underlying the model and remain vigilant
about its limitations. Overall, this exercise was instrumental in enhancing my analytical skills, providing a
solid foundation for predictive modeling and contributing to informed decision-making in complex
environments.

In summary, the Multi-Variable Linear Regression examination unveiled noteworthy insights into the
interconnections among various independent variables and a dependent variable. The coefficients and
model fit statistics offered a thorough comprehension of the variables' influence and the overall predictive
efficacy of the model. While it proves valuable in prediction, it is imperative to cautiously assess
assumptions and potential constraints. This analysis furnishes valuable information for decision-making
and comprehension of intricate interactions in pertinent domains.

You might also like