Python Machine Learning

今天可能是写笔记写上瘾了吧。

晚上闲来无事,准备把Mac上面在书上要用的环境搭一下。最近可能是用编辑器用惯了,简直不想用IDE。

书上第一章大概介绍了一些基础知识,有监督和无监督学习以及增强学习。介绍了一下聚类呀分类呀以及evaluating这些。

然后是装环境。

Installing Python packages

书上是基于Python version >=3.4.3.It is recommended to use Python3. And the book provide a link for difference between 3.4 and 2.7.

https://wiki.python.org/moin/Python2orPython3

But my Mac already has python 2.7 and I dont wanna install another version anymore. So I decide use 2.7 first. I would like install python3 if there are some problems with the version in the future.

Intall pip
sudo easy_install pip;

And here are some package we should install too.

  • NumPy 1.9.1
  • SciPy 0.14.0
  • scikit-learn 0.15.2
  • matplotlib 1.4.0
  • pandas 0.15.2
Install Numpy
pip install numpy
Install SciPy

We need gfortran to compile SciPy but it is not included with the other Xcode tools. Luckily, Homebrew can help us out again:

brew install gfortran

which might updating your homebrew first.

I have an error bellow:

Error: No available formula with the name "gfortran" 
GNU Fortran is now provided as part of GCC, and can be installed with:
brew install gcc

but i already got a gcc in my mac.
i’ll try just install scipy first.
that’s done it’s a cinch to install Scipy

pip install scipy
Install matplotlib
brew install pkg-config
pip install matplotlib
Install scikit-learn
sudo pip install sklearn
Install pandas
sudo pip install pandas

when its all done, the following should work in Python with no errors:

import numpy
import scipy
import matplotlib
import sklearn
import pandas
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值