Open hughiephan opened 9 months ago
I create a pull request to tackle above problem https://github.com/matthewwicker/deepbayes/pull/2 . But there are still some errors as well (not directly related to numpy)
InvalidArgumentError: {{function_node __wrapped__Squeeze_device_/job:localhost/replica:0/task:0/device:CPU:0}} Can not squeeze dim[1], expected a dimension of 1, got 2 [Op:Squeeze] name:
Could be related to your tutorials as well, X_train and X_test both needs to be reshape like this X_train = X_train.astype("float32").reshape(-1, 1, 28*28)
instead of X_train = X_train.astype("float64").reshape(-1, 28*28)
Above PR is also fixing the following bug
VariationalOnlineGuassNewton' object has no attribute 'set_weights'
Just a quick change from model.set_weights
to model.model.set_weights
The error is also the same for model._predict
in verifiers.py and we need to change it to model.model._predict
. But one problem is that _predict
is for your custom PosteriorModel class and won't work with the default Sequential model where it is using predict
function (not _predict
)
Working version: https://www.kaggle.com/hughiephan/robustness-with-deep-bayesian
Regarding the error The requested array has an inhomogeneous shape after 1 dimensions. The detected shape was (4,) + inhomogeneous part
, as mentioned above, we need to modify the codebase where numpy.array([....])
, was used and change it to numpy.array([....], dtype=object)
. Example of that can be seen here: https://github.com/matthewwicker/deepbayes/pull/2/files#diff-2f2d1176939dbe25f9ffdef7cff879a97ad35f8c6caeffcd0227b94bca657403
Other than that, I believe a new fully-working version will be published around next month where all the problems here will be fixed.
Hi assistant professor @matthewwicker , I was trying to re-implemented the paper "Individual Fairness in Bayesian Neural Networks" but I get the following error
I believe doing something like numpy.array([....], dtype=object) should fix it. My notebook with above error could be found here: https://www.kaggle.com/code/hughiephan/fgsm-bayesian-neural-networks-failed