bulbea icon indicating copy to clipboard operation
bulbea copied to clipboard

missing 1 required positional argument: 'units' ann.py rnn

Open EricBollar opened this issue 4 years ago • 2 comments

Hi, I have been trying to set this up and I receive this error after running the script in the readme. Please let me know how to fix; I am not very familiar with python. Thanks!

File "main.py", line 16, in rnn = RNN([1, 100, 100, 1]) # number of neurons in each layer File "/usr/local/lib/python3.7/site-packages/bulbea-0.1.0-py3.7.egg/bulbea/learn/models/ann.py", line 29, in init TypeError: init() missing 1 required positional argument: 'units'

The whole script:

import bulbea as bb share = bb.Share('WIKI', 'GOOGL') share.data

from bulbea.learn.evaluation import split Xtrain, Xtest, ytrain, ytest = split(share, 'Close', normalize = True)

import numpy as np Xtrain = np.reshape(Xtrain, (Xtrain.shape[0], Xtrain.shape[1], 1)) Xtest = np.reshape(Xtest, (Xtest.shape[0], Xtest.shape[1], 1))

from bulbea.learn.models import RNN rnn = RNN([1, 100, 100, 1]) # number of neurons in each layer rnn.fit(Xtrain, ytrain)

from sklearn.metrics import mean_squared_error p = rnn.predict(Xtest) mean_squared_error(ytest, p)

import matplotlib.pyplot as pplt pplt.plot(ytest) pplt.plot(p) pplt.show()

EricBollar avatar Dec 28 '20 04:12 EricBollar

Hi, I met the same problem as u. I have tried many methods to solve it but I failed. Did u solve it finally?

vickyxu2333 avatar Jan 18 '21 08:01 vickyxu2333

I had the same issue. I was able to work around it by modifying the ann.py script. I changes all occurrences of output_dim to units. Then you have to reinstall bulbea by running python setup.py install

mochman avatar Feb 26 '21 16:02 mochman