We proceed with the recipe as follows:
- First, we load the libraries needed and initialize the computational graph. Note that we also load matplotlib here, because we would like to plot the resultant line afterward:
import matplotlib.pyplot as plt import numpy as np from sklearn import datasets import tensorflow as tf sess = tf.Session()
- Next, we load the iris data. We will also need to transform the target data to be just 1 or 0, whether the target is setosa or not. Since the iris dataset marks setosa as a 0, we will change all targets with the value 0 to 1, and the other values all to 0. We will also only use two features, petal length and petal width. These two features are the third and fourth entry in each x-value ...