我在 Spyder 中使用 keras,我不小心更改了 core.py 文件并编译了它。当然,也出现了一些错误。然后我撤消了更改,但由于一些奇怪的原因,我使用该文件的实际代码出现以下错误。File "<ipython-input-18-18c6a7ab4e93>", line 1, in <module>runfile('F:/Python Codes/HFE/HCM_LSTM_LDA_1.py', wdir='F:/Python Codes/HFE')File "e:\ProgramData\Anaconda3\lib\site- packages\spyder_kernels\customize\spydercustomize.py", line 668, in runfileexecfile(filename, namespace)File "e:\ProgramData\Anaconda3\lib\site- packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfileexec(compile(f.read(), filename, 'exec'), namespace)File "F:/Python Codes/HFE/HCM_LSTM_LDA_1.py", line 195, in <module>classifier.add(Dense(1))File "e:\ProgramData\Anaconda3\lib\site- packages\keras\legacy\interfaces.py", line 91, in wrapperreturn func(*args, **kwargs)File "e:\ProgramData\Anaconda3\lib\site-packages\keras\layers\core.py", line 844, in __init__super(Dense, self).__init__(**kwargs)TypeError: super(type, obj): obj must be an instance or subtype of type现在我知道我的代码没有问题,即:#...from keras.layers import Dropout#...classifier = Sequential()classifier.add(LSTM(units = 100, activation = 'relu'))classifier.add(Dense(1))classifier.add(Dropout(0.0001)); classifier.add(Dense(1)) classifier.compile(optimizer = 'Nadam', loss ='mean_absolute_percentage_error', metrics = ['accuracy']) classifier.fit(Feature_train, Label_train, epochs=100, batch_size=168, verbose=2) #Fit classifierRNN_Predict=classifier.predict(Feature_test) 我撤销了对 core.py 文件所做的更改,但我想解决这个问题而不必卸载并重新安装所有内容
添加回答
举报
0/150
提交
取消