From f6d2141a480dd6b5b8ee0e48d43bb64773232791 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Tue, 26 Mar 2024 23:38:14 -0600 Subject: add header ids --- ...019-12-16-TensorFlow-Polynomial-Regression.html | 52 +++++++++++----------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'docs/posts/2019-12-16-TensorFlow-Polynomial-Regression.html') diff --git a/docs/posts/2019-12-16-TensorFlow-Polynomial-Regression.html b/docs/posts/2019-12-16-TensorFlow-Polynomial-Regression.html index 7057815..e432792 100644 --- a/docs/posts/2019-12-16-TensorFlow-Polynomial-Regression.html +++ b/docs/posts/2019-12-16-TensorFlow-Polynomial-Regression.html @@ -6,13 +6,13 @@ - Polynomial Regression Using TensorFlow + id="polynomial-regression-using-tensorflow">Polynomial Regression Using TensorFlow - - + Polynomial Regression Using TensorFlow" /> + Polynomial Regression Using TensorFlow" /> @@ -44,7 +44,7 @@
-

Polynomial Regression Using TensorFlow

+

Polynomial Regression Using TensorFlow

In this tutorial you will learn about polynomial regression and how you can implement it in Tensorflow.

@@ -58,19 +58,19 @@
  • Quintic
  • -

    Regression

    +

    Regression

    -

    What is Regression?

    +

    What is Regression?

    Regression is a statistical measurement that is used to try to determine the relationship between a dependent variable (often denoted by Y), and series of varying variables (called independent variables, often denoted by X ).

    -

    What is Polynomial Regression

    +

    What is Polynomial Regression

    This is a form of Regression Analysis where the relationship between Y and X is denoted as the nth degree/power of X. Polynomial regression even fits a non-linear relationship (e.g when the points don't form a straight line).

    -

    Imports

    +

    Imports

    import tensorflow.compat.v1 as tf
    @@ -81,9 +81,9 @@ Polynomial regression even fits a non-linear relationship (e.g when the points d
     
    -

    Dataset

    +

    Dataset

    -

    Creating Random Data

    +

    Creating Random Data

    Even though in this tutorial we will use a Position Vs Salary dataset, it is important to know how to create synthetic data

    @@ -105,7 +105,7 @@ Polynomial regression even fits a non-linear relationship (e.g when the points d -

    Position vs Salary Dataset

    +

    Position vs Salary Dataset

    We will be using https://drive.google.com/file/d/1tNL4jxZEfpaP4oflfSn6pIHJX7Pachm9/view (Salary vs Position Dataset)

    @@ -160,7 +160,7 @@ Polynomial regression even fits a non-linear relationship (e.g when the points d

    -

    Defining Stuff

    +

    Defining Stuff

    X = tf.placeholder("float")
    @@ -168,7 +168,7 @@ Polynomial regression even fits a non-linear relationship (e.g when the points d
     
    -

    Defining Variables

    +

    Defining Variables

    We first define all the coefficients and constant as tensorflow variables having a random initial value

    @@ -182,7 +182,7 @@ Polynomial regression even fits a non-linear relationship (e.g when the points d -

    Model Configuration

    +

    Model Configuration

    learning_rate = 0.2
    @@ -190,7 +190,7 @@ Polynomial regression even fits a non-linear relationship (e.g when the points d
     
    -

    Equations

    +

    Equations

    deg1 = a*X + b
    @@ -201,7 +201,7 @@ Polynomial regression even fits a non-linear relationship (e.g when the points d
     
    -

    Cost Function

    +

    Cost Function

    We use the Mean Squared Error Function

    @@ -214,7 +214,7 @@ Polynomial regression even fits a non-linear relationship (e.g when the points d -

    Optimizer

    +

    Optimizer

    We use the AdamOptimizer for the polynomial functions and GradientDescentOptimizer for the linear function

    @@ -232,12 +232,12 @@ Polynomial regression even fits a non-linear relationship (e.g when the points d -

    Model Predictions

    +

    Model Predictions

    For each type of equation first we make the model predict the values of the coefficient(s) and constant, once we get these values we use it to predict the Y values using the X values. We then plot it to compare the actual data and predicted line.

    -

    Linear Equation

    +

    Linear Equation

    with tf.Session() as sess:
    @@ -301,7 +301,7 @@ values using the X values. We then plot it to compare the actual data and predic
     
     

    -

    Quadratic Equation

    +

    Quadratic Equation

    with tf.Session() as sess:
    @@ -366,7 +366,7 @@ values using the X values. We then plot it to compare the actual data and predic
     
     

    -

    Cubic

    +

    Cubic

    with tf.Session() as sess:
    @@ -432,7 +432,7 @@ values using the X values. We then plot it to compare the actual data and predic
     
     

    -

    Quartic

    +

    Quartic

    with tf.Session() as sess:
    @@ -499,7 +499,7 @@ values using the X values. We then plot it to compare the actual data and predic
     
     

    -

    Quintic

    +

    Quintic

    with tf.Session() as sess:
    @@ -565,13 +565,13 @@ values using the X values. We then plot it to compare the actual data and predic
     
     

    -

    Results and Conclusion

    +

    Results and Conclusion

    You just learnt Polynomial Regression using TensorFlow!

    -

    Notes

    +

    Notes

    -

    Overfitting

    +

    Overfitting

    -- cgit v1.2.3