lmjohns3 / theanets

Neural network toolkit for Python
http://theanets.rtfd.org
MIT License
328 stars 73 forks source link

'Regressor' object has no attribute 'x' when initializing a feedforward regressor #34

Closed small-yellow-duck closed 9 years ago

small-yellow-duck commented 9 years ago

I tried to initialize a feedforward regressor (code here: https://github.com/lmjohns3/theano-nets/issues/11, lmjohns3's first response). However, I get an error on this line:

e = theanets.Experiment(theanets.feedforward.Regressor, layers=(2, 20, 1), optimize='sgd', activation='tanh')

Here's the stack trace

Couldn't import dot_parser, loading of dot files will not be possible.
Traceback (most recent call last):
  File "simple_regression2.py", line 21, in <module>
    activation='tanh')
  File "/Users/user/python/theano-nets/theanets/main.py", line 89, in __init__
    self.network = self._build_network(network_class, **kw)
  File "/Users/user/python/theano-nets/theanets/main.py", line 101, in _build_network
    return network_class(**kwargs)
  File "/Users/user/python/theano-nets/theanets/feedforward.py", line 188, in __init__
    _, encode_count = self.setup_encoder(**kwargs)
  File "/Users/user/python/theano-nets/theanets/feedforward.py", line 226, in setup_encoder
    self.x,
AttributeError: 'Regressor' object has no attribute 'x'

I'm new to this package. Is there something I'm missing?

lmjohns3 commented 9 years ago

No, this is a bug -- thanks for the report!

I just addressed it with commit 356e1e17, please try to update from github and give it another go.