我正在运行以下代码:
estimator = KerasClassifier(build_fn=baseline_model, epochs=5, batch_size=100, verbose=0)
kfold = StratifiedKFold(n_splits=5, shuffle=True, random_state=0)
#results = cross_val_score(estimator, x_train, y_train, cv=kfold, scoring='accuracy', n_jobs=1))
但是,我遇到了一个问题
InvalidArgumentError Traceback (most recent call last)
<ipython-input-43-2b316c99ac78> in <module>()
1 estimator = KerasClassifier(build_fn=baseline_model, epochs=5, batch_size=100, verbose=0)
2 kfold = StratifiedKFold(n_splits=5, shuffle=True, random_state=0)
----> 3 results = cross_val_score(estimator, x_train, y_train, cv=kfold, scoring='accuracy')#.fit(x_train, y_train)
16 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py in __call__(self, *args, **kwargs)
1456 ret = tf_session.TF_SessionRunCallable(self._session._session,
self._handle, args, run_metadata_ptr)
if run_metadata:
proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
InvalidArgumentError: indices[87,14] = -1 is not in [0, 5000)
[[{{node embedding_5/embedding_lookup}}]]
此代码在google colab中运行