TensorFlow (Google) là framework học máy mã nguồn mở, dùng Python, tối ưu tính toán bằng NumPy và tensor (mảng đa chiều). Hỗ trợ mạng nơ-ron sâu, dùng trong nghiên cứu và sản xuất.
Tập dữ liệu Auto MPG: hiệu suất nhiên liệu xe hơi thập niên 70-80, các đặc trưng: trọng lượng, mã lực, dung tích... Dự đoán MPG.
Chạy trên Google Colab (Python trên trình duyệt, GPU miễn phí, base Jupyter Notebook).
Ví dụ
print("Mô hình DNN")
history = dnn_horsepower_model.fit(
train_features['Horsepower'], train_labels,
validation_split=0.2,
verbose=0, epochs=100)
print("Lỗi theo từng 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)
Nguồn mã: TensorFlow Regression Tutorial
Đầu ra

Giải thích
- DNN (mạng nơ-ron sâu) với đầu vào đơn lẻ:
Horsepower(mã lực). - Huấn luyện mô hình trên dữ liệu train.
- Vẽ biểu đồ lịch sử loss (tham số thống kê trong
history). - Dự đoán trên dải giá trị mã lực và vẽ đường cong hồi quy.
- Đánh giá hiệu suất trên tập test bằng
evaluate().