So you know the math, you know how to regress your data, you also know how to implement them in python with Scikit-Learn or Statsmodels and that’s probably more than sufficient for solving any regression problem. But how about we take it a bit further and use the ‘ever so amazing’ Tensorflow to execute linear regression in a very traditional manner?
My Name is Pranab, and this is my first of (hopefully) many articles on data science, machine learning and statistics. Through this article I would like to explain my approach to performing linear regression with Tensorflow. I will be sharing every single line of code while describing the interpretation of the logic behind them.
We will be working with the graduate admission dataset which can be downloaded here. We will build a simple linear regression model, with single predictor variable
The goal here is not to build a best performing model, but to try and interpret the same using tensorflow
First things first
import numpy as np
import pandas as pd
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
Since we will be using tensorflow v1 here, we disable v2 in the 4th line
Let’s take a look at the data
data = pd.read_csv('Admission_Predict.csv')
data
#data-science #tensorflow #machine-learning #linear-regression #deep-learning