我正在尝试将一个feature
和label
numpy 数组传递到train_test_split
. 这些功能是单列(日期时间 dtype 转换为整数)。labels
数组中有 900 个观测值。
features.shape
返回(1101, 1)
labels.shape
返回(1101, 900)
在拆分成特征和标签数组之前,我这样做df.fillna(0, inplace=True)
是因为我认为NaN
最初的问题是值。
这是我正在运行的块:
my_tpot = TPOTRegressor()
X_train, X_test, y_train, y_test = train_test_split(pd.np.array(features), pd.np.array(labels),train_size=0.75, test_size=0.25)
tpot = TPOTRegressor(generations=5, population_size=20, verbosity=2)
tpot.fit(X_train, y_train)
异常发生就train_test_split
行了。这是一个例外:
ValueError: Error: Input data is not in a valid format. Please confirm that the input data is scikit-learn compatible. For example, the features must be a 2-D array and target labels must be a 1-D array.
这是什么原因造成的?