股票预测案例中model.fit 运行错误,咋回事呢?

来源:9-6 实战(二)RNN股价预测

种草郭橐驼

2022-06-21

图片描述
之前程序没有问题:
图片描述
错误信息:

ValueError                                Traceback (most recent call last)
C:\Users\ADMINI~1\AppData\Local\Temp/ipykernel_3176/2240817477.py in <module>
      1 #train the model
----> 2 model.fit(X,y,batch_size=30,epochs=200)

C:\anaconda3\lib\site-packages\keras\utils\traceback_utils.py in error_handler(*args, **kwargs)
     65     except Exception as e:  # pylint: disable=broad-except
     66       filtered_tb = _process_traceback_frames(e.__traceback__)
---> 67       raise e.with_traceback(filtered_tb) from None
     68     finally:
     69       del filtered_tb

C:\anaconda3\lib\site-packages\keras\engine\data_adapter.py in select_data_adapter(x, y)
    983   if not adapter_cls:
    984     # TODO(scottzhu): This should be a less implementation-specific error.
--> 985     raise ValueError(
    986         "Failed to find data adapter that can handle "
    987         "input: {}, {}".format(

ValueError: Failed to find data adapter that can handle input: <class 'numpy.ndarray'>, (<class 'list'> containing values of types {"<class 'numpy.float64'>"})
写回答

1回答

flare_zhao

2022-06-21

检查下你的X和y的值,然后重新启动下软件重新运行试下

0
5
flare_zhao
回复
种草郭橐驼
同学,你好,这是tensorflow版本的问题,新版本确实没有了predict_class,也有解决方案,就是你找到的那个
2022-06-22
共5条回复

Python3入门人工智能 掌握机器学习+深度学习

人工智能基础全方位讲解,构建完整人工智能知识体系,带你入门AI

1946 学习 · 594 问题

查看课程