A_0xl 2021-07-02 15:44 采纳率: 33.3%
浏览 153

构建神经网络模型报错<class 'int'>,

model.compile(loss='binary_crossentropy', 
              optimizer='adam',
              metrics=['accuracy'])

train_history = model.fit(x_train,y_train,batch_size=100,
                          epochs=1,verbose=2,
                          validation_split=0.2)

然后就好多<class 'int'>,,之前也建立CNN模型,一切都正常,不知道这次是怎么回事

<ipython-input-38-a4c83fbcf656> in <module>
      1 train_history = model.fit(x_train,y_train,batch_size=100,
      2                           epochs=1,verbose=2,
----> 3                           validation_split=0.2)

~\anaconda3\envs\ten\lib\site-packages\tensorflow\python\keras\engine\training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq, max_queue_size, workers, use_multiprocessing)
   1039       (x, y, sample_weight), validation_data = (
   1040           data_adapter.train_validation_split(
-> 1041               (x, y, sample_weight), validation_split=validation_split))
   1042 
   1043     if validation_data:

~\anaconda3\envs\ten\lib\site-packages\tensorflow\python\keras\engine\data_adapter.py in train_validation_split(arrays, validation_split)
   1357     raise ValueError(
   1358         "`validation_split` is only supported for Tensors or NumPy "
-> 1359         "arrays, found following types in the input: {}".format(unsplitable))
   1360 
   1361   if all(t is None for t in flat_arrays):

ValueError: `validation_split` is only supported for Tensors or NumPy arrays, found following types in the input: [<class 'int'>,

  • 写回答

2条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥20 不会做,找个好心人帮做,有偿,只要答案,不要说废话
      • ¥15 html页面铺满及插入音乐
      • ¥15 T5模型代码问题求助
      • ¥15 JSON文件存入数据库mysql/MongoDB
      • ¥15 C++实现更大的整数类
      • ¥15 Python怎么实现加减乘除乘方和阶乘呀
      • ¥15 centos8-arm64平台编译安装ray分布式计算框架。
      • ¥20 求帮做一个安卓app,用Android Studio制作。需要整个项目文件。
      • ¥15 使用深度学习对于楼梯尺寸进行检测
      • ¥15 特别是3和4 帮帮忙