Python Error codes and workarounds

Source: Internet
Author: User

(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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.