TensorFlow (Google) framework học máy mã nguồn mở. Cài đặt: pip install tensorflow. Tensor: mảng đa chiều.
Bài toán hồi quy: dự đoán biến liên tục. Dữ liệu Auto MPG: xe hơi thập niên 70-80. Dự đoán MPG.
Chạy trên Google Colab (Python trên trình duyệt, GPU miễn phí).
Ví dụ
print("Fit dữ liệu train vào mô hình")
history = hrspwr_model.fit(
train_features['Horsepower'], train_labels,
epochs=150,
verbose=0,
validation_split=0.3)
hist = pd.DataFrame(history.history)
hist['epoch'] = history.epoch
hist.tail()
Nguồn mã: TensorFlow Regression Tutorial
Đầu ra

Giải thích
- Huấn luyện dữ liệu bằng hàm
fit(). - Định số bước huấn luyện qua tham số
epochs. - Object
historylưu tiến độ thống kê huấn luyện. - Chuyển history thành DataFrame pandas.
- Hiển thị mẫu dữ liệu cuối (tail) và trực quan hóa.