Logistic regression model – building and training
Also based on our explanation of logistic regression in Chapter 2, Data Modeling in Action - The Titanic Example, we are going to implement the logistic regression algorithm in TensorFlow. So, briefly, logistic regression passes the input through the logistic/sigmoid but then treats the result as a probability:

Figure 13: Discriminating between two linearly separable classes, 0's and 1's
Utilizing logistic regression in TensorFlow
For us to utilize logistic regression in TensorFlow, we first need to import whatever libraries we are going to use. To do so, you can run this code cell:
import tensorflow as tf import pandas as pd import numpy as np import time from sklearn.datasets import load_iris from sklearn.cross_validation import train_test_split import matplotlib.pyplot as plt
Next, we will load the dataset we are going to use. In this case, we are utilizing the iris dataset, which is inbuilt. So, there's no need to do any preprocessing...