====== Assignment: Confidence Interval ======
**📅 Deadline:** 6.11.2025 21:59
**🏦 Points:** 2
===== Task Description =====
In this assignment, you are tasked with computing a confidence interval using the Hoeffding inequality. You can find the complete description of the assignment in the {{ :courses:be4m33ssu:homeworks:hw_assignment_confidence_interval_ws2025.pdf | Assignment PDF}}.
You are provided with a {{ :courses:be4m33ssu:homeworks:hw_confidence_interval_template_09_10_2024.zip |template}} containing the following files:
* **main.py**: This file includes the function **confidence_interval** that you are required to implement. It loads the input, verifies the correctness of the **confidence_interval** output, and writes the results to a file readable by the [[https://cw.felk.cvut.cz/brute/student/course/BE4M33SSU/confint|BRUTE]] system.
* **utils.py**: Contains helper functions for loading and saving data. 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/confint|BRUTE]].
Your objective is to implement the function **confidence_interval** in **main.py**.
Make sure that all the python files are stored in the root of the .zip sent for submission.
Note that the lower bound computed using the Hoeffding inequality may be negative, while loss functions typically return non-negative values. It is good practice to clamp the lower bound to 0, but solutions that return the value directly from the Hoeffding inequality without clamping are also accepted by BRUTE.
===== 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:
The true risk is in the interval [-0.30, 0.30] with probability atleast 0.95
Comparing with reference solution
Test OK
----
== Test Case 2 ==
python main.py test-cases/public/instances/instance_2.json
Expected output:
The true risk is in the interval [-0.61, 0.61] with probability atleast 0.95
Comparing with reference solution
Test OK
----
== Test Case 3 ==
python main.py test-cases/public/instances/instance_3.json
Expected output:
The true risk is in the interval [0.13, 0.37] with probability atleast 0.9
Comparing with reference solution
Test OK
----
== Test Case 4 ==
python main.py test-cases/public/instances/instance_4.json
Expected output:
The true risk is in the interval [-0.23, 0.75] with probability atleast 0.9
Comparing with reference solution
Test OK
----
== Test Case 5 ==
python main.py test-cases/public/instances/instance_5.json
Expected output:
The true risk is in the interval [0.06, 0.07] with probability atleast 0.95
Comparing with reference solution
Test OK
----
== Test Case 6 ==
python main.py test-cases/public/instances/instance_6.json
Expected output:
The true risk is in the interval [0.74, 0.82] with probability atleast 0.95
Comparing with reference solution
Test OK
===== Submission Guidelines =====
* Submit the completed code as a .zip via BRUTE.
* Make sure your implementation passes the test cases provided above. Good luck! 😊