注解

神经网络在机器学习中十分重要,在很多优先度较高未解决的问题中,越来越重要。我们首先开始介绍浅层神经网络, 它很强大而且可以帮我 们改善之前用机器学习的结果。我们首先开始介绍最基本的神经网络单元,操作门。 随后我们将继续介绍神经网络的方方面面,并以训练一个 用玩tic-tac-toe的模型结束。

引言

We introduce the concept of neural networks and how TensorFlow is built to easily handle these algorithms.


载入操作门

We implement an operational gate with one operation. Then we show how to extend this to multiple nested operations.

下载本章 Jupyter Notebook


门运算和激活函数

Now we have to introduce activation functions on the gates. We show how different activation functions operate.

下载本章 Jupyter Notebook


载入一层神经网络

We have all the pieces to start implementing our first neural network. We do so here with regression on the Iris data set.

下载本章 Jupyter Notebook


载入多层神经网络

This section introduces the convolution layer and the max-pool layer. We show how to chain these together in a 1D and 2D example with fully connected layers as well.

下载本章 Jupyter Notebook


使用多层神经网络

Here we show how to functionalize different layers and variables for a cleaner multi-layer neural network.

下载本章 Jupyter Notebook


线性模型预测改善

We show how we can improve the convergence of our prior logistic regression with a set of hidden layers.

下载本章 Jupyter Notebook

神经网络学习井字棋

Given a set of tic-tac-toe boards and corresponding optimal moves, we train a neural network classification model to play. At the end of the script, we can attempt to play against the trained model.

下载本章 Jupyter Notebook

本章学习模块

tensorflow.zeros

Creates a tensor with all elements set to zero.

See also tf.zeros_like, tf.ones, tf.fill, tf.eye.

This operation returns a tensor of type dtype with shape shape and all elements set to zero.

>>> tf.zeros([3, 4], tf.int32)
<tf.Tensor: shape=(3, 4), dtype=int32, numpy=
array([[0, 0, 0, 0],
       [0, 0, 0, 0],
       [0, 0, 0, 0]], dtype=int32)>
param shape:A list of integers, a tuple of integers, or a 1-D Tensor of type int32.
param dtype:The DType of an element in the resulting Tensor.
param name:Optional string. A name for the operation.
returns:A Tensor with all elements set to zero.

tensorflow.ones

Creates a tensor with all elements set to one (1).

See also tf.ones_like, tf.zeros, tf.fill, tf.eye.

This operation returns a tensor of type dtype with shape shape and all elements set to one.

>>> tf.ones([3, 4], tf.int32)
<tf.Tensor: shape=(3, 4), dtype=int32, numpy=
array([[1, 1, 1, 1],
       [1, 1, 1, 1],
       [1, 1, 1, 1]], dtype=int32)>
param shape:A list of integers, a tuple of integers, or a 1-D Tensor of type int32.
param dtype:Optional DType of an element in the resulting Tensor. Default is tf.float32.
param name:Optional string. A name for the operation.
returns:A Tensor with all elements set to one (1).