



Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!




Last Updated June 19, 2021
Binomial - x successes in n events, each with p probability →
(n x
pxqn−x, with μ = np and σ^2 = npq
Geometric - first success with p probability on the nth^ trial → qn−^1 p, with μ = 1/p and σ^2 = (^1) p− 2 p
Negative Binomial - number of failures before r successes Hypergeometric - x successes in n draws, no replacement, from a size N population with X items of that feature
→
(X x
)(N −X n−x
) (N n
) (^) , with μ = nXN
Poisson - number of successes x in a fixed time interval, where success occurs at an average rate λ → λ xe−λ x! , with^ μ^ =^ σ (^2) = λ
Uniform - all values between a and b are equally likely
→ (^) b−^1 a with μ = a+ 2 band σ^2 = (b−a)
2 12 or^
n^2 − 1 12 if discrete Normal/Gaussian N (μ, σ), Standard Normal Z ∼ N (0, 1)
Exponential - memoryless time between independent events occurring at an average rate λ → λe−λx, with μ = (^1) λ Gamma - time until n independent events occurring at an average rate λ
Prediction Error = Bias^2 + Variance + Irreducible Noise Bias - wrong assumptions when training → can’t capture underlying patterns → underfit Variance - sensitive to fluctuations when training→ can’t generalize on unseen data → overfit The bias-variance tradeoff attempts to minimize these two sources of error, through methods such as:
Cross Validation - validates test error with a subset of training data, and selects parameters to maximize average performance
Mean Squared Error (MSE) = (^1) n
(yi − yˆ)^2 Sum of Squared Error (SSE) =
(yi − ˆy)^2 Total Sum of Squares (SST) =
(yi − y¯)^2 R^2 = 1 − SSESST , the proportion of explained y-variability Note, negative R^2 means the model is worse than just predicting the mean. R^2 is not valid for nonlinear models, as SSresidual+SSerror 6 = SST. Adjusted R^2 = 1 − (1 − R^2 ) (^) NN −^ −p−^11 , which changes only when predictors affect R^2 above what would be expected by chance
Predict Yes Predict No Actual Yes True Positive (1 − β) False Negative (β) Actual No False Positive (α) True Negative (1 − α)
Models linear relationships between a continuous response and explanatory variables Ordinary Least Squares - find βˆ for ˆy = βˆ 0 + βXˆ + by solving βˆ = (XT^ X)−^1 XT^ Y which minimizes the SSE Assumptions
| βˆ|
( βˆ)^2
Predicts probability that y belongs to a binary class. Estimates β through maximum likelihood estimation (MLE) by fitting a logistic (sigmoid) function to the data. This is equivalent to minimizing the cross entropy loss. Regularization can be added in the exponent. P (Y = 1) =
1 + e−(β^0 +βx) The threshold a classifies predictions as either 1 or 0 Assumptions
CART for regression minimizes SSE by splitting data into sub-regions and predicting the average value at leaf nodes. The complexity parameter cp only keeps splits that reduce loss by at least cp (small cp → deep tree)
CART for classification minimizes the sum of region impurity, where ˆpi is the probability of a sample being in category i. Possible measures, each with a max impurity of 0.5.
( ˆpi)^2
( ˆpi)log 2 ( ˆpi) At each leaf node, CART predicts the most frequent category, assuming false negative and false positive costs are the same. The splitting process handles multicollinearity and outliers. Trees are prone to high variance, so tune through CV.
Trains an ensemble of trees that vote for the final prediction Bootstrapping - sampling with replacement (will contain duplicates), until the sample is as large as the training set Bagging - training independent models on different subsets of the data, which reduces variance. Each tree is trained on ∼63% of the data, so the out-of-bag 37% can estimate prediction error without resorting to CV. Deep trees may overfit, but adding more trees does not cause overfitting. Model bias is always equal to one of its individual trees. Variable Importance - ranks variables by their ability to minimize error when split upon, averaged across all trees
Separates data between two classes by maximizing the margin between the hyperplane and the nearest data points of any class. Relies on the following:
Support Vector Classifiers - account for outliers through the regularization parameter C, which penalizes misclassifications in the margin by a factor of C > 0 Kernel Functions - solve nonlinear problems by computing the similarity between points a, b and mapping the data to a higher dimension. Common functions:
Hinge Loss - max(0, 1 − yi(wT^ xi − b)), where w is the margin width, b is the offset bias, and classes are labeled ±1. Acts as the cost function for SVM. Note, even a correct prediction inside the margin gives loss > 0.
To classify data with 3+ classes C, a common method is to binarize the problem through:
Non-parametric method that calculates ˆy using the average value or most common class of its k-nearest points. For high-dimensional data, information is lost through equidistant vectors, so dimension reduction is often applied prior to k-NN. Minkowski Distance = (
|ai − bi|p)^1 /p
|ai − bi|
(ai − bi)^2
Hamming Distance - count of the differences between two vectors, often used to compare categorical variables
Unsupervised, non-parametric methods that groups similar data points together based on distance
Randomly place k centroids across normalized data, and assig observations to the nearest centroid. Recalculate centroids as the mean of assignments and repeat until convergence. Using the median or medoid (actual data point) may be more robust to noise and outliers. k-modes is used for categorical data. k-means++ - improves selection of initial clusters
Clusters data into groups using a predominant hierarchy Agglomerative Approach
High-dimensional data can lead to the curse of dimensionality, which increases the risk of overfitting and decreases the value added. The number of samples for each feature combination quickly becomes sparse, reducing model performance.
Projects data onto orthogonal vectors that maximize variance. Remember, given an n × n matrix A, a nonzero vector ~x, and a scaler λ, if A~x = λ~x then ~x and λ are an eigenvector and eigenvalue of A. In PCA, the eigenvectors are uncorrelated and represent principal components.
Supervised method that maximizes separation between classes and minimizes variance within classes for a labeled dataset
Describes data using a linear combination of k latent factors. Given a normalized matrix X, it follows the form X = Lf + , with factor loadings L and hidden factors f.
Scree Plot - graphs the eigenvalues of factors (or principal components) and is used to determine the number of factors to retain. The ’elbow’ where values level off is often used as the cutoff.
Sequentially fits many simple models that account for the previous model’s errors. As opposed to bagging, boosting trains on all the data and combines models using the learning rate α.
AdaBoost - uses sample weighting and decision ’stumps’ (one-level decision trees) to classify samples
Gradient Boost - trains sequential models by minimizing a given loss function using gradient descent at each step
XGBoost - fast gradient boosting method that utilizes regularization and parallelization
Suggests relevant items to users by predicting ratings and preferences, and is divided into two main types:
The latter is more common, and includes methods such as: Memory-based Approaches - finds neighborhoods by using rating data to compute user and item similarity, measured using correlation or cosine similarity
Model-based Approaches - predict ratings of unrated items, through methods such as Bayesian networks, SVD, and clustering. Handles sparse data better than memory-based approaches.
Recommender systems can also be combined through ensemble methods to improve performance.
Maximizes future rewards by learning through state-action pairs. That is, an agent performs actions in an environment, which updates the state and provides a reward.
Multi-armed Bandit Problem - a gambler plays slot machines with unknown probability distributions and must decide the best strategy to maximize reward. This exemplifies the exploration-exploitation tradeoff, as the best long-term strategy may involve short-term sacrifices. RL is divided into two types, with the former being more common:
Q(s, a)
Deep RL algorithms can further be divided into two main types, depending on their learning objective Value Learning - aims to approximate Q(s, a) for all actions the agent can take, but is restricted to discrete action spaces. Can use the -greedy method, where measures the probability of exploration. If chosen, the next action is selected uniformly at random.
Identifies unusual patterns that differ from the majority of the data. Assumes that anomalies are:
The decoder struggles to capture anomalous patterns, and the reconstruction error acts as a score to detect anomalies. Autoencoders can also be used for image processing, dimension reduction, and information retrieval. Hidden Markov Model - uses observed events O to model a set of n underlying states Q using λ = (A, B, π)
Extracts characteristics from time-sequenced data, which may exhibit the following characteristics:
CV must account for the time aspect, such as for each fold Fx:
Exponential Smoothing - uses an exponentially decreasing weight to observations over time, and takes a moving average. The time t output is st = αxt + (1 − α)st− 1 , where 0 < α < 1.
Double Exponential Smoothing - applies a recursive exponential filter to capture trends within a time series st = αxt + (1 − α)(st− 1 + bt− 1 ) bt = β(st − st− 1 ) + (1 − β)bt− 1 Triple exponential smoothing adds a third variable γ that accounts for seasonality.
ARIMA - models time series using three parameters (p, d, q):
SARIMA - models seasonality through four additional seasonality-specific parameters: P , D, Q, and the season length s
Prophet - additive model that uses non-linear trends to account for multiple seasonalities such as yearly, weekly, and daily. Robust to missing data and handles outliers well. Can be represented as: y(t) = g(t) + s(t) + h(t) + (t), with four distinct components for the growth over time, seasonality, holiday effects, and error. This specification is similar to a generalized additive model.
Generalized Additive Model - combine predictive methods while preserving additivity across variables, in a form such as y = β 0 + f 1 (x 1 ) + · · · + fm(xm), where functions can be non-linear. GAMs also provide regularized and interpretable solutions for regression and classification problems.
Classifies data using the label with the highest conditional probability, given data a and classes c. Naive because it assumes variables are independent. Bayes’ Theorem P (ci|a) = P^ (a| Pci ()aP)^ (ci) Gaussian Naive Bayes - calculates conditional probability for continuous data by assuming a normal distribution
p-value - probability that an effect could have occurred by chance. If less than the significance level α, or if the test statistic is greater than the critical value, then reject the null. Type I Error (False Positive α) - rejecting a true null Type II Error (False Negative β) - not rejecting a false null Decreasing Type I Error causes an increase in Type II Error Confidence Level (1 - α) - probability of finding an effect that did not occur by chance and avoiding a Type I error Power (1 - β) - probability of picking up on an effect that is present and avoiding a Type II Error Confidence Interval - estimated interval that models the long-term frequency of capturing the true parameter value z-test - tests whether normally distributed population means are different, used when n is large and variances are known
∑ (^) observed−expected expected to test:
Conditional Probability P (A | B) = P^ P(A (∩BB)) If A and B are independent, then P (A ∩ B) = P (A)P (B). Note, events that are independent of themselves must have probability either 1 or 0. Union P (A ∪ B) = P (A) + P (B) − P (A ∩ B) Mutually Exclusive - events cannot happen simultaneously Expected Value E[X] =
xipi, with properties
∑ (xi−x¯)(yi−y¯) n− 1 Correlation - normalizes covariance to provide both strength and direction of linear relationships → r = Cov σx(σx,yy) Independent variables are uncorrelated, though the inverse is not necessarily true
Examines user experience through randomized tests with two variants. The typical steps are:
Shapley Values - measures the marginal contribution of each variable in the output of a model, where the sum of all Shapley values equals the total value (prediction − mean prediction) SHAP - interpretable Shapley method that utilizes both global and local importance to model variable explainability Permutation - order matters → (^) (n−n!k)! = nPk Combination - order doesn’t matter → (^) k!(nn−!k)! = nCk =
(n k
Left Skew - Mean < Median ≤ Mode Right Skew - Mean > Median ≥ Mode Probability vs Likelihood - given a situation θ and observed outcomes O, probability is calculated as P (O|θ). However, when true values for θ are unknown, O is used to estimate the θ that maximizes the likelihood function. That is, L(θ|O) = P (O|θ).