[FAQ] Homework 6 Q4: How do I calculate mean RMSE when selecting max_depth?
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 1/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 70/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- documentation, machine-learning
Hướng nghiên cứu
Câu trả lời FAQ đã được soạn sẵn trong nội dung issue, nên công việc là đối chiếu nó với liên kết nguồn, Homework 6 Câu hỏi 4 trong cohorts/2026/homework/06-trees/homework.md. Chạy đoạn mã groupby của pandas để xác nhận các giá trị trung bình minh họa 2.2 và 2.3. Công việc hoàn thành khi câu trả lời được xác nhận là chính xác hoặc đã được sửa, và mục FAQ sẵn sàng để thêm vào.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Course
machine-learning-zoomcamp
Question
How do I calculate mean RMSE when selecting max_depth in Homework 6 Q4? Should
I choose the best individual forest, average predictions, or average the RMSE
scores for each depth?
Answer
Average the four validation RMSE scores for each fixed depth, then select
the depth with the lowest mean. Keep the individual RMSE values at full
precision until after calculating the mean.
In the 2026 assignment, each max_depth in [10, 15, 20, 25] is evaluated with
n_estimators in [10, 50, 100, 150], with random_state=1. This produces
16 models, four validation RMSE values per depth, and four depth-level means.
Use the same prepared training and validation data for every model.
For a fixed depth d, the comparison score is:
mean_rmse(d) = (rmse(d, 10) + rmse(d, 50) + rmse(d, 100) + rmse(d, 150)) / 4
Here is a small, runnable example using hypothetical scores and a smaller
grid, not the homework results:
import pandas as pd
scores = pd.DataFrame([
{"max_depth": 2, "n_estimators": 5, "val_rmse": 2.1},
{"max_depth": 2, "n_estimators": 15, "val_rmse": 2.3},
{"max_depth": 3, "n_estimators": 5, "val_rmse": 1.8},
{"max_depth": 3, "n_estimators": 15, "val_rmse": 2.8},
])
mean_rmse = scores.groupby("max_depth")["val_rmse"].mean()
print(mean_rmse.round(6)) # Round only for display.
The illustrative means are 2.2 for depth 2 and 2.3 for depth 3. Although depth 3
contains the best individual model (RMSE 1.8), depth 2 has the lower mean.
Do not replace this calculation with:
- The minimum RMSE for each depth, or the best single depth/size combination.
- The mean of the predictions from several forests; that evaluates a different
ensemble model. - The square root of the mean of the four MSE values; the square root is
nonlinear, so this generally differs from the arithmetic mean of four RMSEs.
If depth-level means tie, report the tie and follow any explicit assignment or
maintainer guidance. The example above intentionally has a unique minimum.
Source: 2026 Homework 6, Question 4.
Checklist
- I have searched existing FAQs and this question is not already answered
- The answer provides accurate, helpful information
- I have included any relevant code examples or links
- Ngôn ngữ chính
- Python
- Star
- 8
- Fork
- 20
- Merge trung bình
- 6 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của DataTalksClub/faq
-
Fixing ValueError: feature_names must not contain [, ], or < in XGBoostCó thể đã có người làm @github-actions đã nhận 4 ngày trước. Đang mởfaq-proposal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
DataTalksClub/faq#536 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
How to fix uv warning: VIRTUAL_ENV does not match the project environment pathCó thể đã có người làm @github-actions đã nhận 4 ngày trước. Đang mởfaq-proposal
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
DataTalksClub/faq#534 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Fixing ValueError: This solver needs samples of at least 2 classes in Logistic RegressionCó thể đã có người làm @github-actions đã nhận 4 ngày trước. Đang mởfaq-proposal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
DataTalksClub/faq#532 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 60/100
DataTalksClub/faq#531 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[FAQ] omework 5 (2026): Why does `/predict` return 200 OK for `"Paid_Ads"`, `"tiktok"` or a negative count, and how do I reject bad input?Có thể đã có người làm @github-actions đã nhận 5 ngày trước. Đang mởfaq-proposal
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
DataTalksClub/faq#524 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của DataTalksClub/faq
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
unionai-oss/pandera#2640 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
JdeRobot/RoboticsInfrastructure#843 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
automated endpoint-dead needs-curation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
almanac-data/climate-almanac#122 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:harness enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
evarness-ai/iris-harness#420 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
suitenumerique/find#206 ·
Maintainer thường phản hồi trong vòng 2 ngày