You are on page 1of 4

Table of Contents

Preface v
Chapter 1: Python for Data Science 1
Introduction 2
Using dictionary objects 2
Working with a dictionary of dictionaries 6
Working with tuples 7
Using sets 12
Writing a list 15
Creating a list from another list - list comprehension 19
Using iterators 22
Generating an iterator and a generator 24
Using iterables 26
Passing a function as a variable 27
Embedding functions in another function 28
Passing a function as a parameter 29
Returning a function 30
Altering the function behavior with decorators 31
Creating anonymous functions with lambda 34
Using the map function 35
Copyright © 2015. Packt Publishing, Limited. All rights reserved.

Working with filters 36


Using zip and izip 37
Processing arrays from the tabular data 39
Preprocessing the columns 43
Sorting lists 45
Sorting with a key 46
Working with itertools 51

Gopi, Subramanian. Python Data Science Cookbook, Packt Publishing, Limited, 2015. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/manchester/detail.action?docID=4191189.
Created from manchester on 2020-07-07 02:48:13.
Table of Contents

Chapter 2: Python Environments 55


Introduction 55
Using NumPy libraries 55
Plotting with matplotlib 65
Machine learning with scikit-learn 75
Chapter 3: Data Analysis – Explore and Wrangle 85
Introduction 86
Analyzing univariate data graphically 87
Grouping the data and using dot plots 95
Using scatter plots for multivariate data 100
Using heat maps 104
Performing summary statistics and plots 109
Using a box-and-whisker plot 114
Imputing the data 117
Performing random sampling 120
Scaling the data 122
Standardizing the data 124
Performing tokenization 127
Removing stop words 131
Stemming the words 135
Performing word lemmatization 138
Representing the text as a bag of words 140
Calculating term frequencies and inverse document frequencies 146
Chapter 4: Data Analysis – Deep Dive 151
Introduction 151
Extracting the principal components 153
Using Kernel PCA 160
Extracting features using singular value decomposition 166
Reducing the data dimension with random projection 171
Decomposing the feature matrices using non-negative matrix factorization 175
Chapter 5: Data Mining – Needle in a Haystack 185
Copyright © 2015. Packt Publishing, Limited. All rights reserved.

Introduction 185
Working with distance measures 186
Learning and using kernel methods 192
Clustering data using the k-means method 196
Learning vector quantization 202
Finding outliers in univariate data 208
Discovering outliers using the local outlier factor method 216

ii

Gopi, Subramanian. Python Data Science Cookbook, Packt Publishing, Limited, 2015. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/manchester/detail.action?docID=4191189.
Created from manchester on 2020-07-07 02:48:13.
Table of Contents

Chapter 6: Machine Learning 1 227


Introduction 227
Preparing data for model building 228
Finding the nearest neighbors 234
Classifying documents using Naïve Bayes 242
Building decision trees to solve multiclass problems 255
Chapter 7: Machine Learning 2 267
Introduction 267
Predicting real-valued numbers using regression 268
Learning regression with L2 shrinkage – ridge 283
Learning regression with L1 shrinkage – LASSO 293
Using cross-validation iterators with L1 and L2 shrinkage 301
Chapter 8: Ensemble Methods 315
Introduction 315
Understanding Ensemble – Bagging Method 317
Understanding Ensemble – Boosting Method 325
Understanding Ensemble – Gradient Boosting 341
Chapter 9: Growing Trees 357
Introduction 357
Going from trees to Forest – Random Forest 358
Growing Extremely Randomized Trees 369
Growing Rotational Forest 376
Chapter 10: Large-Scale Machine Learning – Online Learning 387
Introduction 387
Using perceptron as an online learning algorithm 388
Using stochastic gradient descent for regression 396
Using stochastic gradient descent for classification 405
Index 411
Copyright © 2015. Packt Publishing, Limited. All rights reserved.

iii

Gopi, Subramanian. Python Data Science Cookbook, Packt Publishing, Limited, 2015. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/manchester/detail.action?docID=4191189.
Created from manchester on 2020-07-07 02:48:13.
Copyright © 2015. Packt Publishing, Limited. All rights reserved.

Gopi, Subramanian. Python Data Science Cookbook, Packt Publishing, Limited, 2015. ProQuest Ebook Central, http://ebookcentral.proquest.com/lib/manchester/detail.action?docID=4191189.
Created from manchester on 2020-07-07 02:48:13.

You might also like