// Tree is empty, all target_values equal, default to zero
predictions.append([0])
else:
normalize_values_in_dict(votes)
y_proba = []
for j in range(1 + int(max(votes.keys()))):
if j in votes.keys():
y_proba.append(votes[j])
After Change
// Tree is empty, all target_values equal, default to zero
predictions.append([0])
else:
if sum(votes.values()) != 0:
normalize_values_in_dict(votes)
y_proba = [0] * (int(max(votes.keys())) + 1)
for key, value in votes.items():
y_proba[int(key)] = value
predictions.append(y_proba)