<jupyter_start><jupyter_text>The function get_sum_metrics takes two arguments: a prediction and a list of metrics to apply to the prediction (say, for instance, the accuracy or the precision). Note that each metric is a function, not a number. The function should compute each of the metrics for the prediction and sum them. It should also add to this sum three default metrics, in this case, adding 0, 1 or 2 to the prediction.<jupyter_code>def get_sum_metrics(predictions, metrics=[]):
    for i in range(3):
        metrics.append(lambda x: x + i)

    sum_metrics = 0
    for metric in metrics:
        sum_metrics += metric(predictions)

    return sum_metrics
def main():
    print(get_sum_metrics(0))  # Should be (0 + 0) + (0 + 1) + (0 + 2) = 3
    print(get_sum_metrics(1))  # Should be (1 + 0) + (1 + 1) + (1 + 2) = 6
    print(get_sum_metrics(2))  # Should be (2 + 0) + (2 + 1) + (2 + 2) = 9
    print(get_sum_metrics(3, [lambda x: x]))  # Should be (3) + (3 + 0) + (3 + 1) + (3 + 2) = 15
    print(get_sum_metrics(0))  # Should be (0 + 0) + (0 + 1) + (0 + 2) = 3
    print(get_sum_metrics(1))  # Should be (1 + 0) + (1 + 1) + (1 + 2) = 6
    print(get_sum_metrics(2))  # Should be (2 + 0) + (2 + 1) + (2 + 2) = 9

if __name__ == "__main__":
    main()
import pdb; pdb.set_trace()<jupyter_output>--Call--
> c:\users\adelarosa\appdata\local\continuum\anaconda3\lib\site-packages\ipython\core\displayhook.py(252)__call__()
-> def __call__(self, result=None):
{'fraction_non_alphanumeric': 0.1445126107702795, 'fraction_numerical': 0.04567143830947512, 'mean_word_length': 3.4216867469879517, 'pattern_counts': {'":': 1, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '158101', 'license': 'Unlicense', 'n_tokens_mistral': 569, 'n_tokens_neox': 532, 'n_words': 178, 'path': 'Machine-Learning-with-Python- From-LM-to-DL/Unit 0. Course Introduction/project0/04_Debugging_Exercise.ipynb', 'repo_name': 'andresdelarosa1887/Public-Projects', 'size': '1467'}