Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Machine Learning with TensorFlow 1.x

You're reading from   Machine Learning with TensorFlow 1.x Second generation machine learning with Google's brainchild - TensorFlow 1.x

Arrow left icon
Product type Paperback
Published in Nov 2017
Publisher Packt
ISBN-13 9781786462961
Length 304 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (3):
Arrow left icon
Saif Ahmed Saif Ahmed
Author Profile Icon Saif Ahmed
Saif Ahmed
Quan Hua Quan Hua
Author Profile Icon Quan Hua
Quan Hua
Shams Ul Azeem Shams Ul Azeem
Author Profile Icon Shams Ul Azeem
Shams Ul Azeem
Arrow right icon
View More author details
Toc

Table of Contents (13) Chapters Close

Preface 1. Getting Started with TensorFlow 2. Your First Classifier FREE CHAPTER 3. The TensorFlow Toolbox 4. Cats and Dogs 5. Sequence to Sequence Models-Parlez-vous Français? 6. Finding Meaning 7. Making Money with Machine Learning 8. The Doctor Will See You Now 9. Cruise Control - Automation 10. Go Live and Go Big 11. Going Further - 21 Problems 12. Advanced Installation

Training day

Now, we arrive at the fun part—the neural network. The complete code to train this model is available at the following link: https://github.com/mlwithtf/mlwithtf/blob/master/chapter_02/training.py

To train the model, we'll import several more modules:

 import sys, os
import tensorflow as tf
import numpy as np
sys.path.append(os.path.realpath('..'))
import data_utils
import logmanager

Then, we will define a few parameters for the training process:

 batch_size = 128
num_steps = 10000
learning_rate = 0.3
data_showing_step = 500

After that, we will use the data_utils package to load the dataset that was downloaded in the previous section:

 dataset, image_size, num_of_classes, num_of_channels =  
data_utils.prepare_not_mnist_dataset(root_dir="..")
dataset = data_utils.reformat(dataset, image_size, num_of_channels,
num_of_classes)
print...
You have been reading a chapter from
Machine Learning with TensorFlow 1.x
Published in: Nov 2017
Publisher: Packt
ISBN-13: 9781786462961
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image