UnboundLocalError: local variable 'arrays' referenced before assignment

UnboundLocalError: local variable 'arrays' referenced before assignment

File "/home/hadoop/.conda/envs/pepper-py3/lib/python3.5/site-packages/keras/engine/training.py", line 125, in _standardize_input_data
    array = arrays[i]
UnboundLocalError: local variable 'arrays' referenced before assignment

https://stackoverflow.com/questions/46999519/keras-model-fit-unboundlocalerror#

https://stackoverflow.com/questions/47852818/keras-unboundlocalerror-local-variable-arrays-referenced-before-assignment-h

这是Keras中的一个bug。

方法一:

修改模型输入

UnboundLocalError: local variable 'arrays' referenced before assignment

原因:You are required to pass an numpy array. In first case it's a data frame while in case 2 it's a numpy array.

方法二:

改keras的库的内容:

UnboundLocalError: local variable 'arrays' referenced before assignment

我用了方法一,成功解决这个问题。