Slide 1

Slide 1 text

Anaconda for R Users Christine Doig Oct 2015

Slide 2

Slide 2 text

2 • Industrial Engineer, UPC, Barcelona • Master Thesis - Voltage Stability Analysis, Aachen, Germany • Process Engineer - Operations Research, P&G • Business Analyst/Consultant, “La Caixa” • Quantitative Techniques for Finantial Markets, FME, UPC • Master in Data Mining and BI, FIB-UPC, Barcelona • Data Scientist, Continuum Analytics, Austin, Texas My background… Matlab C SAP SAS Excel VB Matlab SQL R Python R

Slide 3

Slide 3 text

3 • DARPA Memex - Human Trafficking • Python Advocate and Conference Speaker: PyCon Montreal, PyData Berlin, PyData Dallas, SciPy Austin, Europython Bilbao… • Blaze PM: http://blaze.pydata.org/ • Python Trainings • Blogs: • "Conda for Data Science" (https://www.continuum.io/content/conda-data-science) • "Jupyter and Conda for R" (https://www.continuum.io/blog/developer/jupyter-and-conda-r). at Continuum Analytics…

Slide 4

Slide 4 text

4 • Twitter: ch_doig • Github: chdoig • Site: chdoig.github.io • Email: [email protected] Keep in touch!

Slide 5

Slide 5 text

5 Continuum Analytics… …distributes Anaconda, an open source Python distribution that includes more than 300 packages for scientific computing and data science …provides enterprise ready products for data scientist through the Anaconda Platform …delivers Python trainings and offers consulting services …supports the development of open source technology: conda, blaze, dask, bokeh, numba… …sponsors Python conferences PyData, SciPy, PyCon, Europython, PySS… Learn more: https://www.continuum.io/

Slide 6

Slide 6 text

Agenda 6 • Anaconda and “R Essentials” • Conda: package and environment manager • Jupyter: collaborative notebooks • Bokeh: interactive data visualizations

Slide 7

Slide 7 text

CONDA, ANACONDA & R ESSENTIALS Introduction

Slide 8

Slide 8 text

8 Conda • Package and environment manager • Language angnostic (Python, R, Java…) • Cross-platform (Windows, OS X, Linux) $ conda install python=2.7 $ conda install pandas $ conda install -c r r $ conda install mongodb

Slide 9

Slide 9 text

9 Conda • Open source: BSD license • Docs: http://conda.pydata.org/docs/ • GH: https://github.com/conda

Slide 10

Slide 10 text

10 Conda vs Anaconda vs Miniconda vs R Essentials • Conda: package manager • Anaconda: Python + Conda + packages • Miniconda: Python + Conda • R Essentials: R + R packages

Slide 11

Slide 11 text

11 Language agnostic Python packages handles environments ! natively virtualenv installs binaries compiles from source general purpose ! envs python! envs Conda Pip

Slide 12

Slide 12 text

12 Conda + pip $ conda install pip $ pip install foo Conda skeleton pip $ conda skeleton pip foo $ conda build foo/

Slide 13

Slide 13 text

13 Why Conda? • Python with compiled, platform-dependent C, C++, or Fortran code • Seen this message too many times:“Storing debug log for failure in /.pip/pip.log” • Multi-language Data Science Projects

Slide 14

Slide 14 text

14 Anaconda Cloud ~ Github for binary packages

Slide 15

Slide 15 text

15 Anaconda Cloud $ conda build conda.recipe/ $ conda server upload my_foo_pkg $ conda install -c chdoig my_foo_pkg

Slide 16

Slide 16 text

16 Anaconda for R users $ conda install -c r r-foo

Slide 17

Slide 17 text

17 Mirror CRAN packages $ conda skeleton cran ldavis ! $ conda build r-ldavis/ ! $ conda server upload my_r_pkg ! $ conda install -c chdoig my_r_pkg

Slide 18

Slide 18 text

18 Conda environments name: myenv channels: - chdoig - r - foo dependecies: - python=2.7 - r - r-ldavis - pandas - mongodb - spark=1.5 - pip - pip: - flask-migrate - bar=1.4 environment.yml $ conda env create $ source activate myenv $ conda env export -n freeze.yml Create and activate Freeze versions Upload to anaconda.org $ conda server upload my_foo_env.yml $ conda env create chdoig/my_foo_env.yml

Slide 19

Slide 19 text

19 Conda auto env cdoig:~$ cd pygotham-topic-modeling/ discarding /anaconda/bin from PATH prepending /anaconda/envs/pygotham-topic/bin to PATH (pygotham-topic)cdoig:~/pygotham-topic-modeling$ https://github.com/chdoig/conda-auto-env

Slide 20

Slide 20 text

20 "R essentials" comes with IRKernel and over 80 of the most used R packages for data science like dplyr, shiny, ggplot2, tidyr, caret and nnet. $ conda install -c r r-essentials $ conda config --add channels r or $ conda install r-essentials R Essentials

Slide 21

Slide 21 text

21 or, alternatively, create an environment to isolate your "R essentials" packages from others: ! $ conda create -n r-essentials -c r r-essentials R Essentials environment

Slide 22

Slide 22 text

22 $ conda metapackage custom-r-bundle 0.1.0 --dependencies r-irkernel jupyter r-ggplot2 r-dplyr --summary "My custom R bundle” ! Custom metapackage to share

Slide 23

Slide 23 text

JUPYTER Introduction

Slide 24

Slide 24 text

24 http://jupyter.org/ https://try.jupyter.org/ The Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text.

Slide 25

Slide 25 text

25 IPython IPython notebook nbviewer tmpnb binder Jupyter https://try.jupyter.org/ http://mybinder.org/

Slide 26

Slide 26 text

26 ! To start jupyter notebooks, simply run the following command: ! $ jupyter notebook http://nbviewer.ipython.org/github/chdoig/conda-jupyter-irkernel/blob/master/Jupyter%20and%20conda%20for%20R.ipynb

Slide 27

Slide 27 text

27 Jupyter and conda for R notebook demo

Slide 28

Slide 28 text

28 Slideshow

Slide 29

Slide 29 text

29

Slide 30

Slide 30 text

30 $ jupyter nbconvert my_r_notebook.ipynb --to slides --post serve

Slide 31

Slide 31 text

31

Slide 32

Slide 32 text

BOKEH Introduction

Slide 33

Slide 33 text

33 Custom visualizations Dashboards Streaming/ Animations Charts T ools Widgets Maps Hover Bokeh

Slide 34

Slide 34 text

34

Slide 35

Slide 35 text

35 http://hafen.github.io/rbokeh/ rbokeh

Slide 36

Slide 36 text

36 rbokeh demo

Slide 37

Slide 37 text

37 • Twitter: ch_doig • Github: chdoig • Site: chdoig.github.io • Email: [email protected] Keep in touch!

Slide 38

Slide 38 text

38 Q & A Thanks!