Skip to content
CampusEduX

Problem 1: Fit a Multiple Linear Regression Model

Easypython
Learn the Concept: Multiple Linear Regression

Problem Description

Write a Python program that fits a Multiple Linear Regression model using two features (size and number of rooms) to predict house price, and prints the learned coefficients and intercept.

Input

A dataset with two feature columns and one target column.

Output

The learned coefficients and intercept.

Constraints

  • At least 5 data points.

Example Input

text
size=[10,15,20,25,30], rooms=[2,3,3,4,4], price=[200,250,280,340,360]

Example Output

text
Intercept: 45.71 Coefficients: [8.86, 8.00]

Concepts Covered

LinearRegression, multiple features, .coef_, .intercept_.

Related Problems

  • Problem 2: Predict Using Multiple Features
    Easy · python
    Solve Problem
  • Problem 3: Compare Coefficient Magnitudes After Scaling
    Easy · python
    Solve Problem
  • Problem 4: Check for Multicollinearity Before Modeling
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...