Hi,
I am using theano to do a simple Logistic Regression on the Iris Dataset.
I am running into an issue. I am pretty sure I am doing something wrong. 
Not sure what 

Error Message?

<TensorType(int64, scalar)>

Traceback (most recent call last):

  File "iris_logistic_sgd.py", line 520, in <module>

    lgst.sgd_optimization_mnist()

  File "iris_logistic_sgd.py", line 358, in sgd_optimization_mnist

    y: test_set_y[index * batch_size: (index + 1) * batch_size]

  File "/usr/local/lib/python2.7/dist-packages/theano/compile/function.py", 
line 320, in function

    output_keys=output_keys)

  File "/usr/local/lib/python2.7/dist-packages/theano/compile/pfunc.py", 
line 479, in pfunc

    output_keys=output_keys)

  File 
"/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py", 
line 1776, in orig_function

    output_keys=output_keys).create(

  File 
"/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py", 
line 1415, in __init__

    self._check_unused_inputs(inputs, outputs, on_unused_input)

  File 
"/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py", 
line 1553, in _check_unused_inputs

    i.variable, err_msg))

theano.compile.function_module.UnusedInputError: theano.function was asked 
to create a function computing outputs given certain inputs, but the 
provided input variable at index 0 is not part of the computational graph 
needed to compute the outputs: <TensorType(int64, scalar)>.

To make this error into a warning, you can pass the parameter 
on_unused_input='warn' to theano.function. To disable it completely, use 
on_unused_input='ignore'.




-------Code---------------

    datasets = self.load_data(dataset)


        train_set_x, train_set_y = datasets[0]

        valid_set_x, valid_set_y = datasets[1]

        test_set_x, test_set_y = datasets[2]



        # compute number of minibatches for training, validation and testing

        n_train_batches = train_set_x.get_value(borrow=True).shape[0] // 
batch_size

        n_valid_batches = valid_set_x.get_value(borrow=True).shape[0] // 
batch_size

        n_test_batches = test_set_x.get_value(borrow=True).shape[0] // 
batch_size



        ######################

        # BUILD ACTUAL MODEL #

        ######################


        # allocate symbolic variables for the data

        index = T.lscalar()   # index to a [mini]batch


        print (index)

        # generate symbolic variables for input (x and y represent a

        # minibatch)

        x = T.matrix('x')  # data, presented as rasterized images

        y = T.ivector('y')  # labels, presented as 1D vector of [int] labels


        # construct the logistic regression class

        # Each MNIST image has size 28*28

        classifier = LogisticRegression(input=x, n_in=28 * 28, n_out=10)


        # the cost we minimize during training is the negative log 
likelihood of

        # the model in symbolic format

        cost = classifier.negative_log_likelihood(y)


        # compiling a Theano function that computes the mistakes that are 
made by

        # the model on a minibatch

        #print ('------->>', index.eval())

        #print ('------>', test_set_y[index * batch_size: (index + 1) * 
batch_size].eval() )

        #return


        #index = 0

        test_model = theano.function(

            inputs=[index],

            outputs=classifier.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]

                }

                )
Please advice

-- 

--- 
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