List of examples
List of examples
Description | Type | Chap | Link |
---|---|---|---|
Quantitative data | βοΈ | 1 | Example 1.1 |
Floating-point numbers | π» | 1 | Example 1.2 |
Infinity and NaN | π» | 1 | Example 1.3 |
Dates and times in NumPy | π» | 1 | Example 1.4 |
Vectors in Python | π» | 1 | Example 1.5 |
Accessing vector elements | π» | 1 | Example 1.6 |
Slicing vectors | π» | 1 | Example 1.7 |
Arrays in Python | π» | 1 | Example 1.8 |
Indexing arrays | π» | 1 | Example 1.9 |
Array reductions | π» | 1 | Example 1.10 |
Ordinal data | βοΈ | 1 | Example 1.11 |
Dummy variables | βοΈ | 1 | Example 1.12 |
Series | βοΈ | 1 | Example 1.13 |
Series in pandas | π» | 1 | Example 1.14 |
Operations on series | π» | 1 | Example 1.15 |
Series and frames in pandas | π» | 1 | Example 1.16 |
Operations on data frames | π» | 1 | Example 1.17 |
Importing CSV data | π» | 1 | Example 1.18 |
iloc for rows in a frame | π» | 1 | Example 1.19 |
loc for rows in a frame | π» | 1 | Example 1.20 |
Selecting rows in a frame | π» | 1 | Example 1.21 |
Concatenating data in pandas | π» | 1 | Example 1.22 |
Merging data in pandas | π» | 1 | Example 1.23 |
Merging data | π» | 1 | Example 1.24 |
Handling missing values in pandas | π» | 1 | Example 1.25 |
Cleaning a data frame | π» | 1 | Example 1.26 |
Encoding qualitative data | π» | 1 | Example 1.27 |
Dummy variables in pandas | π» | 1 | Example 1.28 |
Summary statistics in pandas | π» | 2 | Example 2.1 |
Standard deviation by hand | βοΈ | 2 | Example 2.2 |
Sample variance | βοΈ | 2 | Example 2.3 |
Mean, variance, STD in pandas | π» | 2 | Example 2.4 |
Z scores | βοΈ, π» | 2 | Example 2.5 |
Z scores in Python | π» | 2 | Example 2.6 |
Median | βοΈ | 2 | Example 2.7 |
Quantiles | π» | 2 | Example 2.8 |
Quartiles and IQR | π» | 2 | Example 2.9 |
ECDF of penguins | π» | 2 | Example 2.12 |
ECDF of a simple distribution | βοΈ | 2 | Example 2.11 |
ECDF of penguins | π» | 2 | Example 2.12 |
CDF of a uniform distribution | βοΈ | 2 | Example 2.13 |
ECDF of temperatures | π» | 2 | Example 2.14 |
PDF of temperature distribution | βοΈ | 2 | Example 2.15 |
PDF of a uniform distribution | βοΈ | 2 | Example 2.16 |
Uniform random numbers in NumPy | π» | 2 | Example 2.17 |
Normal distribution in NumPy | π» | 2 | Example 2.18 |
Grouping data | π» | 2 | Example 2.19 |
Facet plots | π» | 2 | Example 2.20 |
Box and violin plots | π» | 2 | Example 2.21 |
Aggregating data in groups | π» | 2 | Example 2.22 |
Grouping data by cuts | π» | 2 | Example 2.24 |
Outliers for mean and median | βοΈ | 2 | Example 2.25 |
Interquartile range | π» | 2 | Example 2.26 |
Outliers | π» | 2 | Example 2.27 |
Outliers and the Pearson coefficient | π» | 2 | Example 2.30 |
Spearman correlation coefficient | π» | 2 | Example 2.31 |
Categorical correlation | π» | 2 | Example 2.32 |
The Datasaurus | π» | 2 | Example 2.33 |
Correlation vs. dependence | π» | 2 | Example 2.34 |
Simpsonβs paradox | π» | 2 | Example 2.35 |
Digit classification | π» | 3 | Example 3.1 |
Feature matrix | βοΈ | 3 | Example 3.2 |
Trainβtest split | π» | 3 | Example 3.3 |
Testing accuracy | π» | 3 | Example 3.4 |
Combined metrics | βοΈ | 3 | Example 3.7 |
Multiclass one-vs-rest | βοΈ | 3 | Example 3.8 |
Multiclass metrics | π» | 3 | Example 3.9 |
Decision tree | βοΈ | 3 | Example 3.10 |
Gini impurity | βοΈ | 3 | Example 3.11 |
Gini impurity | βοΈ | 3 | Example 3.12 |
Tree partitioning | βοΈ | 3 | Example 3.13 |
Inspecting a decision tree | π» | 3 | Example 3.14 |
Tree classifier for the penguins dataset | π» | 3 | Example 3.15 |
Interpreting a decision tree | π» | 3 | Example 3.16 |
Calculating distance | βοΈ | 3 | Example 3.17 |
kNN classifier | βοΈ | 3 | Example 3.18 |
kNN classifier for the penguins dataset | π» | 3 | Example 3.19 |
kNN sensitivity to scaling | βοΈ | 3 | Example 3.20 |
Pipeline for standardizing columns | π» | 3 | Example 3.21 |
Probabilistic classifier | βοΈ, π» | 3 | Example 3.22 |
Probabilistic classifier for the penguins dataset | π» | 3 | Example 3.23 |
Varying decision threshold | π» | 3 | Example 3.24 |
ROC curve | π» | 3 | Example 3.25 |
Area under ROC curve | π» | 3 | Example 3.26 |
Hyperparameters | βοΈ | 4 | Example 4.1 |
Learning curves | π» | 4 | Example 4.2 |
Overfitting | π» | 4 | Example 4.3 |
Bagging ensemble classifier | π» | 4 | Example 4.4 |
Bagging ensemble (better) | π» | 4 | Example 4.5 |
Folds for validation | βοΈ | 4 | Example 4.7 |
Cross-validation grid search | π» | 4 | Example 4.10 |
Linear regression | βοΈ | 5 | Example 5.13 |
Inner product | βοΈ | 5 | Example 5.2 |
Mean squared and mean absolute error | βοΈ | 5 | Example 5.3 |
Coefficient of determination | βοΈ | 5 | Example 5.4 |
Linear regression for sea ice dataset | π» | 5 | Example 5.5 |
Matrix times vector | βοΈ | 5 | Example 5.6 |
Multilinear regression for MPG dataset | π» | 5 | Example 5.7 |
Multilinear regression for sales dataset | π» | 5 | Example 5.8 |
Polynomial regression for the MPG dataset | π» | 5 | Example 5.9 |
Overfitting in polynomial regression | π» | 5 | Example 5.10 |
Ridge regression for diabetes dataset | π» | 5 | Example 5.11 |
LASSO regression for diabetes dataset | π» | 5 | Example 5.12 |
Random forest for regression | π» | 5 | Example 5.19 |
Cross-entropy | βοΈ | 5 | Example 5.20 |
Logistic regression as a spam filter | π» | 5 | Example 5.21 |
Distance matrix | βοΈ | 6 | Example 6.1 |
Usage of pairwise_distances
|
π» | 6 | Example 6.2 |
Angular distance | π» | 6 | Example 6.3 |
Rand index by hand | βοΈ | 6 | Example 6.4 |
Adjusted Rand index | π» | 6 | Example 6.5 |
Silhouette values | βοΈ | 6 | Example 6.6 |
Silhouette values calculation | π» | 6 | Example 6.7 |
Silhouettes as performance metric | π» | 6 | Example 6.8 |
Limitation of silhouettes | π» | 6 | Example 6.9 |
Inertia | βοΈ | 6 | Example 6.10 |
k-means on blobs dataset | π» | 6 | Example 6.11 |
k-means on stripes dataset | π» | 6 | Example 6.12 |
k-means on digits dataset | π» | 6 | Example 6.13 |
Comparing linkages on simple datasets | π» | 6 | Example 6.16 |
Agglomerative for penguins dataset | π» | 6 | Example 6.17 |
Constructing networks/graphs | π» | 7 | Example 7.1 |
Importing networks | π» | 7 | Example 7.2 |
Neighbors of a node | π» | 7 | Example 7.3 |
Ego graph | π» | 7 | Example 7.4 |
Node degrees | π» | 7 | Example 7.6 |
Average degree | π» | 7 | Example 7.7 |
ER graphs | π» | 7 | Example 7.8 |
Clustering coefficient | βοΈ | 7 | Example 7.10 |
Clustering in the Twitch network | π» | 7 | Example 7.11 |
Clustering in ER graphs | π» | 7 | Example 7.12 |
Distances in a complete graph | βοΈ | 7 | Example 7.14 |
Distances in a wheel graph | π» | 7 | Example 7.15 |
Connectedness | βοΈ | 7 | Example 7.16 |
Distances in ER graphs | π» | 7 | Example 7.17 |
Degree distribution in the Twitch network | π» | 7 | Example 7.18 |
Degree distribution in the Twitch network | π» | 7 | Example 7.19 |
BarabΓ‘siβAlbert graphs | π» | 7 | Example 7.20 |
Power-law degrees in the Twitch network | π» | 7 | Example 7.21 |
Betweenness centrality in the Twitch network | π» | 7 | Example 7.25 |
Eigenvectors | βοΈ | 7 | Example 7.26 |
Eigenvector centrality | βοΈ | 7 | Example 7.27 |
Comparison of centrality metrics | π» | 7 | Example 7.28 |
No matching items