Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Preface
Who Is This Book For?
Why SciPy?
What Is the SciPy Ecosystem?
The Great Cataclysm: Python 2 Versus Python 3
SciPy Ecosystem and Community
Free and Open Source Software (FOSS)
Open source, open science
Open source licenses
GitHub: Taking Coding Social
Make Your Mark on the SciPy Ecosystem
A Touch of Whimsy with Your Py
Getting Help
Installing Python
Accessing the Book Materials
Diving In
Conventions Used in This Book
Use of Color
Using Code Examples
O’Reilly Safari
How to Contact Us
Acknowledgments
1. Elegant NumPy: The Foundation of Scientific Python
Introduction to the Data: What Is Gene Expression?
NumPy N-Dimensional Arrays
Why Use ndarrays Instead of Python Lists?
Vectorization
Broadcasting
Exploring a Gene Expression Dataset
Reading in the Data with pandas
Normalization
Between Samples
Normalizing library size between samples
Between Genes
Normalizing Over Samples and Genes: RPKM
Broadcasting rules
RPKM between gene normalization
Taking Stock
2. Quantile Normalization with NumPy and SciPy
Getting the Data
Gene Expression Distribution Differences Between Individuals
Biclustering the Counts Data
Visualizing Clusters
Predicting Survival
Further Work: Using the TCGA’s Patient Clusters
Further Work: Reproducing the TCGA’s clusters
3. Networks of Image Regions with ndimage
Images Are Just NumPy Arrays
Exercise: Adding a Grid Overlay
Filters in Signal Processing
Filtering Images (2D Filters)
Generic Filters: Arbitrary Functions of Neighborhood Values
Exercise: Conway’s Game of Life
Exercise: Sobel Gradient Magnitude
Graphs and the NetworkX library
Exercise: Curve Fitting with SciPy
Region Adjacency Graphs
Elegant ndimage: How to Build Graphs from Image Regions
Putting It All Together: Mean Color Segmentation
4. Frequency and the Fast Fourier Transform
Introducing Frequency
Illustration: A Birdsong Spectrogram
History
Implementation
Choosing the Length of the DFT
More DFT Concepts
Frequencies and Their Ordering
Windowing
Real-World Application: Analyzing Radar Data
Signal Properties in the Frequency Domain
Windowing, Applied
Radar Images
3D visualization
Further Applications of the FFT
Further Reading
Exercise: Image Convolution
5. Contingency Tables Using Sparse Coordinate Matrices
Contingency Tables
Exercise: Computational Complexity of Confusion Matrices
Exercise: Alternative Algorithm to Compute the Confusion Matrix
Exercise: Multiclass Confusion Matrix
scipy.sparse Data Formats
COO Format
Exercise: COO Representation
Compressed Sparse Row Format
Applications of Sparse Matrices: Image Transformations
Exercise: Image Rotation
Back to Contingency Tables
Exercise: Reducing the Memory Footprint
Contingency Tables in Segmentation
Information Theory in Brief
Exercise: Computing Conditional Entropy
Information Theory in Segmentation: Variation of Information
Converting NumPy Array Code to Use Sparse Matrices
Using Variation of Information
Further Work: Segmentation in Practice
6. Linear Algebra in SciPy
Linear Algebra Basics
Laplacian Matrix of a Graph
Exercise: Rotation Matrix
Laplacians with Brain Data
Exercise: Showing the Affinity View
Exercise Challenge: Linear Algebra with Sparse Matrices
PageRank: Linear Algebra for Reputation and Importance
Exercise: Dealing with Dangling Nodes
Exercise: Equivalence of Different Eigenvector Methods
Concluding Remarks
7. Function Optimization in SciPy
Optimization in SciPy: scipy.optimize
An Example: Computing Optimal Image Shift
Image Registration with Optimize
Avoiding Local Minima with Basin Hopping
Exercise: Modify the align Function
“What Is Best?”: Choosing the Right Objective Function
8. Big Data in Little Laptop with Toolz
Streaming with yield
Introducing the Toolz Streaming Library
k-mer Counting and Error Correction
Currying: The Spice of Streaming
Back to Counting k-mers
Exercise: PCA of Streaming Data
Markov Model from a Full Genome
Exercise: Online Unzip
Epilogue
Where to Next?
Mailing Lists
GitHub
Conferences
Beyond SciPy
Contributing to This Book
Until Next Time...
A. Exercise Solutions
Solution: Adding a Grid Overlay
Solution: Conway’s Game of Life
Solution: Sobel Gradient Magnitude
Solution: Curve Fitting with SciPy
Solution: Image Convolution
Solution: Computational Complexity of Confusion Matrices
Solution: Alternative Confusion Matrix Computing
Solution: Computing the Confusion Matrix
Solution: COO Representation
Solution: Image Rotation
Solution: Reducing the Memory Footprint
Solution: Computing Conditional Entropy
Solution: Rotation Matrix
Solution: Showing the Affinity View
Challenge Accepted: Linear Algebra with Sparse Matrices
Solution: Dealing with Dangling Nodes
Solution: Verify Methods
Solution: Modify the align Function
Solution: scikit-learn Library
Solution: Add a Step to the Start of the Pipe
Index
← Prev
Back
Next →
← Prev
Back
Next →