KeyError Traceback (most recent call last)
Cell In[27], 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[26], line 31, in prob_of_X_given_C(X, features, breed, params_dict)
28 match feature_name:
29 case “height” | “weight”:
30 # Get the relevant parameters out of the params_dict dictionary
—> 31 mu = params_dict[feature_name][feature_val][‘mu’]
32 sigma = params_dict[feature_name][feature_val][‘sigma’]
34 # Compute the relevant pdf given the distribution and the estimated parameters
KeyError: ‘height’