0

I just installed keras 1.1.2, using Windows 64-bit and Python 2.7.

The code

model = Sequential()
model.add(Dense(25, input_dim=50, init='uniform', activation='relu'))

returns the following error:

Traceback (most recent call last):
  File "C:\Loopy\lib\site-packages\IPython\core\interactiveshell.py", line 2827, in run_code
    exec code_obj in self.user_global_ns, self.user_ns
  File "<ipython-input-3-850dd91f408b>", line 30, in <module>
    model.add(Dense(25, input_dim=50, init='uniform', activation='relu'))
TypeError: __init__() got multiple values for keyword argument 'input_dim'

the code

model.add(Dense(15, init='uniform', activation='relu'))

returns:

Traceback (most recent call last):
  File "C:\Loopy\lib\site-packages\IPython\core\interactiveshell.py", line 2827, in run_code
    exec code_obj in self.user_global_ns, self.user_ns
  File "<ipython-input-4-85741da8f45c>", line 1, in <module>
    model.add(Dense(15, init='uniform', activation='relu'))
TypeError: __init__() takes at least 3 arguments (4 given)

2 Answers2

1

Try to upgrade your keras to latest 1.1.2 by using the following command:

pip install keras --upgrade

For a specific user: pip install --user keras --upgrade

Avijit Dasgupta
  • 2,055
  • 3
  • 22
  • 36
  • Thanks, but this didn't help - I already tried to uninstall it, and upgrade... Probably the issue is with Anaconda - the upgrade doesn't work on scipy upgrade: Failed to build scipy – Anastasia Sidorova Nov 30 '16 at 22:09
0

Have you tried to add the layers separately ? Input then Dense then Initializers and then Activation.
Other than that, try to use kernel_initializer='random_uniform'rather than init='uniform'.

KRYSEF
  • 98
  • 1
  • 7