C3_W1_Assignment exercise 6 unexpected output

My code for exercise 6 is working but the output is different from the expected output, same for exercise 7

for exercise 6:

for exercise 7:

I am not sure what’s causing this. Also my (3.2) binomial generator was giving a slightly different output too, the graph looks a bit different may be that could be causing the issue since we are using generated values for this whole thing. I already thoroughly investigated, that couldn’t find the issue so just moved on

I feel like I’m just shooting arrows in the dark for this assignment, trying out a bunch of things and then moving on to the next thing when one of them works
I have been doing this assignment forever

1 Like

Dear @Jasjeet_Singh,

You are something wrong.
Send me your lab files to me by clicking on my profile image, then click on message.

Asking for help earlier would have been prudent.

1 Like

Yeah, I did thoroughly read through other people’s queries in order to help my own queries which did help but frustratingly I was having to go through old and current code within the same assignment because my new code wasn’t working as expected

1 Like

Dear @Jasjeet_Singh,
Hope your problem has been solved.

Hi all,
I have same issue here:
< Example dog has breed 1 and features: height = 28.63, weight = 21.56, bark_days = 13.00, ear_head_ratio = 0.27

Probability of these features if dog is classified as breed 0: 0.0
Probability of these features if dog is classified as breed 1: 0.0
Probability of these features if dog is classified as breed 2: 0.0

is there any one to help me figure out what is the issue here or the error I made getting to this results. Thanks in advance.

1 Like

Maybe reference the M4ML FAQ, it has some hints (as Topic 3) about this assignment:

1 Like


kindly trust that all what has been mentioned in this FAQ w/r to the code is already in place and the issue is still there.

1 Like

Update for those who find this topic later.

The issue here was a defect in the pmf_binomial() function.


I’m getting different values than expected output for Exercise 6 but not 0.

I used uniform.pdf(x, a, b) for the pdf_uniform function and one value was slightly different, a=2 and b=10 for value 5.4: 0.100

Expected was 0.125

Would this cause a difference in ex 6? All the other values are same as expected.

For ex 6 I’m getting 5.9…., 0.0……, 5.2….

1 Like

Because of how the uniform() function uses the loc and scale parameters, you might try using:
(x, a, b-a).


Thanks for your help, that fixed the problem. Have submitted now.

1 Like

Thanks for your report.

1 Like