reading-notes

This Repo required for Asac labs class 2


Project maintained by ManarAbdelkarim Hosted on GitHub Pages — Theme by mattgraham

#Linear Regressions

Regression analysis

Regression analysis is one of the most important fields in statistics and machine learning. There are many regression methods available. Linear regression is one of them. Regression searches for relationships among variables.

When Do You Need Regression?

What is Linear Regressions in Python?

scikit-learn:

The package scikit-learn is a widely used Python library for machine learning, built on top of NumPy and some other packages. It provides the means for preprocessing data, reducing dimensionality, implementing regression, classification, clustering, and more. Like NumPy, scikit-learn is also open source.

use Linear regression :

Exploring Boston Housing Data Set

  1. The first step is to import the required Python libraries into Ipython Notebook.

     %matplotlib inline 
     import numpy as np
     import pandas as pd
     import scipy.stats as stats
     import matplitlib.pyplot as plt
     import sklearn
        
    
  2. print the feature names of the data set.

     data_set.featrue_names
    
    
  3. convert boston.data into a pandas data frame.

     bos= pd.DataFram(boston.data)
     bos.head()
     #after this line of code is excuted the column names will be in numbers so we have to change the column names with feature names
    
     bos.columns = boston.freature_names
     bos.head()
    
     # add boston.target to the fram in a column named PRICE
    
     bos['PRICE'] = boston.target 
    
    

Scikit Learn

lets fit a linear regression model and predict the Boston housing prices. using least squares method (to elemenate coefficients)

```
from sklearn.linear_model import linearRegression
x=bos.drop('PRICE' ,axis =1)
lm = LinearRegression()

```

Fitting a Linear Model

The Result:

img