1
1
module MultivariateStats
2
2
3
- using LinearAlgebra
4
- using SparseArrays
5
- using Statistics: middle
6
- using StatsAPI: RegressionModel
7
- using StatsBase:
8
- SimpleCovariance,
9
- CovarianceEstimator,
10
- AbstractDataTransform,
11
- ConvergenceException,
12
- pairwise,
13
- pairwise!,
14
- CoefTable
15
-
16
- import Statistics: mean, var, cov, covm, cor
17
- import Base: length, size, show
18
- import StatsAPI: fit, predict, coef, weights, dof, r2
19
- import LinearAlgebra: eigvals, eigvecs
20
-
21
- export
3
+ using DataFrames
4
+ using LinearAlgebra
5
+ using SparseArrays
6
+ using Statistics: middle
7
+ using StatsAPI: RegressionModel
8
+ using StatsBase: SimpleCovariance, CovarianceEstimator, AbstractDataTransform,
9
+ ConvergenceException, pairwise, pairwise!, CoefTable
10
+
11
+ import Statistics: mean, var, cov, covm, cor
12
+ import Base: length, size, show
13
+ import StatsAPI: fit, predict, coef, weights, dof, r2
14
+ import LinearAlgebra: eigvals, eigvecs
15
+
16
+ export
22
17
23
18
# # common
24
19
evaluate, # evaluate discriminant function values
@@ -43,23 +38,27 @@ export
43
38
44
39
# whiten
45
40
Whitening, # Type: Whitening transformation
41
+
46
42
invsqrtm, # Compute inverse of matrix square root, i.e. inv(sqrtm(A))
47
43
cov_whitening, # Compute a whitening transform based on covariance
48
44
cov_whitening!, # Compute a whitening transform based on covariance (input will be overwritten)
49
45
invsqrtm, # Compute C^{-1/2}, i.e. inv(sqrtm(C))
50
46
51
47
# # pca
52
48
PCA, # Type: Principal Component Analysis model
49
+
53
50
pcacov, # PCA based on covariance
54
51
pcasvd, # PCA based on singular value decomposition of input data
55
52
principalratio, # the ratio of variances preserved in the principal subspace
56
53
principalvar, # the variance along a specific principal direction
57
54
principalvars, # the variances along all principal directions
55
+
58
56
tprincipalvar, # total principal variance, i.e. sum(principalvars(M))
59
57
tresidualvar, # total residual variance
60
58
61
59
# # ppca
62
60
PPCA, # Type: the Probabilistic PCA model
61
+
63
62
ppcaml, # Maximum likelihood probabilistic PCA
64
63
ppcaem, # EM algorithm for probabilistic PCA
65
64
bayespca, # Bayesian PCA
@@ -79,17 +78,18 @@ export
79
78
MetricMDS,
80
79
classical_mds, # perform classical MDS over a given distance matrix
81
80
stress, # stress evaluation
82
- gram2dmat,
83
- gram2dmat!, # Gram matrix => Distance matrix
84
- dmat2gram,
85
- dmat2gram!, # Distance matrix => Gram matrix
81
+
82
+ gram2dmat, gram2dmat!, # Gram matrix => Distance matrix
83
+ dmat2gram, dmat2gram!, # Distance matrix => Gram matrix
86
84
87
85
# # lda
88
86
LinearDiscriminant, # Type: Linear Discriminant functional
89
87
MulticlassLDAStats, # Type: Statistics required for training multi-class LDA
90
88
MulticlassLDA, # Type: Multi-class LDA model
91
89
SubspaceLDA, # Type: LDA model for high-dimensional spaces
90
+
92
91
ldacov, # Linear discriminant analysis based on covariances
92
+
93
93
classweights, # class-specific weights
94
94
classmeans, # class-specific means
95
95
withclass_scatter, # with-class scatter matrix
@@ -100,58 +100,59 @@ export
100
100
101
101
# # ica
102
102
ICA, # Type: the Fast ICA model
103
+
103
104
fastica!, # core algorithm function for the Fast ICA
104
105
105
106
# # fa
106
107
FactorAnalysis, # Type: the Factor Analysis model
108
+
107
109
faem, # EM algorithm for factor analysis
108
110
facm, # CM algorithm for factor analysis
109
111
110
- # # CA, MCA
112
+ # # ca, mca
111
113
CA, # Type: correspondence analysis
114
+
112
115
MCA, # Type: multiple correspondence analysis
113
116
ca, # fit and return a correspondence analysis
114
117
mca, # fit and return a multiple correspondence analysis
115
118
objectscores, # return the object scores or coordinates from CA or MCA
116
119
variablescores, # return the variable/category scores or coordinates from CA or MCA
117
120
inertia # return the inertia (derived from eigenvalues) for CA
118
121
119
- # # source files
120
- include (" types.jl" )
121
- include (" common.jl" )
122
- include (" lreg.jl" )
123
- include (" whiten.jl" )
124
- include (" pca.jl" )
125
- include (" ppca.jl" )
126
- include (" kpca.jl" )
127
- include (" cca.jl" )
128
- include (" cmds.jl" )
129
- include (" mmds.jl" )
130
- include (" lda.jl" )
131
- include (" ica.jl" )
132
- include (" fa.jl" )
133
- include (" mca.jl" )
134
-
135
- # # deprecations
136
- @deprecate indim (f) size (f, 1 )
137
- @deprecate outdim (f) size (f, 2 )
138
- @deprecate transform (f, x) predict (f, x)
139
- @deprecate indim (f:: Whitening ) length (f:: Whitening )
140
- @deprecate outdim (f:: Whitening ) length (f:: Whitening )
141
- @deprecate tvar (f:: PCA ) var (f:: PCA )
142
- @deprecate classical_mds (D:: AbstractMatrix , p:: Int ) predict (
143
- fit (MDS, D, maxoutdim = p, distances = true ),
144
- )
145
- @deprecate transform (f:: MDS ) predict (f:: MDS )
146
- @deprecate xindim (M:: CCA ) size (M, 1 )
147
- @deprecate yindim (M:: CCA ) size (M, 2 )
148
- @deprecate outdim (M:: CCA ) size (M, 3 )
149
- @deprecate correlations (M:: CCA ) cor (M)
150
- @deprecate xmean (M:: CCA ) mean (M, :x )
151
- @deprecate ymean (M:: CCA ) mean (M, :y )
152
- @deprecate xprojection (M:: CCA ) projection (M, :x )
153
- @deprecate yprojection (M:: CCA ) projection (M, :y )
154
- @deprecate xtransform (M:: CCA , x) predict (M, x, :x )
155
- @deprecate ytransform (M:: CCA , y) predict (M, y, :y )
122
+ # # source files
123
+ include (" types.jl" )
124
+ include (" common.jl" )
125
+ include (" lreg.jl" )
126
+ include (" whiten.jl" )
127
+ include (" pca.jl" )
128
+ include (" ppca.jl" )
129
+ include (" kpca.jl" )
130
+ include (" cca.jl" )
131
+ include (" cmds.jl" )
132
+ include (" mmds.jl" )
133
+ include (" lda.jl" )
134
+ include (" ica.jl" )
135
+ include (" fa.jl" )
136
+ include (" mca.jl" )
137
+
138
+ # # deprecations
139
+ @deprecate indim (f) size (f,1 )
140
+ @deprecate outdim (f) size (f,2 )
141
+ @deprecate transform (f, x) predict (f, x)
142
+ @deprecate indim (f:: Whitening ) length (f:: Whitening )
143
+ @deprecate outdim (f:: Whitening ) length (f:: Whitening )
144
+ @deprecate tvar (f:: PCA ) var (f:: PCA )
145
+ @deprecate classical_mds (D:: AbstractMatrix , p:: Int ) predict (fit (MDS, D, maxoutdim= p, distances= true ))
146
+ @deprecate transform (f:: MDS ) predict (f:: MDS )
147
+ @deprecate xindim (M:: CCA ) size (M,1 )
148
+ @deprecate yindim (M:: CCA ) size (M,2 )
149
+ @deprecate outdim (M:: CCA ) size (M,3 )
150
+ @deprecate correlations (M:: CCA ) cor (M)
151
+ @deprecate xmean (M:: CCA ) mean (M, :x )
152
+ @deprecate ymean (M:: CCA ) mean (M, :y )
153
+ @deprecate xprojection (M:: CCA ) projection (M, :x )
154
+ @deprecate yprojection (M:: CCA ) projection (M, :y )
155
+ @deprecate xtransform (M:: CCA , x) predict (M, x, :x )
156
+ @deprecate ytransform (M:: CCA , y) predict (M, y, :y )
156
157
157
158
end # module
0 commit comments