Ubuntu python2.7.6 scikit-learn

来源:互联网 发布:11选5软件 编辑:程序博客网 时间:2024/05/29 18:09

pip list查看下,发现已安装

http://scikit-learn.org/stable/tutorial/basic/tutorial.html#machine-learning-the-problem-setting    scikit-learn参考

中文翻译 http://blog.csdn.net/prom1201/article/details/51604271

An introduction to machine learning with scikit-learn

Machine learning: the problem setting  大概讲一下机器学习

Loading an example dataset

scikit-learn comes witha few standard datasets, for instance theiris anddigitsdatasets for classification and the boston house prices dataset for regression.

from sklearn import datasets
iris = datasets.load_iris()   #下载数据集
# print iris
digits = datasets.load_digits()


For instance, in the case of the digits dataset, digits.data gives access to the features that can be used to classify the digits samples:

print(digits.data)

[[  0.   0.   5. ...,   0.   0.   0.]
 [  0.   0.   0. ...,  10.   0.   0.]
 [  0.   0.   0. ...,  16.   9.   0.]
 ...,
 [  0.   0.   1. ...,   6.   0.   0.]
 [  0.   0.   2. ...,  12.   0.   0.]
 [  0.   0.  10. ...,  12.   1.   0.]]


and digits.target gives the ground truth for the digit dataset, thatis the number corresponding to each digit image that we are trying to learn:

print digits.target

[0 1 2 ..., 8 9 8]


Shape of the data arrays


deprecated---不赞成,反对


How do I fix PyDev “Undefined variable from import” errors?

回答:

I've got a Python project using PyDev in Eclipse, and PyDev keeps generating false errors for my code. I have a modulesettings that defines a settings object. I import that in moduleb and assign an attribute with:

from settings import settingssettings.main = object()

In some of my code--but not all of it, statements like:

from settings import settingsprint settings.main 

... generate "Undefined variable from import: main" messages in the Eclipse code error pane, even though the code runs without a problem. How can I correct these?


stackoverflow  Stack Overflow是一个与程序相关的IT技术问答网站。用户可以在网站免费提交问题,浏览问题,索引相关内容,在创建主页的时候使用简单的HTML。在问题页面,不会弹出任何广告,销售信息,JavaScript 窗口等。

The post marked as answer gives a workaround, not a solution.

This solution works for me:

  • Go to Window - Preferences - PyDev - Interpreters - Python Interpreter
  • Go to the Forced builtins tab
  • Click on New...
  • Type the name of the module (multiprocessing in my case) and clickOK

Not only will the error messages disappear, the module members will also be recognized.




原创粉丝点击