iT邦幫忙

2019 iT 邦幫忙鐵人賽

DAY 27
0
AI & Data

當自動駕駛遇見AI系列 第 27

Day27-當自動駕駛遇見AI- 2層神經網絡(2-Layer Neural Network)

前言

在本課程中,將學習如何使用TensorFlow構建多層神經網絡。 將隱藏層添加到網絡允許它模擬更複雜的功能。 此外,在隱藏層上使用非線性激活功能可以模擬非線性函數。

說明

第一層實際上由應用於X並通過ReLU(A Rectified linear unit)的一組權重和偏差組成。 該層的輸出被饋送到下一層,但在網絡外部是不可觀察的,因此也被稱為隱藏層。
第二層由應用於這些中間輸出的權重和偏差組成,然後是softmax函數以生成概率。

https://ithelp.ithome.com.tw/upload/images/20181111/20107143eH5HKnEGxv.png

實作

整流線性單元(ReLU)是激活函數的類型,其定義為f(x)= max(0,x)。 如果x為負,則函數返回0,否則返回x。 TensorFlow將ReLU函數提供為tf.nn.relu(),如下所示。

# Hidden Layer with ReLU activation function
hidden_layer = tf.add(tf.matmul(features, hidden_weights), hidden_biases)
hidden_layer = tf.nn.relu(hidden_layer)

output = tf.add(tf.matmul(hidden_layer, output_weights), output_biases)

上一篇
Day26-當自動駕駛遇見AI- TensorFlow-Training Your Logistic Classifier
下一篇
Day28-當自動駕駛遇見AI- TensorFlow Dropout
系列文
當自動駕駛遇見AI30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言