@@ -18,7 +18,7 @@ export LinearRegressor, RidgeRegressor, PCA, KernelPCA, ICA, PPCA, FactorAnalysi
1818 BayesianLDA, SubspaceLDA, BayesianSubspaceLDA
1919
2020# ===================================================================
21- # # Re-EXPORTS
21+ # # Re-EXPORTS
2222export SimpleCovariance, CovarianceEstimator, SqEuclidean, CosineDist
2323
2424# ===================================================================
@@ -34,84 +34,85 @@ const FactorAnalysisResultType = MS.FactorAnalysis
3434const default_kernel = (x, y) -> x' y # default kernel used in KernelPCA
3535
3636# Definitions of model descriptions for use in model doc-strings.
37- const PCA_DESCR = """ Principal component analysis. Learns a linear transformation to
38- project the data on a lower dimensional space while preserving most of the initial
37+ const PCA_DESCR = """ Principal component analysis. Learns a linear transformation to
38+ project the data on a lower dimensional space while preserving most of the initial
3939variance.
4040"""
4141const KPCA_DESCR = " Kernel principal component analysis."
4242const ICA_DESCR = " Independent component analysis."
4343const PPCA_DESCR = " Probabilistic principal component analysis"
4444const FactorAnalysis_DESCR = " Factor Analysis"
45- const LDA_DESCR = """ Multiclass linear discriminant analysis. The algorithm learns a
46- projection matrix `P` that projects a feature matrix `Xtrain` onto a lower dimensional
47- space of dimension `out_dim` such that the trace of the transformed between-class scatter
48- matrix(`Pᵀ*Sb*P`) is maximized relative to the trace of the transformed within-class
49- scatter matrix (`Pᵀ*Sw*P`).The projection matrix is scaled such that `Pᵀ*Sw*P=I` or
45+ const LDA_DESCR = """ Multiclass linear discriminant analysis. The algorithm learns a
46+ projection matrix `P` that projects a feature matrix `Xtrain` onto a lower dimensional
47+ space of dimension `out_dim` such that the trace of the transformed between-class scatter
48+ matrix(`Pᵀ*Sb*P`) is maximized relative to the trace of the transformed within-class
49+ scatter matrix (`Pᵀ*Sw*P`).The projection matrix is scaled such that `Pᵀ*Sw*P=I` or
5050`Pᵀ*Σw*P=I`(where `Σw` is the within-class covariance matrix) .
51- Predicted class posterior probability for feature matrix `Xtest` are derived by applying
52- a softmax transformationto a matrix `Pr`, such that rowᵢ of `Pr` contains computed
53- distances(based on a distance metric) in the transformed space of rowᵢ in `Xtest` to the
51+ Predicted class posterior probability for feature matrix `Xtest` are derived by applying
52+ a softmax transformationto a matrix `Pr`, such that rowᵢ of `Pr` contains computed
53+ distances(based on a distance metric) in the transformed space of rowᵢ in `Xtest` to the
5454centroid of each class.
5555"""
56- const BayesianLDA_DESCR = """ Bayesian Multiclass linear discriminant analysis. The algorithm
57- learns a projection matrix `P` that projects a feature matrix `Xtrain` onto a lower
58- dimensional space of dimension `out_dim` such that the trace of the transformed
59- between-class scatter matrix(`Pᵀ*Sb*P`) is maximized relative to the trace of the
60- transformed within-class scatter matrix (`Pᵀ*Sw*P`). The projection matrix is scaled such
61- that `Pᵀ*Sw*P = n` or `Pᵀ*Σw*P=I` (Where `n` is the number of training samples and `Σw`
56+ const BayesianLDA_DESCR = """ Bayesian Multiclass linear discriminant analysis. The algorithm
57+ learns a projection matrix `P` that projects a feature matrix `Xtrain` onto a lower
58+ dimensional space of dimension `out_dim` such that the trace of the transformed
59+ between-class scatter matrix(`Pᵀ*Sb*P`) is maximized relative to the trace of the
60+ transformed within-class scatter matrix (`Pᵀ*Sw*P`). The projection matrix is scaled such
61+ that `Pᵀ*Sw*P = n` or `Pᵀ*Σw*P=I` (Where `n` is the number of training samples and `Σw`
6262is the within-class covariance matrix).
63- Predicted class posterior probability distibution are derived by applying Bayes rule with
63+ Predicted class posterior probability distibution are derived by applying Bayes rule with
6464a multivariate Gaussian class-conditional distribution.
6565"""
66- const SubspaceLDA_DESCR = """ Multiclass linear discriminant analysis. Suitable for high
67- dimensional data (Avoids computing scatter matrices `Sw` ,`Sb`). The algorithm learns a
68- projection matrix `P = W*L` that projects a feature matrix `Xtrain` onto a lower
69- dimensional space of dimension `nc - 1` such that the trace of the transformed
70- between-class scatter matrix(`Pᵀ*Sb*P`) is maximized relative to the trace of the
71- transformed within-class scatter matrix (`Pᵀ*Sw*P`). The projection matrix is scaled such
72- that `Pᵀ*Sw*P = mult*I` or `Pᵀ*Σw*P=mult/(n-nc)*I` (where `n` is the number of training
73- samples, mult` is one of `n` or `1` depending on whether `Sb` is normalized, `Σw` is the
74- within-class covariance matrix, and `nc` is the number of unique classes in `y`) and also
66+ const SubspaceLDA_DESCR = """ Multiclass linear discriminant analysis. Suitable for high
67+ dimensional data (Avoids computing scatter matrices `Sw` ,`Sb`). The algorithm learns a
68+ projection matrix `P = W*L` that projects a feature matrix `Xtrain` onto a lower
69+ dimensional space of dimension `nc - 1` such that the trace of the transformed
70+ between-class scatter matrix(`Pᵀ*Sb*P`) is maximized relative to the trace of the
71+ transformed within-class scatter matrix (`Pᵀ*Sw*P`). The projection matrix is scaled such
72+ that `Pᵀ*Sw*P = mult*I` or `Pᵀ*Σw*P=mult/(n-nc)*I` (where `n` is the number of training
73+ samples, mult` is one of `n` or `1` depending on whether `Sb` is normalized, `Σw` is the
74+ within-class covariance matrix, and `nc` is the number of unique classes in `y`) and also
7575obeys `Wᵀ*Sb*p = λ*Wᵀ*Sw*p`, for every column `p` in `P`.
76- Predicted class posterior probability for feature matrix `Xtest` are derived by applying a
77- softmax transformation to a matrix `Pr`, such that rowᵢ of `Pr` contains computed
78- distances(based on a distance metric) in the transformed space of rowᵢ in `Xtest` to the
76+ Predicted class posterior probability for feature matrix `Xtest` are derived by applying a
77+ softmax transformation to a matrix `Pr`, such that rowᵢ of `Pr` contains computed
78+ distances(based on a distance metric) in the transformed space of rowᵢ in `Xtest` to the
7979centroid of each class.
8080"""
81- const BayesianSubspaceLDA_DESCR = """ Bayesian Multiclass linear discriminant analysis.
82- Suitable for high dimensional data (Avoids computing scatter matrices `Sw` ,`Sb`). The
83- algorithm learns a projection matrix `P = W*L` (`Sw`), that projects a feature matrix
84- `Xtrain` onto a lower dimensional space of dimension `nc-1` such that the trace of the
85- transformed between-class scatter matrix(`Pᵀ*Sb*P`) is maximized relative to the trace
86- of the transformed within-class scatter matrix (`Pᵀ*Sw*P`). The projection matrix is
87- scaled such that `Pᵀ*Sw*P = mult*I` or `Pᵀ*Σw*P=mult/(n-nc)*I` (where `n` is the number of
88- training samples, `mult` is one of `n` or `1` depending on whether `Sb` is normalized,
89- `Σw` is the within-class covariance matrix, and `nc` is the number of unique classes in
81+ const BayesianSubspaceLDA_DESCR = """ Bayesian Multiclass linear discriminant analysis.
82+ Suitable for high dimensional data (Avoids computing scatter matrices `Sw` ,`Sb`). The
83+ algorithm learns a projection matrix `P = W*L` (`Sw`), that projects a feature matrix
84+ `Xtrain` onto a lower dimensional space of dimension `nc-1` such that the trace of the
85+ transformed between-class scatter matrix(`Pᵀ*Sb*P`) is maximized relative to the trace
86+ of the transformed within-class scatter matrix (`Pᵀ*Sw*P`). The projection matrix is
87+ scaled such that `Pᵀ*Sw*P = mult*I` or `Pᵀ*Σw*P=mult/(n-nc)*I` (where `n` is the number of
88+ training samples, `mult` is one of `n` or `1` depending on whether `Sb` is normalized,
89+ `Σw` is the within-class covariance matrix, and `nc` is the number of unique classes in
9090`y`) and also obeys `Wᵀ*Sb*p = λ*Wᵀ*Sw*p`, for every column `p` in `P`.
91- Posterior class probability distibution are derived by applying Bayes rule with a
91+ Posterior class probability distibution are derived by applying Bayes rule with a
9292multivariate Gaussian class-conditional distribution
9393"""
94- const LINEAR_DESCR = """ Linear regression. Learns a linear combination(s) of given
94+ const LINEAR_DESCR = """ Linear regression. Learns a linear combination(s) of given
9595variables to fit the responses by minimizing the squared error between.
9696"""
97- const RIDGE_DESCR = """ Ridge regressor with regularization parameter lambda. Learns a
97+ const RIDGE_DESCR = """ Ridge regressor with regularization parameter lambda. Learns a
9898linear regression with a penalty on the l2 norm of the coefficients.
9999"""
100100
101101const PKG = " MLJMultivariateStatsInterface"
102102
103103# ===================================================================
104104# Includes
105- include (" models/decompostion_models .jl" )
105+ include (" models/decomposition_models .jl" )
106106include (" models/discriminant_analysis.jl" )
107107include (" models/linear_models.jl" )
108108include (" utils.jl" )
109109
110110# ===================================================================
111111# List of all models interfaced
112112const MODELS = (
113- RidgeRegressor, PCA, KernelPCA, ICA, LDA, BayesianLDA, SubspaceLDA,
114- BayesianSubspaceLDA
113+ LinearRegressor, RidgeRegressor, PCA, KernelPCA, ICA, LDA,
114+ BayesianLDA, SubspaceLDA,
115+ BayesianSubspaceLDA, FactorAnalysis, PPCA
115116)
116117
117118# ====================================================================
0 commit comments