台湾大学林轩田机器学习笔记: https://wizardforcel.gitbooks.io/ntu-hsuantienlin-ml/content/
字典 https://ml-cheatsheet.readthedocs.io/en/latest/
Andrew Ng 系列课程 https://www.coursera.org/learn/neural-networks-deep-learning
怎样学习Deep learning https://www.zhihu.com/question/26006703/answer/536169538
https://towardsdatascience.com/types-of-machine-learning-algorithms-you-should-know-953a08248861
{width="9.675213254593176in"
height="4.219241032370953in"}
- Regression analysis is sensitive to outliers
- The main assumptions of regression are normality, homoscedasticity, and absence of multicollinearity.
| Regression | Assumptions |
|---|---|
| Linear | http://www.statisticssolutions.com/assumptions-of-linear-regression/ • Linear relationship between independent and dependent variables • All variables obey Multivariate Gaussian Distribution This is why it is sensitive to outliers. When the data is not normally distributed a non-linear transformation (e.g., log-transformation) might fix this issue. • there is little or no multicollinearity (correlation between features) • there is little or no autocorrelation (correlation with previous data on a feature) • ? |
| Logistic | ? |
| Naive Bayes classifier | independence between every pair of features |
http://www.statisticssolutions.com/directory-of-statistical-analyses-regression-analysis/regression/
regression = prediction
| Name | H(x) | Output | Type |
|---|---|---|---|
| Linear Regression | Numbers | Regression | |
| Polynomial (linear) Regression | Numbers | Regression | |
| Logistic Regression | Numbers in (0, 1) Odds / probability |
Regression | |
| Probit | |||
| OLS | |||
| Locally Weighted Linear (LWLR) | |||
| Perceptron Learning Algorithm (PLA) | Classification |
it's the expected loss of f , where the expectation is over (x,y) ∼ PX×Y.
It evaluates the performance of a model in all predictions
Where the slope is zero
How Do We Know it is a Maximum (or Minimum)? - Second Derivative Test: derivative of the slope
When a function's slope is zero at x, and the second derivative at x is:
-
less than 0, it is a local maximum -- like the plot above
-
greater than 0, it is a local minimum
-
equal to 0, then the test fails (there may be other ways of finding out though)
https://www.shuxuele.com/calculus/maxima-minima.html
{width="5.21330927384077in"
height="2.945744750656168in"}
https://www.youtube.com/watch?v=tIpKfDc295M&feature=youtu.be
https://www.jianshu.com/p/c7e642877b0e
https://jums.club/pdf/Gradient_Descent.pdf
the inverse of the [sigmoidal "logistic" function](#Logistic / Inverse Logit Function)
{width="4.557377515310586in"
height="3.7131211723534556in"}
Hypothesis function
Then
Decision boundary is used to flag (0 or 1) y, which is different from Hypothesis function.
- linear
$\theta_{0} + \theta_{1}x_{1} + \theta_{2}x_{2}$ or - non-linear
$\theta_{0} + \theta_{1}x_{1} + \theta_{2}x_{2}^{2}$ polynomial regression, or - any other shape (e.g. circle).
If
This means that if
If
Each coefficient represents the additional effect of adding that variable to the model, that's why multicollinearity should be avoid.
https://www.theanalysisfactor.com/interpreting-regression-coefficients/
Using L1 norm on linear regression
Using L2 norm on linear regression
https://blog.csdn.net/jinping_shi/article/details/52433975
Multivariable normal distribution
The marginal distributions of
{width="5.615999562554681in"
height="3.2949168853893265in"}
https://www.qiujiawei.com/linear-algebra-11/
For Logistic Regression or a unit of neural network
Having decision functions for an output
Want to function
A decision function is a function which takes a dataset as input and gives a decision as output. What the decision can be depends on the problem at hand. Examples include:
- Estimation problems: the "decision" is the estimate.
- Hypothesis testing problems: the decision is to reject or not reject the null hypothesis.
- Classification problems: the decision is to classify a new observation (or observations) into a category.
- Model selection problems: the decision is to chose one of the candidate models.
Loss function describes the loss (or cost) associated with all possible decisions.
It evaluates the performance of a model in a prediction.
Loss function is: $$ \displaystyle L(y, \hat{y}) $$
Loss functions are used to determine which decision function to use. The best decision function is the function that yields the lowest expected loss.
https://ml-cheatsheet.readthedocs.io/en/latest/loss_functions.html
https://towardsdatascience.com/what-is-loss-function-1e2605aeb904
https://www.numpyninja.com/post/loss-functions-when-to-use-which-one
Cross-entropy link or Log loss
Understand Cross-entropy https://zhuanlan.zhihu.com/p/38241764 $$ \displaystyle L(y, \hat{y})=−[𝑦log(\hat{y})+(1−𝑦)log(1−\hat{y})] $$
Cost function $$ \displaystyle J(w, b)=−\frac{1}{m}\sum_{i=1}^{m}[𝑦^{(i)}log(\hat{y}^{(i)})+(1−𝑦^{(i)})log(1−\hat{y}^{(i)})] $$ The cost function of Log loss win because the cost function is convex that has a global optimal, compare to mean square error that is non convex and has a lot of local optimal
Exponential Loss link
Hinge Loss link
Kullback Leibler Divergence Loss link
Mean Square Error (MSE- L2) also called L2 regularization link
Mean Absolute Error (MAE- L1) also called L1 regularization link
Huber Loss link: a combination of MAE and MSE (L1-L2)
RMSE link
the cost function is the average of the loss functions of the entire training set. $$ J(w, b)=\frac{1}{m}\sum_{i=1}^{m}L(\hat y^{(i)}, y^{(i)}) $$ The cost function of Log loss win because the cost function is convex that has a global optimal, compare to mean square error that is non convex and has a lot of local optimal.
Activation Functions are decision making units of neural networks. They calculate net output of a neural node. An Activation Function decides whether a neuron should be activated (1) or not (0). This means that it will decide whether the neuron’s input to the network is important or not in the process of prediction using simpler mathematical operations.
The role of the Activation Function is to derive output from a set of input values fed to a node (or a layer).
"S"-shaped curve or sigmoid curve.
Sigmoid functions have domain of all real numbers, with return value monotonically increasing most often from 0 to 1 or alternatively from −1 to 1, depending on convention.
Given a numeric object return the inverse logit of the values in range (0, 1) $$ g(z) = logistic(z) = \frac{1}{1 + e^{- z}} = \frac{e^{z}}{e^{z} + 1} $$
https://en.wikipedia.org/wiki/Sigmoid_function
{width="7.1in"
height="3.547222222222222in"}
Map input to (0, 1) as probability
https://blog.csdn.net/huangfei711/article/details/78480078
https://www.cs.toronto.edu/~duvenaud/cookbook/
{width="2.6098436132983376in"
height="0.760148731408574in"}
https://blog.csdn.net/yzf0011/article/details/71521001
https://rorasa.wordpress.com/2012/05/13/l0-norm-l1-norm-l2-norm-l-infinity-norm/
https://blog.csdn.net/zouxy09/article/details/24971995/
The count of non-zeros in vector -> sparse
Sum of absolute value of vector
{width="2.6in"
height="2.6in"}
{width="2.6in"
height="2.6in"}
L1 has sparsity: running Lasso linear regression, can get sparse coefficient
{width="4.980995188101487in"
height="2.4904975940507437in"}
{width="4.677257217847769in"
height="5.1in"}
{width="2.0473075240594927in"
height="3.5in"}
https://www.jianshu.com/p/45968f4d5f86
https://blog.csdn.net/key_v/article/details/48008725
When
{width="5.046153762029746in"
height="3.224786745406824in"}
{width="4.4in"
height="3.299620516185477in"}
https://blog.csdn.net/jorg_zhao/article/details/52687448
Signal has larger power/variance than noise
{width="5.929725503062118in"
height="2.2in"}
https://www.zhihu.com/question/24124122/answer/50403932
https://www.zhihu.com/question/26602796/answer/33431062
https://blog.csdn.net/m0_37407756/article/details/68059453
https://zhuanlan.zhihu.com/p/26015351
Naive Bayes is called naive because it assumes that each input variable is independent. This is a strong assumption and unrealistic for real data; however, the technique is very effective on a large range of complex problems.
- Random Forest : Bagging + Decision tree
- Boosting Tree : AdaBoost + Decision tree
- GBDT : Gradient Boost + Decision tree
https://www.datalearner.com/blog/1051538295125157
bootstrap aggregating
{width="6.1064348206474195in"
height="4.572421259842519in"}
https://blog.csdn.net/xbinworld/article/details/44660339
A kind of Ensemble Learning
Bagging + Decision Tree
{width="6.091535433070866in"
height="4.576052055993001in"}
http://backnode.github.io/pages/2015/04/23/random-forest.html
A polynomial turns a linear regression model into a curve. Although polynomial regression fits a nonlinear model to the data, as a statistical estimation problem it is linear, because it is X that is squared, cubed or higher degrees, not the Beta coefficient
A polynomial in the variable 𝑥 is a representation of a function
We call the values $\mathbf{a}{\mathbf{0}},\ \mathbf{a}{\mathbf{1}},\ \cdots,\ \mathbf{a}_{\mathbf{n} - \mathbf{1}}$ the coefficients of the polynomial
$A(x)\ $is said to have degree n if its highest nonzero coefficient
is
Any integer strictly greater than the degree (n) of a polynomial is a degree-bound of that polynomial
of a polynomial
{width="3.722494531933508in"
height="0.7112718722659668in"}
A point-value representation of a polynomial
such that all of the
{width="3.7822440944881888in"
height="0.692308617672791in"}
Calculate
If
Multiplication of two degree-bound n polynomials
{width="4.259185258092739in"
height="1.7393164916885389in"}
The resulting coefficient vector
Not finished ... Must read
The beta coefficient is the degree of change in the outcome variable for every 1-unit of change in the predictor variable.
http://www.statisticssolutions.com/directory-of-statistical-analyses-regression-analysis/regression/
Convolution: Continuous
Discrete
Understand the formula:
n /
i / t: All of available moment before current and current moment (
Example:
{width="4.1091590113735785in"
height="1.9633453630796152in"}
Autocorrelation:
In complex space:
Autocorrelation:
{width="3.670967847769029in"
height="2.7546620734908136in"}
Convolution in the time domain is equivalent to multiplication in the frequency domain and vice versa.
a convolution x(t) * y(t) in time/space is equivalent to the multiplication X(f) Y(f) in the Fourier domain, after appropriate padding (padding is necessary to prevent circular convolution)
They are inverse to each other.
Probabilistic predict what would happen (possible observation) from a known random process
Find a description of an unknown random process by known observations
https://www.jianshu.com/p/607c64556a08
https://www.cnblogs.com/heaad/archive/2011/03/08/1977733.html
For 2
Euclidean distance after z normalization
https://stats.stackexchange.com/a/62147
There is a set of parameters that describe the process.
Examples:
-
Flipping a coin,
-
Number of heads after 100 tosses of fair coin
-
Rolling dice
-
Measuring the rain that might fall tomorrow
Mapping / quantifying the outcomes of random process to numbers.
For example: flipping a coin, outcomes are heads and tails
A sample is a test.
In a test, multiple observations / outcomes can be got.
The values of these observations follow a distribution of a random variable.
https://www3.nd.edu/~rwilliam/stats1/x12.pdf
a, b are any given constants. X, Y are random variables. The following applies
-
$\mathbf{E}\left( \mathbf{X} \right) = \ µ\mathbf{x}\ = \ \mathbf{\Sigma}\ \mathbf{xp}\left( \mathbf{x} \right)$ (discrete case) -
$\mathbf{E}\left( \mathbf{g}\left( \mathbf{X} \right) \right)\mathbf{= \ \Sigma\ g}\left( \mathbf{x} \right)\mathbf{p}\left( \mathbf{x} \right)\mathbf{= \ }\mathbf{µ}_{\mathbf{g}\left( \mathbf{X} \right)}$ **(discrete case)
**NOTE:$g(X)$ is some function of$X$ . So, for example, if$X$ is discrete and$g(X) = \ X^{2}$ , then$E\left( X^{2} \right) = \ \Sigma\ x^{2}p(x)$ . -
$\mathbf{V}\left( \mathbf{X} \right) = \ \mathbf{E}\left\lbrack \left( \mathbf{X}\ - \ \mathbf{E}\left( \mathbf{X} \right) \right)^{\mathbf{2}} \right\rbrack = \ \mathbf{E}\left( \mathbf{X}^{\mathbf{2}} \right) - \ {\mathbf{E}\left( \mathbf{X} \right)}^{\mathbf{2}} = {\mathbf{\sigma}_{\mathbf{x}}}^{\mathbf{2}}$ -
$\mathbf{E}\left( \mathbf{a} \right)\mathbf{= \ a}$ **
**That is, the expectation of a constant is the constant, e.g.$E(7) = \ 7$ -
$\mathbf{E}\left( \mathbf{aX} \right)\mathbf{= \ a*E}\left( \mathbf{X} \right)$ **
**e.g. if you multiple every value by 2, the expectation doubles. -
$\mathbf{E}\left( \mathbf{a\ } \pm \mathbf{\ X} \right)\mathbf{= \ a\ } \pm \mathbf{\ E}\left( \mathbf{X} \right)$ **
**e.g. if you add 7 to every case, the expectation will increase by 7 -
$\mathbf{E}\left( \mathbf{a}\ \pm \ \mathbf{bX} \right) = \ \mathbf{a}\ \pm \ \mathbf{bE}\left( \mathbf{X} \right)$
$\mathbf{E}\left\lbrack \left( \mathbf{a}\ \pm \ \mathbf{X} \right)\ \mathbf{b} \right\rbrack = \ \left( \mathbf{a}\ \pm \ \mathbf{E}\left( \mathbf{X} \right) \right)\ \mathbf{b}$ -
$\mathbf{E}\left( \mathbf{X\ + \ Y} \right)\mathbf{= \ E}\left( \mathbf{X} \right)\mathbf{+ \ E}\left( \mathbf{Y} \right)$ .
The expectation of a sum = the sum of the expectations. This rule extends as you would expect it to when there are more than 2 random variables,
e.g.$E(X + Y + Z) = E(X) + E(Y) + E(Z)$
Question: What is
-
$\mathbf{V}\left( \mathbf{a} \right)\mathbf{= \ 0}$ **
**A constant does not vary, so the variance of a constant is 0, e.g.$V(7) = \ 0$ . -
$\mathbf{V}\left( \mathbf{a} \pm \mathbf{X} \right)\mathbf{= V}\left( \mathbf{X} \right)$ **
**Adding a constant to a variable does not change its variance. -
$\mathbf{V}\left( \mathbf{a}\ \pm \ \mathbf{bX} \right) = \ \mathbf{b}^{\mathbf{2}}*\mathbf{V}\left( \mathbf{X} \right) = {\mathbf{\sigma}_{\mathbf{bX}}}^{\mathbf{2}}$ [Proof is below] -
$\mathbf{V}\left( \mathbf{X} \pm \mathbf{Y} \right) = \mathbf{V}\left( \mathbf{X} \right) + \mathbf{V}\left( \mathbf{Y} \right) \pm \mathbf{2}\mathbf{COV}\left( \mathbf{X},\mathbf{Y} \right) = {\mathbf{\sigma}_{\mathbf{X} \pm \mathbf{Y}}}^{\mathbf{2}}$
E(X) is applied when
The median absolute deviation is a measure of statistical dispersion. Moreover, the MAD is a robust statistic, being more resilient to outliers in a data set than the standard deviation. In the standard deviation, the distances from the mean are squared, so large deviations are weighted more heavily, and thus outliers can heavily influence it. In the MAD, the deviations of a small number of outliers are irrelevant.
Because the MAD is a more robust estimator of scale than the sample variance or standard deviation, it works better with distributions without a mean or variance, such as the Cauchy distribution.
https://blog.csdn.net/horses/article/details/78749485
Similar with Variance. Variance is a special format of Covariance.
Covariance matrix is Positive semi-definite matrix: proof https://math.stackexchange.com/questions/114072/what-is-the-proof-that-covariance-matrices-are-always-semi-definite
Check the linear relationship between two variables. Only when variables are unrelated Two-dimensional Gaussian distributed, Pearson correlation coefficient follows the t-test
To make non-linear data linear, transformations are applied (e.g. Log transformation).
Variance Inflation Factor,VIF:
Check the correlation between a variable and all remining variables
http://sofasofa.io/forum_main_post.php?postid=1000484
https://en.wikipedia.org/wiki/Variance_inflation_factor
{width="3.2744838145231845in"
height="2.885573053368329in"}
https://www.zhihu.com/question/20852004
four datasets that have nearly identical simple descriptive statistics yet appear very different when graphed.
For all four datasets:
Property Value Accuracy
Mean of x 9 exact
Sample variance of x 11 exact
Mean of y 7.50 to 2 decimal places
Sample variance of y 4.125 plus/minus 0.003
Correlation between x and y 0.816 to 3 decimal places
Linear regression line y = 3.00 + 0.500x to 2 and 3 decimal places, respectively
Coefficient of 0.67 to 2 decimal places
determination of
the linear regression
{width="5.58558508311461in"
height="4.05916447944007in"}
Dot product measure similarity:
A and B are vectors / matrices
So
if
if
if
For a vector x and a matrix A identify the type of the following objects:
For f :Rn →Rm, and f = (f1,...,fm) what are the types of the following expressions:
In linear algebra, the trace of an n-by-n square matrix A is defined to be the sum of the elements on the main diagonal (the diagonal from the upper left to the lower right) of A, i.e.,
{width="3.2003674540682416in"
height="0.5516371391076116in"}
{width="6.5in"
height="1.6736111111111112in"}
The inverse of
https://www.mathsisfun.com/algebra/matrix-determinant.html
The matrix doesn't have an inverse, which only happens when the determinant is zero.
{width="7.011164698162729in"
height="4.163906386701663in"}
https://www.mathsisfun.com/algebra/matrix-inverse.html
The normal vector often simply called the "normal," to a surface is a vector which is perpendicular to the surface at a given point.
{width="5.208333333333333in"
height="2.1756944444444444in"}
We want to optimize (i.e. find the minimum and maximum value of) a function $f(x,y,z)$, subject to the constraint $g(x,y,z) = k$.
If the two graphs are tangent at that point then their normal vectors must be parallel / collinear, i.e. the two normal vectors must be scalar multiples of each other. Mathematically, this means,
Form 1:
Form 2:
Solve:
https://www.youtube.com/watch?v=ry9cgNx1QV8
http://tutorial.math.lamar.edu/Classes/CalcIII/LagrangeMultipliers.aspx
Standard Form:
s
{width="3.9343700787401574in"
height="1.9176673228346457in"}
https://www.youtube.com/watch?v=JTTiELgMyuM
In linear algebra, positive-definite matrix is corresponding to the positive real numbers in Complex number
M is a Positive-definite matrix if the scalar
M is a Positive semi-definite matrix, when
And
So, the angle
https://zhuanlan.zhihu.com/p/44860862
{width="3.8372101924759403in"
height="1.7590430883639545in"}
{width="2.1142858705161856in"
height="0.8697386264216973in"}
$eigenvector = \begin{bmatrix} x \ y \ \end{bmatrix},\ eigenvalue = 3$, M=$\begin{bmatrix} 3 & 0 \ 0 & 1 \ \end{bmatrix}$
{width="3.8188976377952755in"
height="1.7880358705161854in"}
{width="1.2755905511811023in"
height="0.8519892825896763in"}
In essence, an eigenvector
referred to as the eigenvalue equation or eigenequation. In general,
Complex eigenvalue
So, the angle
A matrix can have more than one eigenvalue
https://blog.csdn.net/jinshengtao/article/details/18448355
{width="5.957738407699038in"
height="0.7689304461942257in"}
{width="6.116286089238845in"
height="1.0270384951881015in"}
{width="6.439589895013123in"
height="3.3663101487314084in"}
https://blog.csdn.net/jinshengtao/article/details/18448355
{width="5.265845363079615in"
height="4.175489938757655in"}
{width="6.188022747156605in"
height="4.6365069991251096in"}
A common (but not necessary) assumption is that the errors belong to a normal distribution. The central limit theorem supports the idea that this is a good approximation in many cases. $$ R^2=sum[y_i-f(x_i,a_1,a_2,...,a_n)]^2 $$
{width="2.8625in"
height="0.33611111111111114in"}d
To get the set of parameters that describe an unknown stochastic process, choose the value of parameters that could maximum the probability that would actually observe known outcomes.
Just like the likelihood function, Probability attaches to possible results; likelihood attaches to hypotheses.
Denote the observed outcomes by
Thus, when we speak of probability we want to calculate
Example: Suppose we have a coin that is assumed to be fair. If we flip the coin one time, the probability that it will land on heads is 0.5.
However, when we model a real life stochastic process, we often do not know
Notice that by definition the
Example: a coin landing on heads only 17 out of 100 times makes us highly suspicious that the truly probability of the coin landing on heads on a given toss is actually p = 0.5
Calculate the estimation of parameters
In order to maximize the function, we are going to need to differentiate
/ derivative the likelihood function with respect to
{width="3.120637576552931in"
height="2.3198392388451445in"}
The value of
Examples & Explanation:
https://onlinecourses.science.psu.edu/stat414/node/191/
Mean of A sample will approach to the mean of population when random variable for number of observations approach infinity.
The more random observations, the mean of the sample is the closer to the mean of the population
Sampling M times from population. In each sample, there are n observations.
Get means of each sample, then these means following the normal distribution.
-
The population doesn't need to follow normal distribution
-
It works when n>=30
https://zhuanlan.zhihu.com/p/25241653
http://blog.cloudera.com/wp-content/uploads/2015/12/distribution.png
{width="6.5in"
height="4.749291338582677in"}
{width="7.453378171478565in"
height="3.2414774715660544in"}
- Type I error is a false positive
- Type II error is a false negative.
When encounter Model Selection Problem, we separate a part of training set as validation set. For each modeling algorithm or a combination of hyper-parameters, we use the training set fit a model then use the validation set to get the validation error. Then we compare the validation errors to get the best amount all built models.
But there are problem to use a single way to split out the validation set. The validation errors varies when the seperation changes. So we would like to use all training data to find the best models. So we separate the training data to k pieces, each time we use one piece as the validation set and get the avg error for each model and pick the one with the minimal avg error.
Method:
- Leave-One-Out Cross Validation
- V-Fold Cross Validation: V is generally 5 or 10
https://zhuanlan.zhihu.com/p/24825503
https://wizardforcel.gitbooks.io/ntu-hsuantienlin-ml/content/16.html
- Parameters: when we train the model, the parameter are automaticly adjusted to fit the training data
- Hyperparameters: the settings for the models, like
sklearn.linear_model.**LogisticRegression**(*penalty='l2'*, ***, *dual=False*, *tol=0.0001*, *C=1.0*, *fit_intercept=True*, *intercept_scaling=1*, *class_weight=None*, *random_state=None*, *solver='lbfgs'*, *max_iter=100*, *multi_class='auto'*, *verbose=0*, *warm_start=False*, *n_jobs=None*, *l1_ratio=None*)here thepenalty,dual, ... are the hyper parameters
https://blog.csdn.net/UESTC_C2_403/article/details/77428736
{width="3.183999343832021in"
height="5.790143263342082in"}
http://scikit-learn.org/stable/modules/model_evaluation.html
{width="6.131058617672791in"
height="3.652795275590551in"}
{width="6.27989501312336in"
height="4.212765748031496in"}
{width="2.5461001749781276in"
height="2.594015748031496in"}
A macro-average will compute the metric independently for each class and then take the average (hence treating all classes equally), whereas a micro-average will aggregate the contributions of all classes to compute the average metric. In a multi-class classification setup, micro-average is preferable if you suspect there might be class imbalance (i.e you may have many more examples of one class than of other classes).
https://datascience.stackexchange.com/a/24051
Variance stabilizing transformations. Series in which the variance changes over time can often be stabilized using a natural log or square root transformation. These are also called functional transformations.
-
Natural log. The natural logarithm is applied to the series values.
-
Square root. The square root function is applied to the series values.
Natural log and square root transformations cannot be used for series with negative values.
Level stabilizing transformations. A slow decline of the values in the ACF (Autocorrelation Function) indicates that each series value is strongly correlated with the previous value. By analyzing the change in the series values, you obtain a stable level.
-
Simple differencing. The differences between each value and the previous value in the series are computed, except the oldest value in the series. This means that the differenced series will have one less value than the original series.
-
Seasonal differencing. Identical to simple differencing, except that the differences between each value and the previous seasonal value are computed.
Logarithm transformation is useful when the Variance of dependent variable increase with the increment of independent variable.
Logarithm transformation is not good for discrete variable.
Do not log-transform count data
Log transformation can change non-linear relationship between independent variable and dependent variable to linear relationship. Linear relationship is easy to be recognized by eyes, because it is a straight line.
Example - [The Pareto distribution](#Pareto distribution) and its [CCDF](#Complementary CDF?):
http://onlinestatbook.com/2/transformations/box-cox.html
https://www.itl.nist.gov/div898/handbook/eda/section3/eda336.htm
A Fourier transform converts a signal from time to frequency domain—it’s a very common way to extract features from audio signals or other time series such as sensor data.
https://betterexplained.com/articles/an-interactive-guide-to-the-fourier-transform/
Where
When c (the center of the series) is 0
- The geometric series formula
Which is valid for
- The exponential function formula
- The sine formula
valid for all real x
Where
https://www.jianshu.com/p/400d93229ff5
If function is smooth (A smooth function is a function that has derivatives of all orders everywhere in its domain.), do Linear approximation on each order of derivatives.
{width="4.7934547244094485in"
height="0.4671784776902887in"}
{width="4.1430391513560805in"
{width="1.8549529746281714in"
{width="0.7995450568678916in"
{width="2.0556364829396325in"
height="0.3639676290463692in"}
{width="4.43619750656168in" height="3.464313210848644in"} height="3.686836176727909in"} height="0.6875984251968504in"}
height="2.326142825896763in"}
https://www.zhihu.com/question/25627482
https://en.wikipedia.org/wiki/Newton's_method#/media/File:NewtonIteration_Ani.gif
{width="4.666666666666667in"
height="3.3333333333333335in"}
https://zhuanlan.zhihu.com/p/20700731
if all random variables in the sequence or vector have the same finite variance. This is also known as homogeneity of variance, like white noise.
if there are sub-populations that have different variabilities from others.
X-axis: x
Y-axis: error / residual = actual y -- predicted y
Residual plot is used to check the regression analysis. A residual plot is a graph that shows the residuals/Error/Stochastic on the vertical axis and the independent variable on the horizontal axis. If the points in a residual plot are randomly dispersed around the horizontal axis, a linear regression model is appropriate for the data (like plot a); otherwise, some deterministic is missed by the regression model and a non-linear model is more appropriate.
Pattern What the pattern may indicate
Fanning or uneven spreading of Non-constant variance/ residuals across fitted values / cone Heteroscedasticity shape
Curvilinear A missing higher-order term
A point that is far away from zero An outlier
{width="5.009008092738408in"
height="3.747937445319335in"}
http://www.sohu.com/a/164969711_464026
https://stattrek.com/statistics/dictionary.aspx?definition=residual%20plot
http://reference.wolfram.com/language/guide/StatisticalVisualization.html
{width="5.5341786964129485in"
height="5.593180227471566in"}
{width="4.203842957130359in"
height="2.3062751531058616in"}
-
Arrange your samples/x-values in ascending order.
-
Calculate
$fi\ = \ (i - 0.375)/(n + 0.25)$ , where i is the position of the data value in the ordered list and n is the number of observations. -
Find the z-score for each
$fi$ in Probability distribution table -
Plot your x-values on the horizontal axis and the corresponding z-score on the vertical axis.
{width="2.6972014435695537in"
height="2.5059394138232722in"} -
If the plot is a straight line, then the samples follow the distribution.
Grubbs' Test for There is exactly
Outliers one outlier in the
data set
Tietjen-Moore test There are exactly k
outliers in the data
set
Generalized ESD Test There are up to r
for Outliers outliers in the data
set
invertible == monotonicity
There are 2 types of value: 1 or 0
CDF is a continuous function
When data set is very small, for distribution fitting, one way to evaluate the quality of
fit is to generate a sample from a continuous distribution and see how well
it matches the data.
{width="5.567567804024497in"
height="2.830615704286964in"}
Normality can be assessed by examining a normal P-P plot
Anderson-Darling, Kolmogorov-Smirnov, and Ryan-Joiner normality tests
[Normal probability plot](#Probability Plot)
{width="5.143620953630796in"
height="3.014167760279965in"}
https://zhuanlan.zhihu.com/p/26193492
https://zhuanlan.zhihu.com/p/30343287
https://www.coursera.org/lecture/machine-learning/multivariate-gaussian-distribution-Cf8DF
N(t) denote the number of events that occur between now and time t, then the probability that n events occur within the next t time-units, or P(N(t)=n), is
{width="3.2299267279090116in"
height="2.5839413823272093in"}
{width="3.2043799212598425in"
height="2.563503937007874in"}
the waiting times between events in a Poisson process are exponentially distributed. The exponential distribution can be derived from the Poisson distribution: Let X be the waiting time between now and the next event. The probability that X is greater than t is identical to the probability that 0 events occur between now and time t, which we already know:
{width="3.487603893263342in"
height="2.7900831146106735in"}
{width="3.512397200349956in"
height="2.8099179790026247in"}
http://www.ruanyifeng.com/blog/2015/06/poisson-distribution.html
Skewed, fat-tailed distribution
"80% of the land in Italy was owned by about 20% of the population"
Examples
normal variables whose values are A person's height as being the distribution determined by an infinite result of very many independent number of independent random factors such as numerous events. specific genetic predispositions, early childhood diseases, nutrition, etc.
http://www.physics.csbsju.edu/stats/display.distribution.html
Bias/Variance is a Way to Understand Overfitting and Underfitting
If we denote the variable we are trying to predict as $Y$ and our covariates as $X$, we may assume that there is a relationship relating one to the other such as $Y = f(X) + \epsilon$ where the error term $\epsilon$ is normally distributed with a mean of zero like so $\epsilon \sim Ν(0,\sigma_{\epsilon})$.
We may estimate a model $\widehat{f}(X)$ of $f(X)$ using linear regressions or another modeling technique. In this case, the expected squared prediction error at a point $x$ is:
This error may then be decomposed into bias and variance components:
That third term, irreducible error, is the noise term in the true relationship that cannot fundamentally be reduced by any model. Given the true model and infinite data to calibrate it, we should be able to reduce both the bias and variance terms to 0. However, in a world with imperfect models and finite data, there is a tradeoff between minimizing the bias and minimizing the variance.
{width="6.244557086614173in"
height="4.683417541557305in"}
Bulls-eye diagram
{width="4.3861384514435695in"
height="4.399329615048119in"}
the class of models can't fit the data. Or the sample is not general enough, which lead model is skewed.
• Fix: a more expressive model class.
the class of models could fit the data but doesn't because it's hard to fit. Or the sample size is too small and not consistent.
• Fix: a less expressive model class.
{width="6.282981189851268in"
height="2.429714566929134in"}
{width="4.566929133858268in"
height="2.867671697287839in"}
http://scott.fortmann-roe.com/docs/BiasVariance.html
-
Parametric tests can perform well with skewed and non-normal distributions
-
Parametric tests can perform well when the spread of each group is different. If your groups have a different spread, the nonparametric tests might not provide valid results.
-
Statistical power: more likely to detect a significant effect when one truly exists.
-
If the mean accurately represents the center of your distribution and your sample size is large enough, consider a parametric test because they are more powerful.
No assumption that your data follow a specific distribution
-
Your area of study is better represented by the median. For example, the center of a skewed distribution, like income, can be better measured by the median. When your distribution is skewed enough, the mean is strongly affected by changes far out in the distribution's tail whereas the median continues to more closely reflect the center of the distribution.
-
You have a very small sample size, and you are not confident that you have normally distributed data
-
You have ordinal data, ranked data, or outliers that you can't remove. Be sure to check the assumptions for the nonparametric test because each one has its own data requirements.
-
If the median better represents the center of your distribution, consider the nonparametric test even when you have a large sample.
Used to decide if a sample comes from a population with a specific distribution.
Test if a sample is from a known group of samples (?)
Nonparametric statistics
{width="3.0138713910761155in"
height="2.4829647856517933in"}
https://www.cnblogs.com/arkenstone/p/5496761.html
Need to sort all samples so sensitive to outliers.
Good for small size of samples (3<=n<=50)
Need to sort all samples so sensitive to outliers.
Parametric statistics
Parametric statistics
Reading list: http://www.statsoft.com/Textbook/Distribution-Fitting
If M is a Positive-definite matrix, then after the transformation
mapping
[]{#_Convolution .anchor}
-
Contain all frequencies white light
-
Zero-mean
-
Non-autocorrelated
{width="6.3491283902012245in"
height="4.09194116360455in"}
{width="10.288357392825898in"
height="5.804855643044619in"}
https://www.youtube.com/watch?v=SIQJaqYVtuE&t=333s
$$\overline{a + bi} = a - bi \rightarrow \begin{matrix} a \
- b \ \end{matrix}$$
$$\begin{bmatrix} a & - b \ b & a \ \end{bmatrix} \times \begin{matrix} a \
- b \ \end{matrix} = \begin{matrix} a^{2} + b^{2} \ 0 \ \end{matrix}$$
http://kuangnanfang.com/zb_users/upload/2015/09/201509201442740131629554.pdf
http://www.econ.uiuc.edu/~roger/courses/574/readings/Gib.pdf
{width="5.272443132108487in"
height="3.954331802274716in"}
Another example
Similar to Longest common sequence
https://nipunbatra.github.io/blog/2014/dtw.html
https://www.cs.unm.edu/~mueen/DTW.pdf
https://www.youtube.com/watch?v=_K1OsqCicBY
It is about how to get experiment data
{width="2.129869860017498in"
height="0.5393066491688538in"}
-
Runs (N) -- Number of rows in the array, which translates into a number of test cases that will be generated.
-
Factors (K) -- Number of columns in the array, which translates into a maximum number of variables that can be handled.
-
Levels (V) -- Maximum number of values that can be taken on any single factor.
Experiment all levels of all factors, so runs are a Cartesian product
Split variables to primary and secondary. Then the "Strength" is the number of primary variables. Generate orthogonal array
https://blog.csdn.net/laomai/article/details/1929302
If 5 samples are need, evenly split space into 5 pieces, then randomly pick one point from each small area.
Explores the relationships between several independent explanatory variables and one or more response variables.
First-order model
{width="1.641794619422572in"
height="0.6267060367454068in"}
Second-order model
{width="4.3186559492563426in"
height="0.6902384076990377in"}
If there are
Least squares estimation, LSE and general linear test approach are used
to calculate
https://zh.wikipedia.org/wiki/%E5%8F%8D%E6%87%89%E6%9B%B2%E9%9D%A2%E6%B3%95
A real-valued function
https://blog.csdn.net/heyijia0327/article/details/38090229
https://mp.weixin.qq.com/s/FJAgpbBgRA2Zk3BuiEwjdw
Using KKT condition
{width="5.757667322834646in"
height="4.31405293088364in"}
{width="5.747912292213473in"
height="4.30534230096238in"}
{width="5.730742563429572in"
height="4.27999343832021in"}
{width="5.730283245844269in"
height="4.292139107611549in"}
{width="5.7376181102362205in"
height="4.285056867891513in"}
{width="5.735553368328959in"
height="4.2946839457567805in"}
{width="5.730715223097113in"
height="4.291061898512686in"}
Sum of Squares Total (SST): how far the data are from the its mean
{width="1.6028477690288714in"
height="0.43061679790026247in"}
Sum of Squares Error (SSE): how far the data are from the model's predicted values
{width="2.336828521434821in"
height="0.4919641294838145in"}
Explained sum of squares:
{width="1.646648075240595in"
height="0.4498162729658793in"}
- Root Mean Squared Error (RMSE)
https://www.analyticsvidhya.com/blog/2016/02/7-important-model-evaluation-error-metrics/
- R-square - Coefficient of determination
{width="1.3438779527559055in"
height="0.6021270778652669in"}
https://en.wikipedia.org/wiki/Coefficient_of_determination
- Adjusted R-square
R-square would increase with the increment of the counts of features,
though some of the additional features don't explain
anything
{width="2.143662510936133in"
height="0.5062521872265967in"}
where p is the total number of explanatory variables in the model (not including the constant term), and n is the sample size.
http://www.statisticshowto.com/adjusted-r2/
https://www.zhihu.com/question/34554321
https://www.cnblogs.com/pinard/p/6221564.html
http://www.cnblogs.com/pinard/p/6208966.html
{width="5.997432195975503in"
height="1.2524343832020997in"}
{width="6.413940288713911in"
height="3.2586964129483813in"}
{width="6.467171916010499in"
height="5.688716097987752in"}
Keogh, Eamonn, et al. "Finding the most unusual time series subsequence: algorithms and applications." Knowledge and Information Systems 11.1 (2007): 1-27.
https://www.zhihu.com/question/26006703/answer/536169538
http://aircraftdesign.nuaa.edu.cn/MDO/lecture/09-Surrogate%20Models.pdf
Minimize energy function
{width="3.743924978127734in"
height="0.5979877515310587in"}
Maximize joint probability distribution
{width="1.6297189413823272in"
height="0.5318744531933508in"}
- one epoch = one forward pass and one backward pass of all the training examples
- batch size = the number of training examples in one forward/backward pass. The higher the batch size, the more memory space you'll need.
- number of iterations = number of passes, each pass using [batch size] number of examples. To be clear, one pass = one forward pass + one backward pass (we do not count the forward pass and backward pass as two different passes).
https://stats.stackexchange.com/questions/153531/what-is-batch-size-in-neural-network
DLPack is the intermediate memory representation of a tensor. DLPack is an open in-memory tensor structure for sharing tensors among frameworks. The DNN frameworks (PyTorch or MXNet) can accept a pointer of a tensor from another framework and load it to its world.



















