首页 > 解决方案 > 如何解决以下错误: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']])

标签: pythonneural-network

解决方案


检查 start_index 和 end_index。

我认为 start_index 大于 end_index,或者 start_index 大于样本数。


推荐阅读