(1) When the Sklearn is used for logistic regression, the model is established, because the amount of data to be predicted is very large and cannot be predicted all at once, only one sample data can be predicted at a time.
Occurs each time you enter data as a list to make predictions:
/Users/donganlan/anaconda/lib/python2.7/site-packages/sklearn/utils/validation.py:386:
DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and willraise ValueError in 0.19.
Reshape your data either using X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1)
if it contains a single sample. DeprecationWarning)
解决办法:将输入数据由列表形式改成shape(1,-1)形式
For lineIn HP:
line = re.sub (r ' \\n ', ' 0 ', line)
Linearr = Line.strip (). Split ( ", ')
Xpredict = [float (i) for i in linearr][2:118]
xpredictnd =np.array (Xpredict). Reshape ( Span style= "color: #ae81ff;" >1,-= Grid.predict (xpredictnd)
Python error codes and workarounds