我试图建立人工神经网络, 但它不起作用。 我该怎么做?
model = Sequential()
model.add(Dense(output_dim=12, input_dim=4, init='normal', activation='sigmoid'))
__main__:1: UserWarning: Update your `Dense` call to the Keras 2 API: `Dense(input_dim=4, activation="sigmoid", kernel_initializer="normal", units=12)`
model.add(Dense(output_dim=1, init='normal', activation='linear'))
model.compile(loss='mean_squared_error', optimizer='adam')
model.fit(X_train, Y_train, nb_epoch=1000, batch_size=100, verbose=0)
2019-09-25 22:11:17.983801: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/kimsohyeon/anaconda3/envs/tensorflow/lib/python3.5/site-packages/keras/engine/training.py", line 1039, in fit
validation_steps=validation_steps)
File "/Users/kimsohyeon/anaconda3/envs/tensorflow/lib/python3.5/site-packages/keras/engine/training_arrays.py", line 199, in fit_loop
outs = f(ins_batch)
File "/Users/kimsohyeon/anaconda3/envs/tensorflow/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 2721, in __call__
return self._legacy_call(inputs)
File "/Users/kimsohyeon/anaconda3/envs/tensorflow/lib/python3.5/site-packages/keras/backend/tensorflow_backend.py", line 2693, in _legacy_call
**self.session_kwargs)
File "/Users/kimsohyeon/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 895, in run
run_metadata_ptr)
File "/Users/kimsohyeon/anaconda3/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1097, in _run
np_val = np.asarray(subfeed_val, dtype=subfeed_dtype)
File "/Users/kimsohyeon/anaconda3/envs/tensorflow/lib/python3.5/site-packages/numpy/core/numeric.py", line 492, in asarray
return array(a, dtype, copy=False, order=order)
ValueError: could not convert string to float: 'MXHbacc3'
然后,删除conda虚拟环境并重新安装新的虚拟环境是个好主意吗?
>>> tf.__version__
'1.5.0