====== Assignment: Ensembles ====== **📅 Deadline:** 31.12.2025 23:59 **🏦 Points:** 3 ===== Task Description ===== In this assignment, you are tasked with implementing the basic logic for training and evaluating **random forests** and **gradient boosted machines**. The implementation of the weak learners (random trees) is provided to you. You are provided with a {{ :courses:be4m33ssu:homeworks:hw_ensembling_template_22_11_2024.zip |template}} containing the following files: * **data.py**: Contains functions for loading of datasets and implementation of the Dataset class. You do not need to modify this file. * **ensembles.py**: Contains implementation of random forests and gradient boosted machines. It includes the methods **build_gbm**, **evaluate** of the GradientBoostedTrees class, and the methods **build_forest**, **evaluate** of the RandomForest class which you need to implement. * **main.py**: Runs experiments and saves data for BRUTE. You do not need to modify this file. * **tree.py**: Implements random trees. You do not need to modify this file. * **utils.py**: Contains helper functions for loading and saving data, plotting experiments, evaluating models and computing metrics. You do not need to modify this file. * **test-cases**: A folder containing public test cases to help you verify your implementation before submitting to [[https://cw.felk.cvut.cz/brute/student/course/BE4M33SSU/ensemble|BRUTE]]. Your objective is to implement the methods **build_gbm**, **evaluate** of the GradientBoostedTrees class, and the methods **build_forest**, **evaluate** of the RandomForest class in **ensembles.py**. All python files must be stored in the root of the .zip sent for submission. Note that the prediction of the GBM is a //weighted sum// not a //weighted mean// ===== How to Test ===== After completing your implementation, you can test your solution using the following commands before submitting it to BRUTE: ---- == Test Case 1 == python main.py test-cases/public/instances/instance_1.json Expected output: Gradient Boosted Machine: train_rmse: Test OK test_rmse: Test OK Random Forest: train_rmse: Test OK test_rmse: Test OK ---- == Test Case 2 == python main.py test-cases/public/instances/instance_2.json Expected output: Gradient Boosted Machine: train_rmse: Test OK test_rmse: Test OK Random Forest: train_rmse: Test OK test_rmse: Test OK ===== Submission Guidelines ===== * Submit the completed code as a .zip via BRUTE. * All python files must be stored in the root of the .zip sent for submission. * Make sure your implementation passes the test cases provided above. Good luck! 😊