I am in the lab of the first week of the course of probability &Statistics for machine learning but I am getting this error in the exercise 6. I am not sure if I selected the correct parameters for the different cases:
UnboundLocalError Traceback (most recent call last)
Cell In[65], line 7
4 example_breed = df_test[[“breed”]].loc[0][“breed”]
5 print(f"Example dog has breed { example_breed**}** and features: height = { example_dog[‘height’]: .2f**}** , weight = { example_dog[‘weight’]: .2f**}** , bark_days = { example_dog[‘bark_days’]: .2f**}** , ear_head_ratio = { example_dog[‘ear_head_ratio’]: .2f**}** \n ")
----> 7 print(f"Probability of these features if dog is classified as breed 0: { prob_of_X_given_C([*example_dog], FEATURES, 0, train_params)} ")
8 print(f"Probability of these features if dog is classified as breed 1: { prob_of_X_given_C([*example_dog], FEATURES, 1, train_params)} ")
9 print(f"Probability of these features if dog is classified as breed 2: { prob_of_X_given_C([*example_dog], FEATURES, 2, train_params)} ")
Cell In[64], line 53, in prob_of_X_given_C(X, features, breed, params_dict)
50 probability_f = pdf_uniform(x, params.a, params.b)
52 # Multiply by probability of current feature
—> 53 probability *= probability_f
55 ### END CODE HERE ###
57 return probability
UnboundLocalError: local variable ‘probability_f’ referenced before assignment