Book description
Over 100 handson recipes to sharpen your skills in highperformance numerical computing and data science with Python
In Detail
IPython is at the heart of the Python scientific stack. With its widely acclaimed webbased notebook, IPython is today an ideal gateway to data analysis and numerical computing in Python.
IPython Interactive Computing and Visualization Cookbook contains many readytouse focused recipes for highperformance scientific computing and data analysis. The first part covers programming techniques, including code quality and reproducibility; code optimization; highperformance computing through dynamic compilation, parallel computing, and graphics card programming. The second part tackles data science, statistics, machine learning, signal and image processing, dynamical systems, and pure and applied mathematics.
What You Will Learn
 Code better by writing highquality, readable, and welltested programs; profiling and optimizing your code, and conducting reproducible interactive computing experiments
 Master all of the new features of the IPython notebook, including the interactive HTML/JavaScript widgets
 Analyze data with Bayesian and frequentist statistics (Pandas, PyMC, and R), and learn from data with machine learning (scikitlearn)
 Gain valuable insights into signals, images, and sounds with SciPy, scikitimage, and OpenCV
 Learn how to write blazingly fast Python programs with NumPy, PyTables, ctypes, Numba, Cython, OpenMP, GPU programming (CUDA and OpenCL), parallel IPython, MPI, and many more
Table of contents

IPython Interactive Computing and Visualization Cookbook
 Table of Contents
 IPython Interactive Computing and Visualization Cookbook
 Credits
 About the Author
 About the Reviewers
 www.PacktPub.com
 Preface

1. A Tour of Interactive Computing with IPython
 Introduction
 Introducing the IPython notebook
 Getting started with exploratory data analysis in IPython
 Introducing the multidimensional array in NumPy for fast array computations
 Creating an IPython extension with custom magic commands
 Mastering IPython's configuration system
 Creating a simple kernel for IPython

2. Best Practices in Interactive Computing
 Introduction
 Choosing (or not) between Python 2 and Python 3
 Efficient interactive computing workflows with IPython
 Learning the basics of the distributed version control system Git
 A typical workflow with Git branching
 Ten tips for conducting reproducible interactive computing experiments
 Writing highquality Python code
 Writing unit tests with nose
 Debugging your code with IPython

3. Mastering the Notebook
 Introduction
 Teaching programming in the notebook with IPython blocks
 Converting an IPython notebook to other formats with nbconvert
 Adding custom controls in the notebook toolbar
 Customizing the CSS style in the notebook
 Using interactive widgets – a piano in the notebook
 Creating a custom JavaScript widget in the notebook – a spreadsheet editor for pandas
 Processing webcam images in real time from the notebook

4. Profiling and Optimization
 Introduction
 Evaluating the time taken by a statement in IPython
 Profiling your code easily with cProfile and IPython
 Profiling your code linebyline with line_profiler
 Profiling the memory usage of your code with memory_profiler
 Understanding the internals of NumPy to avoid unnecessary array copying
 Using stride tricks with NumPy
 Implementing an efficient rolling average algorithm with stride tricks
 Making efficient array selections in NumPy
 Processing huge NumPy arrays with memory mapping
 Manipulating large arrays with HDF5 and PyTables
 Manipulating large heterogeneous tables with HDF5 and PyTables

5. Highperformance Computing
 Introduction
 Accelerating pure Python code with Numba and justintime compilation
 Accelerating array computations with Numexpr
 Wrapping a C library in Python with ctypes
 Accelerating Python code with Cython
 Optimizing Cython code by writing less Python and more C
 Releasing the GIL to take advantage of multicore processors with Cython and OpenMP
 Writing massively parallel code for NVIDIA graphics cards (GPUs) with CUDA
 Writing massively parallel code for heterogeneous platforms with OpenCL
 Distributing Python code across multiple cores with IPython
 Interacting with asynchronous parallel tasks in IPython
 Parallelizing code with MPI in IPython
 Trying the Julia language in the notebook

6. Advanced Visualization
 Introduction
 Making nicer matplotlib figures with prettyplotlib
 Creating beautiful statistical plots with seaborn
 Creating interactive web visualizations with Bokeh
 Visualizing a NetworkX graph in the IPython notebook with D3.js
 Converting matplotlib figures to D3.js visualizations with mpld3
 Getting started with Vispy for highperformance interactive data visualizations

7. Statistical Data Analysis
 Introduction
 Exploring a dataset with pandas and matplotlib
 Getting started with statistical hypothesis testing – a simple ztest
 Getting started with Bayesian methods
 Estimating the correlation between two variables with a contingency table and a chisquared test
 Fitting a probability distribution to data with the maximum likelihood method
 Estimating a probability distribution nonparametrically with a kernel density estimation
 Fitting a Bayesian model by sampling from a posterior distribution with a Markov chain Monte Carlo method
 Analyzing data with the R programming language in the IPython notebook

8. Machine Learning
 Introduction
 Getting started with scikitlearn
 Predicting who will survive on the Titanic with logistic regression
 Learning to recognize handwritten digits with a Knearest neighbors classifier
 Learning from text – Naive Bayes for Natural Language Processing
 Using support vector machines for classification tasks
 Using a random forest to select important features for regression
 Reducing the dimensionality of a dataset with a principal component analysis
 Detecting hidden structures in a dataset with clustering
 9. Numerical Optimization
 10. Signal Processing
 11. Image and Audio Processing
 12. Deterministic Dynamical Systems
 13. Stochastic Dynamical Systems

14. Graphs, Geometry, and Geographic Information Systems
 Introduction
 Manipulating and visualizing graphs with NetworkX
 Analyzing a social network with NetworkX
 Resolving dependencies in a directed acyclic graph with a topological sort
 Computing connected components in an image
 Computing the Voronoi diagram of a set of points
 Manipulating geospatial data with Shapely and basemap
 Creating a route planner for a road network

15. Symbolic and Numerical Mathematics
 Introduction
 Diving into symbolic computing with SymPy
 Solving equations and inequalities
 Analyzing realvalued functions
 Computing exact probabilities and manipulating random variables
 A bit of number theory with SymPy
 Finding a Boolean propositional formula from a truth table
 Analyzing a nonlinear differential system – LotkaVolterra (predatorprey) equations
 Getting started with Sage
 Index
Product information
 Title: IPython Interactive Computing and Visualization Cookbook
 Author(s):
 Release date: September 2014
 Publisher(s): Packt Publishing
 ISBN: 9781783284818
You might also like
book
IPython Interactive Computing and Visualization Cookbook  Second Edition
Learn to use IPython and Jupyter Notebook for your data analysis and visualization work. About This …
book
Numerical Computing with Python
Understand, explore, and effectively present data using the powerful data visualization techniques of Python Key Features …
book
Matplotlib 3.0 Cookbook
Build attractive, insightful, and powerful visualizations to gain quality insights from your data Key Features Master …
book
Foundations of PyGTK Development: GUI Creation with Python
Learn how to develop portable GUI programs to run on multiple operating systems. Revised and updated …