I got this error for this line of code which works in earlier notebook:

Hi @Rose_LUO ,
p1 is calculate by taken the number of examples in the subset divided by the total number of examples at a given node. Here is how to get the number of examples in the subset:
len(y[y==1])