我正在尝试将一个feature和label数值数组传递给train_test_split。这些特性是单个列(datetime数据类型转换为integer)。labels数组中有900个观测值。
features.shape返回(1101, 1)
labels.shape返回(1101, 900)
在拆分成feature和label数组之前,我做了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.
是什么导致了这种情况?
发布于 2019-03-24 03:07:45
现在看来TPOT不能解决多标签回归问题,那是因为我的问题是,传入一个标签大小为(101, 900)的标签是行不通的。如果将其缩减为单个列,则代码可以正常工作。
https://stackoverflow.com/questions/55309176
复制相似问题