終于折騰完了,一下午就折騰這個scikit learn。其實(shí),上次就已經(jīng)知道這個工具了,但苦于上次沒能安排。下午,老師出去上課,我就開始這個安裝。希望你可以很快的安裝。
前幾天,安裝python第三方庫時出現(xiàn)各種不兼容問題。在qq群里有人跟我說用easy_install。從那開始,在python安裝我都用這個了。一來比較方便。二來肯定是對的,不會出錯。
好了,進(jìn)入正題。
安裝前的準(zhǔn)備:
如果你安裝了easy_install就很方便了。沒有也沒關(guān)系,去下個setuptools。安裝好就可以了。其他的還需要安裝的是numpy,scipy,matplotlib等。
你可以按照順序去安裝,你在easy_install.exe的目錄下,一般在python安裝目錄下的scripts下。輸入easy_install numpy,剩下的你就看著就可以了。其他的也類似。還有就是matplotlib不是那么容易安裝的,你需要下載其他兩個才可以安裝成功。這兩個是:python-dateutil-1.5.win32-py2.7.exe和pyparsing-2.0.1.win32-py2.7.exe。這個安裝就一直點(diǎn)下去就可以了。
可以開始安裝了,繼續(xù)用easy_install scikit-learn。剩下就等待安裝完了。
測試:
你可以去下個user guide 。里面有一些簡單的可以測試的。還有就是其實(shí)user guide 里的例子程序可以在github里可以下到。我測試了一個plot_ols.py,結(jié)果是:
=========================================================
Linear Regression Example
=========================================================
This example uses the only the first feature of the `diabetes` dataset, in
order to illustrate a two-dimensional plot of this regression technique. The
straight line can be seen in the plot, showing how linear regression attempts
to draw a straight line that will best minimize the residual sum of squares
between the observed responses in the dataset, and the responses predicted by
the linear approximation.
The coefficients, the residual sum of squares and the variance score are also
calculated.
('Coefficients: \n', array([ 938.23786125]))
Residual sum of squares: 2548.07
Variance score: 0.47
備注:user guide 可以在google里找到。
附上一個介紹的網(wǎng)址:http://cbio.ensmp.fr/~nvaroquaux/scikit-learn/user_guide.html。
剩下的將開始我的python機(jī)器學(xué)習(xí)的旅程。安好……