forked from JuliaStats/MultivariateStats.jl
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor whitening for closer integration with StatsBase types (part of
- Loading branch information
Showing
9 changed files
with
183 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[deps] | ||
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
MultivariateStats = "6f286f6a-111f-5878-ab1e-185364afe411" | ||
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" | ||
|
||
[compat] | ||
Documenter = "0.26" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Documenter, MultivariateStats, StatsBase, Statistics, Random, LinearAlgebra | ||
|
||
if Base.HOME_PROJECT[] !== nothing | ||
Base.HOME_PROJECT[] = abspath(Base.HOME_PROJECT[]) | ||
end | ||
|
||
makedocs( | ||
sitename = "MultivariateStats.jl", | ||
modules = [MultivariateStats], | ||
pages = ["index.md", | ||
"whiten.md"] | ||
) | ||
|
||
deploydocs( | ||
repo = "github.com/JuliaStats/MultivariateStats.jl.git" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# MultivariateStats.jl Documentation | ||
|
||
```@meta | ||
CurrentModule = MultivariateStats | ||
DocTestSetup = quote | ||
using Statistics | ||
using Random | ||
end | ||
``` | ||
|
||
*MultivariateStats.jl* is a Julia package for multivariate statistical analysis. It provides a rich set of useful analysis techniques, such as PCA, CCA, LDA, ICA, etc. | ||
|
||
|
||
```@contents | ||
Pages = ["whiten.md"] | ||
Depth = 2 | ||
``` | ||
|
||
**Notes:** All methods implemented in this package adopt the column-major convention of JuliaStats: in a data matrix, each column corresponds to a sample/observation, while each row corresponds to a feature (variable or attribute). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Data Whitening | ||
|
||
A [whitening transformation](http://en.wikipedia.org/wiki/Whitening_transformation>) is a decorrelation transformation that transforms a set of random variables into a set of new random variables with identity covariance (uncorrelated with unit variances). | ||
|
||
In particular, suppose a random vector has covariance ``\mathbf{C}``, then a whitening transform ``\mathbf{W}`` is one that satisfy: | ||
|
||
```math | ||
\mathbf{W}^T \mathbf{C} \mathbf{W} = \mathbf{I} | ||
``` | ||
|
||
Note that ``\mathbf{W}`` is generally not unique. In particular, if ``\mathbf{W}`` is a whitening transform, so is any of its rotation ``\mathbf{W} \mathbf{R}`` with ``\mathbf{R}^T \mathbf{R} = \mathbf{I}``. | ||
|
||
## Whitening | ||
|
||
The package uses [`Whitening`](@ref) to represent a whitening transform. | ||
|
||
```@docs | ||
Whitening | ||
``` | ||
|
||
Whitening transformation can be fitted to data using the `fit` method. | ||
|
||
```@docs | ||
fit(::Type{Whitening}, X::AbstractMatrix{T}; kwargs...) where {T<:Real} | ||
transform(::Whitening, ::AbstractVecOrMat) | ||
indim | ||
outdim | ||
mean(::Whitening) | ||
``` | ||
|
||
Additional methods | ||
```@docs | ||
cov_whitening | ||
cov_whitening! | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
|
||
""" | ||
indim(m) | ||
Get the out dimension of the model `m`. | ||
""" | ||
function indim(m::RegressionModel) end | ||
|
||
""" | ||
outdim(m) | ||
Get the out dimension of the model `m`. | ||
""" | ||
function outdim(m::RegressionModel) end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters