While using matrices and decomposition methods are very powerful, TensorFlow has another way to solve for the slope and intercept. TensorFlow can do this iteratively, gradually learning the best linear regression parameters that will minimize the loss.
Learning the TensorFlow way of linear regression
Getting ready
In this recipe, we will loop through batches of data points and let TensorFlow update the slope and y intercept. Instead of generated data, we will use the iris dataset that is built into the scikit-learn library. Specifically, we will find an optimal line through data points where the x value is the petal width and the y value is the sepal length. We chose these two because there appears to be a linear relationship...