====== Assignment: Maximum Likelihood ======
**📅 Deadline:** 1.1.2025 21:59
**🏦 Points:** 4
===== Task Description =====
In this assignment, you are tasked with implementing a maximum-likelihood estimator for a Gaussian mixture model, computing the plugin Bayes classifier and estimating the conditional risk of the prediction. You can find the complete description of the assignment in the Assignment {{ :courses:be4m33ssu:homeworks:hw_assignment_ml_plugin.pdf | PDF}}.
You are provided with a {{ :courses:be4m33ssu:homeworks:hw_maximum_likelihood_template_03_12_2024.zip |template}} containing the following files:
* **main.py**: This file includes the functions **MLE_parameters**, **bayes_classifier** that you are required to implement.
* **utils.py**: Contains helper functions for loading and saving data, and visualizations. 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/mle|BRUTE]].
Your objective is to implement the function **MLE_parameters**, which estimates the parameters of the Gaussian mixture, and the function **bayes_classifier** which implements the plugin-bayes classifier. Both functions can be found in **main.py**.
All python files must be stored in the root of the .zip sent for submission.
===== 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 --plot
Expected output:
Visualizing Gaussian Mixture ...
Maximum Likelihood Estimate:
class_priors: Test OK
class_centroids: Test OK
shared_covariance_matrix: Test OK
Bayes Classifier:
predictions: Test OK
risks: Test OK
Visualizing Conditional Risk ...
----
== Test Case 2 ==
python main.py test-cases/public/instances/instance_2.json --plot
Expected output:
Visualizing Gaussian Mixture ...
Maximum Likelihood Estimate:
class_priors: Test OK
class_centroids: Test OK
shared_covariance_matrix: Test OK
Bayes Classifier:
predictions: Test OK
risks: Test OK
Visualizing Conditional Risk ...
----
== Test Case 3 ==
python main.py test-cases/public/instances/instance_3.json
Expected output:
Maximum Likelihood Estimate:
class_priors: Test OK
class_centroids: Test OK
shared_covariance_matrix: Test OK
Bayes Classifier:
predictions: Test OK
risks: Test OK
Note that this test case is not 2 dimensional. Therefore, we do not visualize it.
===== 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! 😊