Reputation: 1
I'd like to use shape feature as a list in sklearn, is it possible? Using MLPClassifier
Given this input.
data=[{'forniture':1,'color':3, 'shape':[0.2,0.5,1.1]},
{'forniture':2,'color':0, 'shape':[0.2,0.7,0.9]},
{'forniture':2,'color':1, 'shape':[1.2,1.5,1.0]}]
pd.DataFrame(data)
Exit
forniture color shape
0 1 3 [0.2, 0.5, 1.1]
1 2 0 [0.2, 0.7, 0.9]
2 2 1 [1.2, 1.5, 1.0]
When I pass shape as argument in clf.fit():
TypeError: float() argument must be a string or a number, not 'list'
But I need the entire list, because it is the shape, I can not convert to scalar like Volume.
Any recomendation to fit with the shape and not volume?
Thanks, I really appreciate your help.
Upvotes: 0
Views: 1342
Reputation: 1003
Upon reading the documentation here: https://scikit-learn.org/stable/modules/generated/sklearn.neural_network.MLPClassifier.html#sklearn.neural_network.MLPClassifier.fit It does not seem like it is possible to pass a list to the fit() function. Did you consider breaking up the list to three columns? If so it is explained here: Split a Pandas column of lists into multiple columns
Upvotes: 3