A Mind Map Summary

The 100-page Machine Learning Book: A Mind Map Summary

Get Started. It's Free
or sign up with your email address
A Mind Map Summary by Mind Map: A Mind Map Summary

1. 1.Types of Learning

1.1. Supervised

1.1.1. regression (continuous)

1.1.2. classification (categorical)

1.2. Unsupervised

1.2.1. clustering

1.2.2. dimensionality reduction

1.3. Semi-supervised

2. 2.Fundamental algorithms

2.1. Linear Regression

2.1.1. loss function: the square error

2.1.2. minimizes the loss function by setting the gradient equal to zero

2.1.3. advantages simple interpretable rarely overfits

2.1.4. disadvantages over simplifies real world problems because: assumes linearity in data assumes that the errors are normally distributed prone to outliers

2.2. Logistic Regression

2.2.1. is not a regression, but a classification algorithm

2.2.2. assigns + & - labels to data using the sigmoid function

2.2.3. maximizes likelihood using gradient descent

2.2.4. advantages efficient and fast not prone to overfitting after regularization? works well for single decision boundaries (vs decision tree) data doesn't need to be scaled (normalized)

2.2.5. disadvantages can't solve nonlinear problems (the decision boundary is linear) Feature engineering is very important builds the model with the data at once; has to be rebuilt with new data

2.3. Decision Tree

2.3.1. divides features into branches based on minimizing the entropy (maximizing information gain)

2.3.2. solves overfitting using pruning pruning means going over the tree once it's built and removing branches that don't contribute significantly.

2.3.3. advantages handles both continuous and discrete (categorical) data handels missing data easily interpretable

2.3.4. disadvantages decisions are made locally, so the solution is not necessarily optimal Is prone to overfitting builds the model with the data at once; has to be rebuilt with new data

2.4. SVM

2.4.1. separates data into different classes using a decision boundary

2.4.2. advantages effective in high dimensional spaces with the appropriate kernel, it can solve complex problems

2.4.3. disadvantages poor performance when number of features is larger than the number of samples choosing a good kernel is not easy long training time? builds the model with the data at once; has to be rebuilt with new data

2.5. kNN

2.5.1. is a non-parametric model: for new data points, uses nearest data points in the training set to guess a label.

2.5.2. distance metric is the hyperparameter but it can be inferred from the data.

2.5.3. advantages robust to noise no training needed learns complex models easily

2.5.4. disadvantages the value of k needs to be determined doesn't perform well in high demensions not clear which distance metric to use memory intensive

3. building blocks of an algorithm

3.1. loss function

3.2. optimization criterion (cost function)

3.3. optimization routine (training)

4. 3.Basic Practice

4.1. Feature Engineering

4.1.1. transforming raw data into a dataset

4.1.2. one-hot encoding all features set to zero except the target feature (similar to bag of words) turns categorical data into machine understandable values

4.1.3. binning converting a continuous variable into discrete bins helps the algorithm to learn using fewer examples

4.1.4. Normalization converting the range of data into a standard interval e.g. [0,1] or [-1,1] prevents features with larger numerical values from overweighting the algorithm avoids numerical overflow

4.1.5. standardization rescaling data so that in follows a normal dist. with mean=0 and var=1 preferable to normalization for unsupervised algorithms if the data naturally follows a normal distribution if the data has outliers

4.1.6. missing values can be dealt with by removing the entries with missing values interpolation or other data substitution algorithms data imputation

4.2. Learning Algorithm Selection

4.2.1. Explainability Neural nets and ensemble models are accurate "black boxes": make few errors but not easily interpretable. kNN, Regression models, Decision Trees are not as accurate but easily interpretable

4.2.2. In Memory vs Out of memory if the dataset doesn't fit in memory, incremental learning algorithms are preferable

4.2.3. number of features neural nets and gradient boosting can handle large number of features, but something like SVM is modest in capacity

4.2.4. categorical vs numerical features some algorithms can only handle numerical data

4.2.5. nonlinearity in data algorithms such as SVM with linear kernel, linear and logistic regression are good choices for linear data.

