In this chapter, we'll cover the following recipes:

  • Implementing Operational Gates
  • Working with Gates and Activation Functions
  • Implementing an One-Hidden-Layer Neural Network
  • Implementing Different Layers
  • Using Multilayer Networks
  • Improving Predictions of Linear Models
  • Learning to Play Tic Tac Toe

 

一层隐藏层的全连接神经网络

-- 与MLP像,但solver, loss的策略不同

 

加载Iris数据。

# Implementing a one-layer Neural Network
#---------------------------------------
#
# We will illustrate how to create a one hidden layer NN
#
# We will use the iris data for this exercise
#
# We will build a one-hidden layer neural network
#  to predict the fourth attribute, Petal Width from
#  the other three (Sepal length, Sepal width, Petal length).

import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
from sklearn import datasets
from tensorflow.python.framework import ops
ops.reset_default_graph()

iris   = datasets.load_iris()
x_vals = np.array([x[0:3] for x in iris.data])
y_vals = np.array([x[3]   for x in iris.data])
Load data

相关文章:

  • 2021-12-01
  • 2021-08-25
  • 2021-11-13
  • 2021-05-26
  • 2022-01-03
  • 2022-12-23
猜你喜欢
  • 2022-01-10
  • 2021-11-23
  • 2021-08-03
  • 2021-12-07
  • 2021-10-06
  • 2021-11-30
  • 2021-10-05
相关资源
相似解决方案