{"id":387,"date":"2014-07-25T17:03:42","date_gmt":"2014-07-25T08:03:42","guid":{"rendered":"http:\/\/blog.ymyzk.com\/?p=387"},"modified":"2014-12-03T10:08:39","modified_gmt":"2014-12-03T01:08:39","slug":"debian-7-wheezy-scikit-learn","status":"publish","type":"post","link":"https:\/\/blog.ymyzk.com\/2014\/07\/debian-7-wheezy-scikit-learn\/","title":{"rendered":"Debian 7 wheezy \u306b scikit-learn \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b (virtualenv \u5bfe\u5fdc)"},"content":{"rendered":"
Debian 7 wheezy \u306b Python \u7528\u306e\u6a5f\u68b0\u5b66\u7fd2\u30e9\u30a4\u30d6\u30e9\u30ea\u00a0scikit-learn \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u624b\u9806\u3092\u307e\u3068\u3081\u307e\u3059. scikit-learn \u306f numpy \u3084 scipy \u306b\u4f9d\u5b58\u3059\u308b\u305f\u3081, \u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u624b\u9806\u304c\u5c11\u3057\u8907\u96d1\u306b\u306a\u308a\u307e\u3059.<\/p>\n
<\/p>\n
Python \u3084 GCC, Fortran \u306a\u3069\u306e scikit-learn \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3092 apt \u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059.
\nvirtualenv \u306b\u3064\u3044\u3066\u306f apt \u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3082\u306e\u3067\u3082, pip \u7b49\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3082\u306e\u3067\u3082\u69cb\u3044\u307e\u305b\u3093.
\nnumpy, scipy, scikit-learn \u306b\u3064\u3044\u3066\u306f\u6700\u65b0\u306e\u3082\u306e\u3092\u5229\u7528\u3059\u308b\u305f\u3081\u306b, pip \u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059.<\/p>\n
\r\nsudo aptitude update\r\n# Python\r\nsudo aptitude install python-dev python-virtualenv\r\n# GCC etc...\r\nsudo aptitude install build-essential\r\n# Fortran\r\nsudo aptitude install gfortran libatlas-dev libatlas3gf-base liblapack-dev\r\nsudo update-alternatives --set libblas.so.3 \/usr\/lib\/atlas-base\/atlas\/libblas.so.3\r\nsudo update-alternatives --set liblapack.so.3 \/usr\/lib\/atlas-base\/atlas\/liblapack.so.3\r\n<\/pre>\n\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n
virtualenv \u3067\u4eee\u60f3\u74b0\u5883\u3092\u4f5c\u6210\u3057, \u305d\u3053\u306b numpy, scipy, scikit-learn \u306e\u9806\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u3044\u304d\u307e\u3059.<\/p>\n
\r\nvirtualenv venv\r\nsource venv\/bin\/activate\r\npip install numpy scipy scikit-learn\r\n<\/pre>\n\u30c6\u30b9\u30c8<\/h2>\n
scikit-learn \u306e Tutorial \u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u3066\u307f\u307e\u3059.
\nSVM \u3092\u4f7f\u3063\u305f\u30b5\u30f3\u30d7\u30eb\u30c7\u30fc\u30bf\u30bb\u30c3\u30c8\u306e\u6570\u5b57\u306e\u8b58\u5225\u3067\u3059.<\/p>\n\r\n$ python\r\nPython 2.7.3 (default, Mar 13 2014, 11:03:55)\r\n[GCC 4.7.2] on linux2\r\nType "help", "copyright", "credits" or "license" for more information.\r\n>>> from sklearn import datasets, svm\r\n>>> digits = datasets.load_digits()\r\n>>> clf = svm.SVC(gamma=0.001, C=100.)\r\n>>> clf.fit(digits.data[:-1], digits.target[:-1])\r\nSVC(C=100.0, cache_size=200, class_weight=None, coef0=0.0, degree=3,\r\n gamma=0.001, kernel='rbf', max_iter=-1, probability=False,\r\n random_state=None, shrinking=True, tol=0.001, verbose=False)\r\n>>> clf.predict(digits.data[-1])\r\narray([8])\r\n<\/pre>\n\u53c2\u8003<\/h2>\n
\n
- Installing scikit-learn<\/a><\/li>\n
- Building From Source on Linux \u2014 SciPy.org<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"
Debian 7 wheezy \u306b Python \u7528\u306e\u6a5f\u68b0\u5b66\u7fd2\u30e9\u30a4\u30d6\u30e9\u30ea\u00a0scikit-learn \u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u624b\u9806\u3092\u307e\u3068\u3081\u307e\u3059. scikit-learn \u306f numpy \u3084 scipy \u306b\u4f9d\u5b58\u3059\u308b\u305f\u3081, \u30a4\u30f3\u30b9 […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26,3],"tags":[16,52,15],"_links":{"self":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/387"}],"collection":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/comments?post=387"}],"version-history":[{"count":11,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/387\/revisions"}],"predecessor-version":[{"id":673,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/posts\/387\/revisions\/673"}],"wp:attachment":[{"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/media?parent=387"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/categories?post=387"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ymyzk.com\/wp-json\/wp\/v2\/tags?post=387"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}