Simple Linear Regression
Linear regression is a supervised learning model where it will identify the relation between variables.
Why Model Building ?
In any business, there are some easy-to-measure metrics
– Age, Gender, Income, Education level etc.
and a difficult-to-measure metric
– Amount of loan to give; Will she buy or not; How many days a patient will stay in the hospital etc.,
- Regression enables you to compute the latter form the former (Regression is model identifies the relation from the past data and predicts future from the relation learned)
Based on target variable to predict linear models are further classifier into two models.
- Linear Regression: Measuring the relation between two or more analog variables (class variable is numeric)
- Logistics Regression: A classification model (class variable is categorical)
Simple Linear Regression:
The “cars” dataset contains 50 pairs of data points of Speed(mph) vs stopping distance(ft). That were collected in 1920
import numpy import pandas as pd a= 2 b = np.array(1,2)