I should also add, in case it helps, I installed Theano (and Lasagne) using 
the two commands here:

http://lasagne.readthedocs.io/en/latest/user/installation.html#bleeding-edge-version

on the Lasagne documentation.

On Tuesday, November 22, 2016 at 9:38:34 PM UTC-8, Daniel Seita wrote:
>
> Hi all,
>
> I am attempting to follow the logistic regression example in the 
> documentation. Here is a subset of the code that people with correct theano 
> versions should be able to run:
>
> import numpy
>
> import theano
>
> import theano.tensor as T 
>
> rng = numpy.random
>
>
> N = 400
>
> feats = 784
>
>
> # generate a dataset: D = (input_values, target_class)
>
> D = (rng.randn(N, feats), rng.randint(size=N, low=0, high=2))
>
> training_steps = 10000
>
>
> # Declare Theano symbolic variables
>
> x = T.dmatrix("x")
>
> y = T.dvector("y")
>
>
> # initialize the weight vector w randomly this and the following bias 
> variable b
>
> # are shared so they keep their values between training iterations 
> (updates)
>
> w = theano.shared(rng.randn(feats), name="w")
>
> b = theano.shared(0., name="b")
>
>
> # Construct Theano expression graph
>
> p_1 = 1 / (1 + T.exp(-T.dot(x, w) - b))
>
> prediction = p_1 > 0.5
>
> xent = -y * T.log(p_1) - (1-y) * T.log(1-p_1)   # Cross-entropy loss 
> function 
>
> cost = xent.mean() + 0.01 * (w ** 2).sum()      # The cost to minimize 
> (w/regularization!)
>
> gw, gb = T.grad(cost, [w, b])                   # Compute gradient of cost 
> wrt w and b.
>
>
> predict = theano.function(
>
>     inputs=[x],
>
>     outputs=[prediction]
>
> )
>
> When running the above, I get the following error:
>
> ERROR (theano.gof.opt): Optimization failure due to: 
> LocalOptGroup(use_c_ger,use_c_gemv)
>
> ERROR (theano.gof.opt): node: 
> Gemv{no_inplace}(AllocEmpty{dtype='float64'}.0, TensorConstant{1.0}, x, w, 
> TensorConstant{0.0})
>
> ERROR (theano.gof.opt): TRACEBACK:
>
> ERROR (theano.gof.opt): Traceback (most recent call last):
>
>   File 
> "/Users/danielseita/anaconda2/lib/python2.7/site-packages/theano/gof/opt.py", 
> line 1922, in process_node
>
>     replacements = lopt.transform(node)
>
>   File 
> "/Users/danielseita/anaconda2/lib/python2.7/site-packages/theano/gof/opt.py", 
> line 1309, in transform
>
>     new_repl = opt.transform(node)
>
>   File 
> "/Users/danielseita/anaconda2/lib/python2.7/site-packages/theano/tensor/blas_c.py",
>  
> line 674, in use_c_gemv
>
>     if not config.blas.ldflags:
>
>   File 
> "/Users/danielseita/anaconda2/lib/python2.7/site-packages/theano/configparser.py",
>  
> line 328, in __get__
>
>     val_str = self.default()
>
>   File 
> "/Users/danielseita/anaconda2/lib/python2.7/site-packages/theano/configdefaults.py",
>  
> line 1258, in default_blas_ldflags
>
>     lib_path = blas_info.get('library_dirs', [])[0]
>
> IndexError: list index out of range
>
> Note that if I don't include the predict function in the code above, it 
> will work (i.e. the problem is with the function). The error message seems 
> to be related to blas (?) but I'm not sure how to fix it. I noticed 
> something similar here: 
> https://groups.google.com/forum/#!topic/theano-users/Lv-tmIOYqR4
>
> But that is with Python 3.4. I am using Python 2.7. In addition, what I 
> don't understand is that I can actually run functions from the Theano 
> documentation! Here's an example. I'm following the tutorial on "copying 
> functions" but this was chosen purely as an example. I run the following 
> lines:
>
> Python 2.7.12 |Anaconda 4.2.0 (x86_64)| (default, Jul  2 2016, 17:43:17) 
>
> Type "copyright", "credits" or "license" for more information.
>
>
> IPython 5.1.0 -- An enhanced Interactive Python.
>
> ?         -> Introduction and overview of IPython's features.
>
> %quickref -> Quick reference.
>
> help      -> Python's own help system.
>
> object?   -> Details about 'object', use 'object??' for extra details.
>
>
> In [*1*]: *import* *theano*
>
>
> In [*2*]: *import* *theano.tensor* *as* *T*
>
>
> In [*3*]: state = theano.shared(0)
>
>
> In [*4*]: inc = T.iscalar('inc')
>
>
> In [*5*]: accumulator = theano.function([inc], state, updates=[(state, 
> state+inc)])
>
>
> In [*6*]: accumulator(10)
>
> Out[*6*]: array(0)
>
>
> In [*7*]: *print*(state.get_value())
>
> 10
>
> Everything looks good! So I don't know why I can run some functions here 
> but not others. Any advice would be appreciated.
>
> Additional details:
>
> This is run on a Mac laptop, version 10.11.16 El Capitan
>
> My .theanorc file in the home directory:
>
> [global]
>
> floatX = float32
>
> ddevice = cpu
>
> I am NOT using a GPU, though my laptop has one (I just choose not to use 
> it out of simplicity for now). Here is my theano version:
>
> In [*1*]: *import* *theano*
>
>
> In [*2*]: theano.__version__
>
> Out[*2*]: '0.9.0dev4.dev-RELEASE'
>
> Let me know if there's any other information that would be helpful.
>
>
>

-- 

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