import numpy
import keras.models
import tensorflow
seed = 7
numpy.random.seed(seed)
dataset = numpy.genfromtxt("student-por.csv",delimiter=";")
X = dataset[:,0:33]
Y = dataset[:,8]
model = Sequential()
model.add(Dense(12, input_dim=8, init='uniform', activation='relu'))
model.add(Dense(8, init='uniform', activation='relu'))
model.add(Dense(1, init='uniform', activation='sigmoid'))
# Compile model
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) # Fit the model
scores = model.evaluate(X,Y)
print("%s: %s" % (model.metrics_names[1], scores[1]*100))
Error :
#Exception 错误: #Using TensorFlow backend. #Traceback (most recent call last): # File "test.py", line 11, in # model = Sequential() #NameError: name 'Sequential' is not defined #很奇怪 他居然显示Sequential()有问题 我确认好多次我没打错了 引用库也不知道有什么问题
It is strange that he actually showed that there is a problem with Sequential (). I confirmed many times that I did not type the reference library incorrectly and did not know what was wrong.