DeepSurv icon indicating copy to clipboard operation
DeepSurv copied to clipboard

Error with a hint that don't know

Open hanxiaozhen2017 opened this issue 7 years ago • 3 comments

Hi All @jaredleekatzman ,

I got an error which I can not figure out why even after reading the hint.... Can anyone help?

In[44]: log = network.train(mypbc_Train,mypbc_Valid,n_epochs=50,validation_frequency=1) Traceback (most recent call last): File "/usr/lib64/python2.7/site-packages/IPython/core/interactiveshell.py", line 2882, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in log = network.train(mypbc_Train,mypbc_Valid,n_epochs=50,validation_frequency=1) File "/usr/lib/python2.7/site-packages/deepsurv/deep_surv.py", line 428, in train loss = train_fn(x_train, e_train) File "/usr/lib64/python2.7/site-packages/theano/compile/function_module.py", line 871, in call storage_map=getattr(self.fn, 'storage_map', None)) File "/usr/lib64/python2.7/site-packages/theano/gof/link.py", line 314, in raise_with_op reraise(exc_type, exc_value, exc_trace) File "/usr/lib64/python2.7/site-packages/theano/compile/function_module.py", line 859, in call outputs = self.fn() File "/usr/lib64/python2.7/site-packages/theano/gof/op.py", line 912, in rval r = p(n, [x[0] for x in i], o) File "/usr/lib64/python2.7/site-packages/theano/tensor/basic.py", line 5436, in perform z[0] = numpy.asarray(numpy.dot(x, y)) ValueError: shapes (234,6) and (10,10) not aligned: 6 (dim 1) != 10 (dim 0) Apply node that caused the error: dot(x, W) Toposort index: 8 Inputs types: [TensorType(float32, matrix), TensorType(float64, matrix)] Inputs shapes: [(234, 6), (10, 10)] Inputs strides: [(24, 4), (80, 8)] Inputs values: ['not shown', 'not shown'] Outputs clients: [[Elemwise{add,no_inplace}(dot.0, InplaceDimShuffle{x,0}.0), Elemwise{Composite{(i0 * (Abs(i1) + i2 + i3))}}[(0, 2)](TensorConstant{(1, 1) of 0.5}, Elemwise{add,no_inplace}.0, dot.0, InplaceDimShuffle{x,0}.0)]]

Backtrace when the node is created(use Theano flag traceback.limit=N to make it longer): File "", line 1, in log = network.train(mypbc_Train,mypbc_Valid,n_epochs=50,validation_frequency=1) File "/usr/lib/python2.7/site-packages/deepsurv/deep_surv.py", line 416, in train update_fn = update_fn, **kwargs File "/usr/lib/python2.7/site-packages/deepsurv/deep_surv.py", line 254, in _get_train_valid_fn learning_rate=learning_rate, **kwargs File "/usr/lib/python2.7/site-packages/deepsurv/deep_surv.py", line 201, in _get_loss_updates + regularize_layer_params(self.network, l2) * L2_reg File "/usr/lib/python2.7/site-packages/deepsurv/deep_surv.py", line 163, in _negative_log_likelihood risk = self.risk(deterministic) File "/usr/lib/python2.7/site-packages/deepsurv/deep_surv.py", line 563, in risk deterministic = deterministic) File "/usr/lib/python2.7/site-packages/lasagne/layers/helper.py", line 197, in get_output all_outputs[layer] = layer.get_output_for(layer_inputs, **kwargs) File "/usr/lib/python2.7/site-packages/lasagne/layers/dense.py", line 121, in get_output_for activation = T.dot(input, self.W)

HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.

Can anyone point out why this error happen? Many thanks!

hanxiaozhen2017 avatar Jan 12 '18 18:01 hanxiaozhen2017

What is mypbc_Train,mypbc_Valid? Hard to help without knowing the rest of your code.

dareneiri avatar Jan 12 '18 19:01 dareneiri

I agree with @dareneiri , it's hard to debug without knowing the code that you used to generate this error.

My guess from the line ValueError: shapes (234,6) and (10,10) not aligned: 6 (dim 1) != 10 (dim 0) is there is a problem with how you are setting up the input to the network. How many features (columns) are in your dataset x? And how big is your input network? (What is your hyper-parameter for x_in?

jaredleekatzman avatar Jan 14 '18 19:01 jaredleekatzman

Many thanks @dareneiri @jaredleekatzman for looking at this! I think I figured out why I got this error by reading other posts and issues. The probable reason is I didn't normalize the data and do the hyper parameter searching first. As for normalize the data, how about one of my covariates is categorical? Does normalize mean only for continuous data?

hanxiaozhen2017 avatar Jan 19 '18 14:01 hanxiaozhen2017