Preprocessing in scikit learn - single sample - Depreciation warning

前端 未结 6 2091
礼貌的吻别
礼貌的吻别 2020-11-27 05:01

On a fresh installation of Anaconda under Ubuntu... I am preprocessing my data in various ways prior to a classification task using Scikit-Learn.

from sklear         


        
6条回答
  •  长情又很酷
    2020-11-27 06:00

    Well, it actually looks like the warning is telling you what to do.

    As part of sklearn.pipeline stages' uniform interfaces, as a rule of thumb:

    • when you see X, it should be an np.array with two dimensions

    • when you see y, it should be an np.array with a single dimension.

    Here, therefore, you should consider the following:

    temp = [1,2,3,4,5,5,6,....................,7]
    # This makes it into a 2d array
    temp = np.array(temp).reshape((len(temp), 1))
    temp = scaler.transform(temp)
    

提交回复
热议问题