Prepare for machine learning using Python
The machine learning getting started book "Machine Learning Practice" uses the python language. The following describes how to use Python to prepare for machine learning. (Environment: CentOS 7)
1. Two important packages
NumPy and SciPy. (Http://scipy.org/scipylib/download.html) is mainly to deal with numerical operations, matrix operations and so on.
Note: Sci is short for Science.
The official website introduces the installation method, which can be manually installed or yum. (Numpy and scipy are provided in the default software source)
It should be noted that scipy depends on numpy. If you install it manually, install numpy first. If yum is used, the dependency is automatically processed.
Note: You can use yum info *** to check whether the software is provided in the software source. For example
2. 2D drawing: Matplotlib
This can also be obtained in yum,
sudo yum install python-matplotlib
If you use matplotlib in interactive mode, you 'd better use ipython. (although it can be executed in python shell)
Because plotting is a relatively high-consumption operation, python changes the graph only after all operations are completed. Ipython can achieve real-time changes. You can also use Baidu matplotlib and matlab.
3. for better interaction, use ipython
Ipython is not available in the default software source of centos 7. You can download the latest stable version of the source code on github and install it manually (decompress the package and run sudo python setup. py install ). Of course, if you have installed pip, you can install it directly:
sudo pip install ipython
The following is an example of plotting.
Terminal input ipython
Enter % pylab <喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + pgltzybzcm9 "http://www.2cto.com/uploadfile/Collfiles/20141011/20141011084530390.png" alt = "\">
Input,
In [2]: x = randn(10000)In [3]: hist(x,100)
(Note: Is it similar to matlab ?)
Output,
This is the most basic software for "Machine Learning" using python. We will introduce it in detail later.