











Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!












The main branches of machine learning at a glance.
Guide contents
How to use this guide
The agent acts on the environment and uses state/reward feedback to improve its policy.
1.5 Self-supervised learning
02 | Supervised learning Three common prediction task families: classification, regression and clustering. 2.1 Classification: discrete output TASK TYPE WHAT IT PREDICTS EXAMPLES Binary classification One of two classes Spam / not spam; fraud / normal; disease / healthy Multi-class classification One class among more than two Digit recognition (0–9); animal species Multi-label classification Multiple labels may apply to one instance Image tagging: cat + outdoor + sunny
2.2 Regression: continuous output
2.3 Algorithm cheat sheet: supervised learning ALGORITHM TYPE BEST FOR PROS CONS Linear Regression Regression Linear relationships Simple and interpretable Assumes linearity Logistic Regression Classification Binary classification Fast; probabilistic output Linear decision boundary KNN Both Small datasets No explicit training phase Slow prediction; curse of dimensionality SVM Classification High-dimensional data Effective with a clear margin^ Slow on large data; kernel choice matters Decision Tree Both Interpretability Visual; no scaling needed Can overfit easily Random Forest Both General-purpose problems Robust; reduces overfitting Less interpretable Naive Bayes Classification Text classification Fast; works with small data^ Strong independence assumption
03 | Unsupervised learning 3.1 Clustering
K-Means Centroid-based clusters; the number of clusters k must be specified^ Fast; works best for roughly spherical clusters; sensitive to outliers DBSCAN Density-based; can identify noise and outliers Does not require k; can find arbitrary shapes Hierarchical clustering Builds a tree of clusters (dendrogram) Flexible cluster structure; often slower at scale Gaussian Mixture Model (GMM) Probabilistic cluster membership Can model elliptical clusters; number of components is set Mean Shift Seeks dense regions or modes Does not require k; can be slow
K-Means: the iterative idea K-Means initializes centroids, assigns points to clusters, updates centroids and repeats until convergence. 3.2 Dimensionality reduction
PCA Linear; finds components explaining variance^ Preprocessing, compression and noise reduction t-SNE Non-linear; mainly for visualization Visualizing clusters in 2D or 3D UMAP Non-linear; often faster than t-SNE Low-dimensional visualization LDA Linear Discriminant Analysis; supervised Projection that uses class information Autoencoders Neural-network-based representation learning^ Compression, denoising and anomaly detection
PCA vs. t-SNE FEATURE PCA t-SNE Type Linear Non-linear Primary purpose Dimensionality reduction Visualization in 2D/3D Structure emphasized Global structure Local structure Speed Fast Slower; often described as O(n²) Determinism Deterministic for fixed settings/data Can vary with random initialization Typical use Preprocessing and noise removal Visualizing clusters 3.3 Association rules
A conceptual association rule and the support, confidence and lift measures used to assess it.
CNN architecture at a glance A typical CNN pipeline from input pixels to output class probabilities. 4.3 Training concepts TERM MEANING Epoch One complete pass through the training data. Batch size Number of samples used for a gradient update. Learning rate Step size used when updating weights. Optimizers SGD, Adam, RMSprop and AdamW. Regularization Methods include dropout, batch normalization and weight decay. Transfer learning Reuse a pretrained model; fine-tune it for a target task.
05 | Model evaluation 5.1 Classification metrics Confusion matrix True/false positives and negatives underpin common classification metrics. TERM MEANING TP — True Positive Correctly predicted positive. TN — True Negative Correctly predicted negative. FP — False Positive Wrongly predicted positive; also described as a Type I error. FN — False Negative Wrongly predicted negative; also described as a Type II error. METRIC FORMULA INTERPRETATION Accuracy (TP + TN) / (TP + TN + FP + FN) Overall share of correct predictions; can mislead on imbalanced data. Precision TP / (TP + FP) Of all predicted positives, how many are actually positive? Recall / Sensitivity TP / (TP + FN) Of all actual positives, how many did the model find? F1 score 2 × (Precision × Recall) / (Precision + Recall) Harmonic mean of precision and recall. ROC curve TPR versus FPR across thresholds Shows the trade-off as the classification threshold changes. AUC-ROC Area under the ROC curve 0.5 is random ranking; 1.0 is perfect separation. Log loss Probability-based loss Penalizes confident incorrect predictions.
5.4 Validation strategies STRATEGY HOW IT WORKS / WHEN TO USE Train/test split Common examples are 70/30 or 80/20. Train/validation/test split A common example is 60/20/20. K-fold cross-validation Split data into k folds (often 5 or 10); rotate the test fold. Stratified K-fold Preserves class proportions across folds. Leave-One-Out (LOOCV) Use one observation as the test item each time (k = n). Time-series split Keep observations chronological to avoid future-data leakage. In five-fold cross-validation, each fold becomes the test fold once. Metric selection guide PROBLEM PRIMARY METRIC WHY Balanced classification Accuracy Classes are represented comparably. Imbalanced classification F1 or AUC-ROC Accuracy alone can be misleading. Spam detection Precision Minimize false positives. Cancer detection Recall Minimize false negatives. Regression RMSE, MAE, R² Choice depends partly on outlier sensitivity and interpretation. Ranking NDCG, MAP Ordering matters. Anomaly detection Precision@k, AUC The positive class is rare.
06 | Machine-learning workflow
End-to-end ML workflow from defining the problem to monitoring and iteration.
1. Problem definition
2. Data collection
3. Data preprocessing
4. Exploratory data analysis (EDA)
5. Feature engineering
6. Model selection
7. Model training
8. Model evaluation
07 | Master algorithm comparison ALGORITHM TASK INTERPRET. NON-LINEARITY SCALING? SPEED BEST FOR Linear Regression Regression Very high Limited by default Usually no Fast Baseline and linear data Logistic Regression Classification^ Very high^ Limited by default^ Often yes^ Fast^ Baseline, binary classification KNN Both Medium Yes Yes Slow at prediction Small datasets SVM Classification Low–medium Yes, with kernels Yes Medium High-dimensional data with clear margins Decision Tree Both Very high Yes No Fast Interpretability Random Forest Both Medium Yes No Medium General-purpose tabular problems Gradient Boosting Both Low–medium Yes Usually no Can be slow Tabular prediction tasks Naive Bayes Classification Medium–high Limited No Fast Text classification Neural Network Both Low Yes Often yes Can be slow Complex patterns and larger data K-Means Clustering Medium Spherical clusters Yes Fast Spherical clusters DBSCAN Clustering Medium Arbitrary shapes Distance scale matters Medium Outliers and non-spherical clusters PCA Dimensionality reduction Low–medium Linear Yes Fast Preprocessing and compression t-SNE Dimensionality reduction Low Non-linear Depends on pipeline Slow Visualization
08 | Decision guides and quick fixes 8.1 Which algorithm should you try first? A practical first-pass decision guide based on labels and the task objective. Expanded choice guide QUESTION DIRECTION CANDIDATE METHODS Have labeled outcomes? Yes → supervised learning Classification or regression based on the target. Predicting a category? Binary Logistic Regression, SVM or Random Forest. Predicting a category? Multi-class Random Forest, Gradient Boosting or Neural Network. Predicting text labels? Text classification Naive Bayes, BERT or Logistic Regression. Predicting a number? Linear relationship Linear Regression, Ridge or Lasso. Predicting a number? Non-linear relationship Random Forest, Gradient Boosting or Neural Network. Predicting a time series? Time-dependent data ARIMA, LSTM or Prophet; validate chronologically. No labels? Group similar items K-Means, DBSCAN or Hierarchical Clustering. No labels? Reduce dimensions PCA, t-SNE or UMAP. No labels? Find co-occurrence patterns Association rules with Apriori. Need decisions from interaction? Reward-driven objective Q-Learning / DQN for discrete actions; DDPG, PPO or SAC for continuous actions. 8.2 Fixing underfitting and overfitting PROBLEM SYMPTOM POSSIBLE SOLUTIONS Underfitting High training error and high test error Use a more complex model, add useful features, reduce regularization or train longer.
09 | Key takeaways
Quick final checklist