kyle-dorman/bayesian-neural-network-blogpost

Index Error

parvezamu opened this issue · 1 comments

Code is not working for results_dict['min loss'].append("{:.2E}".format(Decimal(Y[Z[min_var_idx,idx],idx])))

Since I figured from the previous cell that Y = variance, Z = loss,
I changed the code to the below. It seems to work fine

idx = idxs[i]
logit_value = str(int(X[0,idx]))
#min_var_idx = np.argmin(Z[:,idx])
min_var_idx = np.argmin(Y[:,idx])
results_dict['wrong_logit_value'].append(logit_value)
results_dict['min variance'].append("{:.2E}".format(Decimal(Y[min_var_idx,idx])))
#print('min_var_idx', min_var_idx)
#print('idx', idx)
#print('Z[min_var_idx,idx]', Z[min_var_idx,idx]) # Y = variance, Z = loss
min_loss_idx = np.argmin(Z[:,idx])
print(type(Y[min_var_idx,idx]), type(Z[min_loss_idx, idx]))
results_dict['min loss'].append("{:.2E}".format(Z[min_loss_idx,idx]))

But some of the graphs afterwards come out different. I might have to look into it.