Univariate-Linear-Regression
Problem statement
Linear Regression is implemented to identify the relationship between profit of a bike sharing company and population of different cities. The main objective is to find the next city in which a new outlet should be opened which results in optimal profitability.
Data visualization
Implementation
-
Visualization of the cost function by plotting the cost over a 2-dimensional grid of π_0 and π_1 values. The cost function J(π) is bowl-shaped and has a global minimum.
-
Implementation of gradient descent algorithm from scratch in Python without the use of machine learning frameworks such as scikit-learn and statsmodels. Ran the algorithm over 2000 iterations to minimize the cost J(ΞΈ). With each step of batch gradient descent, the parameters π_j come closer to the optimal values that will achieve the lowest cost J(π). The plot of convergence is shown below:
Results
Univariate Linear Regression Fit:
Libraries used
- matplotlib
- numpy
- pandas
- seaborn
- mpl_toolkits