python - 如何解决以下错误:ValueError: Found array with 0 sample(s) (shape=(0,)) while a minimum of 1 is required
问题描述
我正在尝试训练 CNN 模型,在第一个 epoch 之后出现以下错误:
ValueError:找到包含 0 个样本(形状 =(0,))的数组,而至少需要 1 个。
看起来它正在抱怨以下行:
X = onehot.transform(df.iloc[start_index: end_index][['Num1','Num2']])
解决方案
检查 start_index 和 end_index。
我认为 start_index 大于 end_index,或者 start_index 大于样本数。
推荐阅读
- excel - SSIS:如何替换星号,数据类型DT_R8,excel源码
- ios - PKCanvasView 如何在 iOS 13 [objC] 中获取位置和压力?
- java - com.parse.ParseException: java.lang.ClassCastException: org.json.JSONObject$1 不能转换为 java.lang.String
- git - 拉取请求相对于拉取和合并一个分支到另一个的优势
- mysql - 可以通过 mysql 工作台连接到远程 mysql 数据库,但不能通过 mysql2 (NodeJS)
- oracle - 如何将包含 csv 文件的许多列导入 SQL Plus
- r - 如何在R中的指数方程中获得x的值
- python - NLP - 亚马逊评论特征提取
- sql - SQL JSON:使用 sql 查询 FOR JSON 在自定义节点下嵌套几个节点
- java - 如何在一个类中有多个构造函数?