MLP 训练集中的 Scikit 使用列表

Scikit use list in train set for MLP

我想用以下数据训练神经网络(多感知器):

1              2              3             Other Field   Label
[1, 2, 3, 4]   [5, 6, 7, 8]   [9, 10, 11]   1234          5678
etc...

此处 123 是包含列表的列。其他两列只有数值。

只有我不断收到这个:

ValueError: setting an array element with a sequence.

这可能吗?

编辑:
我训练神经网络的代码如下:

from sklearn.neural_network import MLPClassifier
mlp = MLPClassifier(alpha=1e-5, hidden_layer_sizes=(10, 10), random_state=1)
mlp.fit(X_train, y_train)

这是我的火车数据的截图:

我的标签只有一列数字。

如果您的列表始终具有相同的长度,这只是将每个列表列拆分为四个单独的列的问题,如所描述的那样。 here:

# create a dataset
raw_data = {'score': [1,2,3], 
        'tags': [['apple','pear','guava'],['truck','car','plane'],['cat','dog','mouse']]}
df = pd.DataFrame(raw_data, columns = ['score', 'tags'])
# expand df.tags into its own dataframe
tags = df['tags'].apply(pd.Series)
# rename each variable
tags = tags.rename(columns = lambda x : 'tag_' + str(x))
# join the tags dataframe back to the original dataframe
df = pd.concat([df[:], tags[:]], axis=1)
df.drop('tags', inplace=True, axis=1)

如果不是,最佳答案可能是针对特定问题的。一种方法是通过填充填充值然后执行相同操作,将每个列表扩展到最长列表的长度。