---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/Users/pi/anaconda/lib/python3.5/site-packages/numpy/core/fromnumeric.py in size(a, axis)
2688 try:
-> 2689 return a.shape[axis]
2690 except AttributeError:
AttributeError: 'dict_keys' object has no attribute 'shape'
During handling of the above exception, another exception occurred:
IndexError Traceback (most recent call last)
<ipython-input-10-9f7390d76041> in <module>()
1 #Q2
2 a3.a3_main(wd_coeff=0, n_hid=10, n_iterations=70, lr_net=0.005, train_momentum=0.0, early_stopping=False,
----> 3 mini_batch_size=4)
/Users/pi/Downloads/HintonCoursera/Assignment Answers -- Sinclair (Python)/assignment3/assignment3.py in a3_main(self, wd_coeff, n_hid, n_iterations, lr_net, train_momentum, early_stopping, mini_batch_size)
369 if n_iterations != 0:
370 print ('Now testing the gradient on the whole training set... ')
--> 371 print("x")
372 nn.test_gradient(self.data_sets['training'])
373 nn.train(self.data_sets['training'])
/Users/pi/Downloads/HintonCoursera/Assignment Answers -- Sinclair (Python)/assignment3/assignment3.py in test_gradient(self, data)
279 self._d_loss_by_d_model(data['inputs'], data['targets'])
280 analytic_gradient_struct = self.theta_to_model(self.gradient)
--> 281 if np.size(analytic_gradient_struct.keys(), 0) != 2:
282 raise Exception('The object returned by def d_loss_by_d_model should have exactly two field names: '
283 '.input_to_hid and .hid_to_class')
/Users/pi/anaconda/lib/python3.5/site-packages/numpy/core/fromnumeric.py in size(a, axis)
2689 return a.shape[axis]
2690 except AttributeError:
-> 2691 return asarray(a).shape[axis]
2692
2693
IndexError: tuple index out of range