diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43c4796..9b84ebe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,10 @@ 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 @@ -25,11 +25,6 @@ jobs: 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 diff --git a/Project.toml b/Project.toml index a1bd61f..238dbaf 100644 --- a/Project.toml +++ b/Project.toml @@ -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" @@ -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" diff --git a/src/pca.jl b/src/pca.jl index a1f8495..71317d7 100644 --- a/src/pca.jl +++ b/src/pca.jl @@ -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) @@ -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 diff --git a/test/pca.jl b/test/pca.jl index 865b965..d29fe1b 100644 --- a/test/pca.jl +++ b/test/pca.jl @@ -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