* I need to find out the value of the cost function ( the loss) for each 
sample.* My example code has something written like this.

test_model_error = theano.function([index], layer4.errors(y),
             givens={
                x: test_set_x[index * batch_size: (index + 1) * batch_size],
                y: test_set_y[index * batch_size: (index + 1) * 
batch_size]})

here layer4.errors(y) is giving the rate of prediction mistakes the model 
makes for a minibatch. But I need the value of the cost function which is 
defined in the code as 

cost = layer4.negative_log_likelihood(y)

How can a write a function which will give me the value of the cost 
function for a single sample ?
I have written something like this but it is not working.

test_model_cost = theano.function([sample_index], cost,
             givens={
                x: test_set_x[sample_index],
                y: test_set_y[sample_index]})

Also since y is not a shared variable its giving some error in "y: 
test_set_y[sample_index]".
Also can you tell me how to make y a shared variable....since y is a 
categorical array (containing the labels) its not allowing me to convert it 
into a shared variable.

PLEASE HELP ME....I NEED TO DO THIS...I HAVE A DEADLINE....

THANKS IN ADVANCE...

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to