iT邦幫忙

2019 iT 邦幫忙鐵人賽

DAY 7
0
AI & Data

跟著Google學ML系列 第 7

[Day 7] TensorFlow的第一步

  • 分享至 

  • twitterImage
  •  

Ref: First Steps with TensorFlow

Tensorflow 中有很多Machine learning model可以使用,但它也提供很多toolkit給我們使用,包含低階(lower-level)的API讓你定義自己的運算,也有高階(higher-level)的API (tf.estimator)使用定義好的Machine learning model。

下圖是TensorFlow toolkit的架構:
https://developers.google.com/machine-learning/crash-course/images/TFHierarchy.svg

TensorFlow又包含兩個component(TensorFlow architecture):

  1. graph protocol buffer
  2. 執行Graph的runtime

runtime是個跨平台library,透過一層C API把user level code從core runtime分離出來,然後透過protocol buffer這種共同的格式,去執行最後的結果。

tf.estimator API

使用Estimator API只要簡單的幾行就可以完成machine learning的train, prediction。也可以整合Scikit-learn 去評估model的metrics。

來看看下面的例子:

import tensorflow as tf

# Set up a linear classifier.
classifier = tf.estimator.LinearClassifier(feature_columns)

# Train model.
classifier.train(input_fn=train_input_fn, steps=2000)

# 預測.
predictions = classifier.predict(input_fn=predict_input_fn)

今天的First steps先到這邊。這一回的Programming exercises篇幅有點多,我把它分到明天再來實際操作一次,實際執行就放在明天了


上一篇
[Day 6] ML中的reducing loss
下一篇
[Day 8] TensorFlow programming exercises
系列文
跟著Google學ML30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言