Cover of AI and Machine Learning for Coders by Laurence Moroney, featuring abstract layered network shapes on a gradient background

Pages

300

Published

2020

AI Learning ✨ New

AI and Machine Learning for Coders

A Programmer's Guide to Building AI and Machine Learning Models with TensorFlow

Move from writing code to building intelligent systems by constructing real neural networks with TensorFlow, one working example at a time.

AI and Machine Learning for Coders by Laurence Moroney gives working programmers a direct, hands-on path into machine learning using TensorFlow. Rather than front-loading theory, each chapter builds a concrete model you can run and inspect. Written by Google's AI Developer Advocate, the book covers computer vision, natural language processing, and sequence modeling in plain terms, making it the shortest credible route from knowing how to code to knowing how to build models that learn.

About this book

Most machine learning books are written for data scientists or mathematicians. This one is written for coders. If you know how to write a function and call a library, you have everything you need to start building models that recognize images, understand text, and predict sequences.

Laurence Moroney, AI Developer Advocate at Google, has spent years teaching ML to software engineers. This book distills that experience into a series of concrete, runnable examples using TensorFlow and Keras. You will not wade through pages of calculus before writing a line of model code. You will write the model first, see it work, and then understand why it works.

The book moves through the core building blocks of modern machine learning in a deliberate order. You start with the fundamentals of how a neural network learns, then work through computer vision with convolutional networks, natural language understanding with embeddings and recurrent layers, and time-series prediction with sequence models. Each technique is introduced with a self-contained example you can extend.

By the time you finish, you will have built models across multiple domains, deployed them to the web and to mobile devices via TensorFlow Lite and TensorFlow.js, and understood the architectural decisions that separate a model that generalizes from one that merely memorizes.

  • Hands-on TensorFlow and Keras examples from the first chapter
  • Computer vision with CNNs, including transfer learning from pretrained models
  • NLP foundations: tokenization, word embeddings, and sequence classification
  • Time-series and sequence modeling with RNNs and LSTMs
  • Model deployment to browsers with TensorFlow.js and to mobile with TensorFlow Lite
  • Written by Google's AI Developer Advocate, with direct insight into how TensorFlow is designed to be used

This is not a survey of AI concepts. It is a practical construction manual for programmers who want working models, not just working knowledge of the vocabulary.

🎯 What you'll learn

  • Build and train a neural network from scratch using TensorFlow and Keras in the first sitting
  • Construct convolutional neural networks that classify images accurately without hand-crafted features
  • Apply transfer learning from pretrained models to solve new vision problems with far less training data
  • Tokenize and embed text so a model can learn meaning from sequences of words
  • Train recurrent and LSTM networks to classify and generate text and model time-series data
  • Diagnose overfitting and apply regularization, dropout, and data augmentation to fix it
  • Export trained models and run inference in a browser with TensorFlow.js and on mobile with TensorFlow Lite

πŸ‘€ Who is this book for?

  • Software developers with basic Python knowledge who want to build and ship their first real machine learning models
  • Backend or full-stack engineers looking to add ML capabilities to applications without switching careers into data science
  • Self-taught coders who have read introductory AI articles but want hands-on TensorFlow practice that goes deeper
  • Students in computer science or software engineering programs who want a practitioner-focused complement to academic coursework
  • Mobile or web developers who want to understand how to run trained models in TensorFlow Lite or TensorFlow.js

Table of contents

  1. 01

    Introduction to Machine Learning

    You build a single-neuron model that learns a numeric relationship from data, establishing the core loop of defining a model, compiling it, fitting it, and evaluating its predictions.

  2. 02

    Computer Vision Fundamentals

    You train a dense neural network to classify clothing images from the Fashion MNIST dataset and observe how pixel data flows through layers to produce class probabilities.

  3. 03

    Convolutional Neural Networks

    You replace dense layers with convolutional and pooling layers, learning how filters detect spatial features and why CNNs outperform flat networks on image tasks.

  4. 04

    Using Pretrained Models with Transfer Learning

    You load an ImageNet-pretrained model, freeze its convolutional base, and fine-tune a new classifier head on a small custom dataset, achieving strong accuracy with minimal training.

  5. 05

    NLP Basics: Tokenization and Embeddings

    You convert raw text into integer sequences, pad them to uniform length, and train an embedding layer that positions words in a vector space where meaning is proximity.

  6. 06

    Sequence Models for Text

    You build recurrent and LSTM networks to classify sentiment and generate text, and compare them to simpler approaches to understand when sequential memory earns its cost.

  7. 07

    Time-Series and Sequence Prediction

    You model synthetic and real time-series data with windowed datasets and LSTM layers, measuring forecast error and tuning the model to generalize across unseen periods.

  8. 08

    Deploying Models with TensorFlow Lite

    You convert a trained Keras model to the TensorFlow Lite flat-buffer format, run it inside a simple Android and iOS project, and measure the latency and accuracy trade-offs of on-device inference.

  9. 09

    Running Models in the Browser with TensorFlow.js

    You export a model to TensorFlow.js format, load it in a web page, and run real-time inference in the browser without a server round-trip, using either a converted Keras model or one trained directly in JavaScript.

Frequently asked questions

What programming background do I need before reading this book?

You need basic Python familiarity: variables, loops, functions, and importing libraries. No prior machine learning, statistics, or linear algebra is required.

Which version of TensorFlow does the book use?

The book was written for TensorFlow 2.x, specifically the version current in late 2020. Core Keras APIs used throughout the book have remained stable, though some peripheral APIs may have changed in newer releases.

Is this book appropriate for someone who has already worked through a basic ML course?

It is best suited for programmers at the beginner-to-intermediate boundary. If you have already built and tuned CNNs and LSTMs on your own, you may find the early chapters familiar, though the deployment chapters on TensorFlow Lite and TensorFlow.js are useful at any level.

Does the book include code samples I can run myself?

Yes, each chapter is built around runnable code examples. The book's code is available through O'Reilly's standard companion resources; check the publisher's page for the current download link.

Does the book cover PyTorch or other frameworks?

No. The book is focused entirely on TensorFlow and Keras. If you need framework-agnostic ML theory or PyTorch coverage, this is not the right book.

Is deployment to production services like Cloud Run or SageMaker covered?

No. The deployment chapters focus on TensorFlow Lite for mobile devices and TensorFlow.js for browsers. Cloud or server-side model serving is outside the scope of this book.

You might also like

πŸ“¬ Weekly Newsletter

Stay ahead of the curve

Get the best programming tutorials, data analytics tips, and tool reviews delivered to your inbox every week.

No spam. Unsubscribe anytime.