Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,17 @@ jobs:
fail-fast: false
matrix:
version:
- '1.1'
- '1.6' # current LTS release
- '1' # automatically expands to the latest stable 1.x release of Julia
# - 'nightly'
- 'min'
- 'lts'
- '1'
- 'pre'
os:
- ubuntu-latest
# - macOS-latest
# - windows-latest
arch:
- x64
allow-to-fail: [false]
include:
- version: 'nightly'
os: ubuntu-latest
arch: x64
allow-to-fail: true
steps:
- uses: actions/checkout@v6
- uses: julia-actions/setup-julia@v2
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ keywords = ["multivariate statistics", "dimensionality reduction"]
license = "MIT"
desc = "A Julia package for multivariate statistics and data analysis"
repository = "https://github.com/JuliaStats/MultivariateStats.jl.git"
version = "0.10.3"
version = "0.11.0"

[deps]
Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97"
Expand All @@ -22,7 +22,7 @@ StableRNGs = "1"
Statistics = "1"
StatsAPI = "^1.3"
StatsBase = "^0.33, 0.34"
julia = "1.1"
julia = "1.6"

[extras]
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Expand Down
4 changes: 2 additions & 2 deletions src/pca.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function show(io::IO, ::MIME"text/plain", M::PCA)
ldgs = ldgs * diagm(0 => ldgs_signs[:])
print(io, "\n\nPattern matrix (unstandardized loadings):\n")
cft = CoefTable(ldgs, string.("PC", 1:odim), string.("", 1:idim))
print(io, cft)
show(io, MIME"text/plain"(), cft)
print(io, "\n\n")
print(io, "Importance of components:\n")
λ = eigvals(M)
Expand All @@ -164,7 +164,7 @@ function show(io::IO, ::MIME"text/plain", M::PCA)
"Proportion explained", "Cumulative proportion"]
cft = CoefTable(vcat(λ', prp', cumsum(prp)', prpv', cumsum(prpv)'),
string.("PC", 1:odim), names)
print(io, cft)
show(io, MIME"text/plain"(), cft)
end

#### PCA Training
Expand Down
24 changes: 24 additions & 0 deletions test/pca.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,30 @@ import SparseArrays
@test reconstruct(M, Y[:,1]) ≈ P * Y[:,1]
@test reconstruct(M, Y) ≈ P * Y

@test repr("text/plain", M) == """
PCA(indim = 5, outdim = 3, principalratio = 0.8)

Pattern matrix (unstandardized loadings):
─────────────────────────────────
PC1 PC2 PC3
─────────────────────────────────
1 -0.236399 0.706558 1.21106
2 1.27426 0.047799 0.212282
3 0.990598 -1.22718 0.882179
4 -1.51861 -0.725771 0.631665
5 0.181386 1.21069 0.557706
─────────────────────────────────

Importance of components:
───────────────────────────────────────────────────
PC1 PC2 PC3
───────────────────────────────────────────────────
SS Loadings (Eigenvalues) 5.0 4.0 3.0
Variance explained 0.333333 0.266667 0.2
Cumulative variance 0.333333 0.6 0.8
Proportion explained 0.416667 0.333333 0.25
Cumulative proportion 0.416667 0.75 1.0
───────────────────────────────────────────────────"""

## PCA with non-zero mean

Expand Down
Loading