sci-kit learn: Reshape your data either using X.reshape(-1, 1)

后端 未结 6 1521
再見小時候
再見小時候 2021-02-04 20:56

I\'m training a python (2.7.11) classifier for text classification and while running I\'m getting a deprecated warning message that I don\'t know which line in my code is causin

6条回答
  •  天命终不由人
    2021-02-04 21:20

    It's:

    pred = clf.predict(vec);
    

    I used this in my code and it worked:

    #This makes it into a 2d array
    temp =  [2 ,70 ,90 ,1] #an instance
    temp = np.array(temp).reshape((1, -1))
    print(model.predict(temp))
    

提交回复
热议问题