PA196: Pattern Recognition Exercises 01 Dr. Vlad Popovici popovici@recetox.muni.cz RECETOX Masaryk University, Brno Python environment • the easiest is to use a "distribution" of Python • suggestion/recommendation: Anaconda http://www.continuum.io/ • Python 2 vs Python 3: for the exercises in the course, there should be (almost) no difference • starting with a minimal distribution: use Miniconda: http://conda.pydata.org/miniconda.html: pick the right installer (e.g. 64 bit) Example: • download the "Python 3.4/64 bit" version of Miniconda • it may require chmod +x Miniconda3-3.6.0-Linux-x86_64.sh • run the installer • even though the base distribution is Python 3.4 you can still have Python 2.7 installed as well • browse through the documentation • with conda install anaconda you will get all the packages as in the basic "Anaconda"; alternatively you can install them on a as-needed basis • install the machine learning kit: conda install scikit-learn About Python language • tons of source of information • quick introduction: https://docs.python.org/2/tutorial/ • more detailed - but free book: http://www.diveintopython.net/ IPython • great tool for interactive sessions with Python • www.ipython.org • you can have mixed code, text and results in the same notebook, like in Mathematica • try: ipython qtconsole -matplotlib inline and in the console: from matplotlib import pylab as plt plt.plot([1,2,3],[4,5,6]) • try (from the command line): ipython notebook and then open the web page at http://127.0.0.1:8888 Several key packages: • numpy: fast array operations and matrix manipulation • scipy: loads of numerical methods, including some functions for signal and image processing • matplotlib: Matlab-style plotting functions - and not only! • pandas: versatile package for data analysis • scikit-image: image processing (beyond scipy) • scikit-learn: our main interest Scikit-Learn • http://scikit-learn.org/ • nice Python package for machine learning/pattern recognition • good documentation • still under development • start Python: ipython -matplotlib qt • let’s go through the tutorial at http://scikit-learn.org/stable/tutorial/ basic/tutorial.html