For this example, we will start by getting the data, normalizing and splitting the text, running it through an embedding function, and training the logistic function to predict spam:
- The first task will be to import the necessary libraries for this task. Among the usual libraries, we will need a .zip file library to unzip the data from the UCI machine learning website we retrieve it from:
import tensorflow as tf import matplotlib.pyplot as plt import os import numpy as np import csv import string import requests import io from zipfile import ZipFile from tensorflow.contrib import learn sess = tf.Session()
- Instead of downloading the text data every time the script is run, we will save it and check if the file has been saved ...