Improving the predictions of linear models
In this recipe, we will attempt to improve our logistic model by increasing the accuracy of the low birth weight prediction. We will use a neural network.
Getting ready
For this recipe, we will load the low birth weight data and use a neural network with two hidden fully connected layers with sigmoid activations to fit the probability of a low birth weight.
How to do it...
We proceed with the recipe as follows:
- We start by loading the libraries and initializing our computational graph as follows:
import matplotlib.pyplot as plt import numpy as np import tensorflow as tf import requests import os.path import csv
- Next, we load, extract, and normalize our data as in the preceding recipe, except that here we are going to be using the low birth weight indicator variable as our target instead of the actual birth weight, shown as follows:
# Name of data file birth_weight_file = &apos...