Warning
This page is located in archive.

Assignment: Ensembles

📅 Deadline: 31.12.2024 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 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 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! 😊
courses/be4m33ssu/homeworks/hw_ensembles.txt · Last modified: 2025/01/20 13:00 by paplhjak