0

I have written the following code in the spider environment, but I am facing the following error when running.

My Code:

import numpy as np
import keras
from keras import models



### Generate random training an testing sets

x_train = np.random.random((1000,20))
y_train = np.random.randint(low = 2 , size = (x_train.shape[0] , 1))

x_test = np.random.random((100,20))
y_test = np.random.randint(low = 2 , size = (100 , 1))


### Defining layers of the MLP model

m = keras.models.sequential()

the Error is :

m = keras.models.sequential()
Traceback (most recent call last):

  File "C:\Users\hossein\AppData\Local\Temp\ipykernel_464\416401841.py", line 1, in <module>
    m = keras.models.sequential()

TypeError: 'module' object is not callable
Klaus D.
  • 13,874
  • 5
  • 41
  • 48
hossein
  • 9
  • 1

1 Answers1

0

"module object is not callable. Python is telling that code trying to call something that cannot be called. What is my code trying to call?"

try

from tensorflow import keras
from keras.models import load_model
from keras.models import sequential

for reference TypeError: 'module' object is not callable

EDG956
  • 797
  • 8
  • 23
Ipythonate
  • 19
  • 5