4.2.6. training speed some algorithms are slow learners (neural nets). linear and logistic regression and decision trees are much faster. random forests can benefit from multiple CPUs.

4.2.7. prediction speed linear and logistic regression and SVMs and some kinds of neural nets are fast at prediction. Others such as kNN, ensemble algorithms and deep neural nets are slower.

4.3. Three sets

4.3.1. training set to train the learning algorithm 70-15-15 % for small data sets 95-2.5-2.5 % for large data sets

4.3.2. validation set to find the best learning algorithm to find the best hyper-parameters of the algorithm

4.3.3. test set to asses the performance of the model before delivery and production

4.4. Overfitting/Underfitting

4.4.1. Underfitting: high bias the model makes many mistakes on the training dataset the model is too simple The features are not informative enough

4.4.2. Overfitting: high variance the model predicts the training data too well but performs poorly on the holdout data sets model is too complex too many features and small number of examples MSE on the test data is substantially higher than the training data solutions trying simpler models reducing dimensionality adding more training data regularizing the model

4.5. Model Performance Assessment

4.5.1. Confusion Matrix summarizes the results of classification

4.5.2. Precision TP/(TP+FP) How many of the identified positives are actually positives (the proportion of relevant items to all items returned) high precision means that when you catch an item, it's actually what you want.

4.5.3. Recall (sensitivity) TP/(TP+FN) How many of the actual positives were identified (proportion of relevant items to all relevant items that could have been returned)

4.5.4. Accuracy (TP+TN)/total can be generalized to be cost sensitive (assign costs/weights to FP and FN) How many did we get right, out of everything Only works for balanced datasets

4.5.5. Receiver Operating Characteristic (ROC) can be used to assess classifiers that have a confidence score (probability/prediction threshold) a plot of TPR(TP/TP+FN) vs FPR(FP/FP+TN) for threshold=0, both TPR=FPR=1 for threshold=1, both TPR=FPR=0 The higher the area under the curve, the better the classifier.

4.5.6. Hyper-parameter tuning Brute Force Grid Search use grid search with logarithmic scale Random Search Bayesian Optimization Gradient Based Evolutionary

4.5.7. Cross Validation k-fold validation: split data into k sections, each time one section (fold) is used as the test set.

5. 4.Neural Networks & Deep Learning

5.1. Neural Nets

5.1.1. are generalized Logistic Regression

5.1.2. e.g. multi-layer perceptron (Feed Forward model)

5.2. Deep Learning

5.2.1. Neural Nets with more than 2 non-output layers

5.2.2. Convolutional Neural Net used in image and text processing each unit convolves a trainable filter with the input image

5.2.3. Recurrent Neural Nets used to label, generate and classify sequences in text and speech processing

6. 5.Problems & Solutions

6.1. Kernel Regression

6.1.1. non-parametric regression that can be used for nonlinear data. (only has a hyper-parameter b)

6.2. multi-class classification

6.2.1. if the algorithm is naturally binary (e.g. SVM) it can be generalized for multi-class classification using the one versus test.

6.3. one-class classification

6.3.1. used for detecting anomalies, outliers and novelties one-class Gaussian on-class kNN one-class k-means one-class SVM

6.4. multi-label classification

6.4.1. can be converted to multi-class classification

6.5. Ensemble Learning

6.5.1. combining an ensemble of weak (but fast) learners to make a high accuracy meta-model

6.5.2. Boosting using slightly different models on the same training data. each model tries to fix the errors made by the previous model iteratively. The final model is the certain combination of the weak models built iteratively. gradient boosting

6.5.3. Bagging Each model uses a slightly different copy of the training data to built multiple weak models and then combines them. Example: Random Forest

6.6. Active Learning

6.6.1. Applied when obtaining labeled data is costly density and uncertainty based model is trained with few labeled data. a score is calculated for unlabeled data (density x uncertainty). The data with highest scores are then labeled by an expert. Support Vector based a decision boundary is formed using labeled data. an expert annotates the unlabeled data closest to the boundary.

