Python Machine Learning

终逸仙
2023-12-01

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

晚上闲来无事,准备把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
 类似资料:

相关阅读

相关文章

相关问答