ValueError: setting an array element with a sequence. while using SVM in scikit-learn

前端 未结 3 2001
無奈伤痛
無奈伤痛 2020-12-03 07:09

I have been working on scikit-learn SVMs for a binary classification problem. I have calculated the features of audio files and wrote them into a CSV file. This is how each

相关标签:
3条回答
  • 2020-12-03 07:46

    Finally I found the answer to my question with the help of some ideas from @larsmans and @eickenberg. The problem was that X_train did not have the same number of elements in all the arrays. So, it was not able to form a 2D array. Now that I have added an additional value to that array, the dimensionality matched for all the 1D arrays and X_train was able to form a 2D array. Thanks for the ideas guys!

    0 讨论(0)
  • 2020-12-03 07:48

    I had the same problem. The size of the data was consistent, so that did not help. What did work: clf.fit(list(X_train),Y_train)

    0 讨论(0)
  • 2020-12-03 08:05

    I see the error when X_train has n elements and all n elements are of not same size. Workaround is to make sure all n elements in the X_train are of same size either by padding or trimming techniques.

    0 讨论(0)
提交回复
热议问题