6.7. Semi-Supervised Learning

6.7.1. only a small fraction of the data is labeled.

6.8. auto-encoder

6.8.1. a network consisting of an encoder and decoder, which learns a representation of data with reduced dimensionality (learns structures in data in an unsupervised manner).

6.9. One-shot learning

6.9.1. uses a triple loss function (max of the distance from the anchor to the positive and negative examples.)

6.9.2. e.g. face-recognition

6.10. zero-shot learning

6.10.1. word embedding

7. 6.Advanced Practice

7.1. Imbalanced Dataset

7.1.1. solutions oversampling: making multiple copies of the underrepresented class undersampling: randomly removing copies of the majority class create synthetic examples SMOTE ADASYN decision trees, random forests, and gradient boosting often perform well with imbalanced datasets.

7.2. Combining Models

7.2.1. averaging for regression models, or classification models that return a classification score

7.2.2. majority vote for classification models

7.2.3. stacking a meta-model that takes the output of the base models as input

7.3. Training Neural Networks

7.3.1. image standardize pixels

7.3.2. text tokenize - bag of words word embedding

7.3.3. start with 1 or 2 layers and gradually increase the size

7.4. Advanced Regularization

7.4.1. dropout randomly dropping some of the data at each training epoch (similar to jackknife)

7.4.2. early stopping assessing the performance of the preliminary model on the validation set at the end of each epoch

7.4.3. batch normalization/standardization normalizing the output of each layer before passing it to the next layer as input

7.4.4. data augmentation synthesizing examples by applying transformations such as rotation, zooming, darkening, etc to the data the training data (especially image data) but keeping the original labels.

7.5. Transfer Learning

7.5.1. Using a neural net trained on some data set to predict examples from another one (the two data sets can be from different distributions).

7.6. Algorithmic Efficiency

7.6.1. avoid for loops whenever possible (use numpy instead)

7.6.2. if the order doesn't matter, use sets instead of loops

7.6.3. use dicts in python for fast key look-up

7.6.4. for iterating over a vast number of elements, use generators and

7.6.5. use cProfile, multiprocessing, PyPy, Numba

8. 7.Unsupervised Learning

8.1. Density Estimation

8.1.1. similar to kernel regression. Estimates the PDF using a gaussian kernel.

8.2. clustering

8.2.1. labeling unlabeled data

8.2.2. K-means number of clusters (k) is determined a priori k centroids are randomly chosen at first, then for each point the distance to the centroids is calculated and labels are assigned based on minimum distance. Then in every iteration the location of the centroid is updated. the clusters are hyperspheres it is non-deterministic: each run can lead to a different clustering.

8.2.3. DBSCAN is density based and groups together points that are packed together has 2 hyperparameters ϵ and n can create arbitrary shaped clusters

8.2.4. HDBSCAN only has one hyperparameter n: minimum number of points to put in a cluster slightly slower than modern k-means algorithms, but is more effective.

8.2.5. determining the optimal k splitting the data set into training and test sets and using "prediction strength" to determine k. experimentally, a reasonable number of clusters is the largest k that has PS>0.8. other methods gap statistic elbow method average silhouette method

8.2.6. Gaussian Mixture model soft clustering algorithm (probabilistic) finds cluster membership by maximizing a Gaussian likelihood clusters can be non-spherical (in contrast to k-means)

8.2.7. spectral clustering

8.2.8. hierarchical clustering

8.3. Dimensionality Reduction

8.3.1. PCA transforming the data into a new coordinate system such that the first coordinate is along the highest variance, the second coordinate is along the second highest variance etc.

8.3.2. UMAP

8.3.3. t-SNE

8.4. outlier detection

8.4.1. autoencoder

8.4.2. one-class classifier

9. 8.Other forms of Learning

9.1. metric learning

9.1.1. generalizing the distance calculation using a metric A and learning the best parameters from data

9.2. Learning to Recommend

9.2.1. content-based

9.2.2. collaborative

9.3. word embedding

9.3.1. word2vec skipgram