บทนำ
TensorFlow เฟรมเวิร์ก ML จาก Google ใช้กับ Python รองรับ Deep Learning เทนเซอร์เป็นอาร์เรย์หลายมิติสำหรับ Data flow graph
ชุดข้อมูล Auto MPG
ข้อมูลประสิทธิภาพเชื้อเพลิงรถยนต์ 1970-80s มีคุณสมบัติ: น้ำหนัก แรงม้า ปริมาตรเครื่องยนต์ ฯลฯ เป้าหมายทำนาย MPG
ตัวอย่าง: การฝึกโมเดล DNN ด้วยฟีเจอร์ Horsepower เดียว
print("โมเดล DNN")
history = dnn_horsepower_model.fit(
train_features['Horsepower'], train_labels,
validation_split=0.2,
verbose=0, epochs=100)
print("Error ต่อ Epoch")
plot_loss(history)
x = tf.linspace(0.0, 250, 251)
y = dnn_horsepower_model.predict(x)
plot_horsepower(x, y)
test_results['dnn_horsepower_model'] = dnn_horsepower_model.evaluate(
test_features['Horsepower'], test_labels, verbose=0)
ที่มา: TensorFlow Regression Tutorial
ผลลัพธ์

คำอธิบาย
- DNN = Deep Neural Network ที่นี่มีอินพุตเดียวคือ Horsepower
- ฝึกโมเดลกับข้อมูลฝึก
- พล็อตพารามิเตอร์สถิติจาก history
- ทำนายและประเมินด้วยเมธอด
evaluate