kwstat / nipals Goto Github PK
View Code? Open in Web Editor NEWPrincipal Component Analysis with missing data using NIPALS with Gram-Schmidt orthogonalization
Home Page: https://kwstat.github.io/nipals/
License: Other
Principal Component Analysis with missing data using NIPALS with Gram-Schmidt orthogonalization
Home Page: https://kwstat.github.io/nipals/
License: Other
Thank you very much for the package - it does exactly what is on the tin!
Would it be possible or would you consider implementing a predict.nipals
function along the lines of stats:::predict.prcomp
function?
Reported by CRAN: when checked with noLD (i.e. without support for long doubles):
* checking tests ...
Running ‘testthat.R’
ERROR
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
> library(testthat)
> library(nipals)
>
> test_check("nipals")
PC 1 starting column: 4...
PC 2 starting column: 1..
PC 3 starting column: 3.
PC 4 starting column: 5.
PC 5 starting column: 2.
PC 1 starting column: 4...........
PC 2 starting column: 1..........
PC 3 starting column: 3....
PC 4 starting column: 5.........
PC 5 starting column: 2..
PC 1 starting column: 4.....
PC 2 starting column: 1.......
PC 3 starting column: 3...
PC 4 starting column: 5...
PC 5 starting column: 2..
PC 1 starting column: 5.....
PC 2 starting column: 5.........
PC 3 starting column: 5...
PC 4 starting column: 5...
PC 5 starting column: 5..
PC 1 starting column: 4.....
PC 2 starting column: 1.......
PC 3 starting column: 3...
PC 4 starting column: 5...
PC 5 starting column: 2..
── 1. Failure: Start column function (@test-empca.R#136)
──────────────────────
`nipals(corn, startcol = function(x) var(x, na.rm = TRUE))` did not
produce any warnings.
PC 1 starting column: 4...
PC 2 starting column: 1..
PC 3 starting column: 3.
PC 4 starting column: 5.
PC 5 starting column: 2.
PC 1 starting column: 4...........
PC 2 starting column: 1..........
PC 3 starting column: 3....
PC 4 starting column: 5.........
PC 5 starting column: 2..
PC 1 starting column: 4.....
PC 2 starting column: 1.......
PC 3 starting column: 3...
PC 4 starting column: 5...
PC 5 starting column: 2..
PC 1 starting column: 5.....
PC 2 starting column: 5.........
PC 3 starting column: 5...
PC 4 starting column: 5...
PC 5 starting column: 5..
PC 1 starting column: 4.....
PC 2 starting column: 1.......
PC 3 starting column: 3...
PC 4 starting column: 5...
PC 5 starting column: 2..
── 2. Failure: Start column function (@test-nipals.R#111)
─────────────────────
`nipals(corn, startcol = function(x) var(x, na.rm = TRUE))` did not
produce any warnings.
══ testthat results
═══════════════════════════════════════════════════════════
[ OK: 28 | SKIPPED: 2 | WARNINGS: 0 | FAILED: 2 ]
1. Failure: Start column function (@test-empca.R#136)
2. Failure: Start column function (@test-nipals.R#111)
From CRAN:
Check: tests
Result: ERROR
Running ‘testthat.R’ [1s/1s]
Running the tests in ‘tests/testthat.R’ failed.
Last 13 lines of output:
PC 5 starting column: 2..
══ Skipped tests ═══════════════════════════════════════════════════════════════
• empty test (2)
══ Failed tests ════════════════════════════════════════════════════════════════
── Failure (test-uscrime.R:68:3): SVD, NIPALS and EMPCA results match for complete uscrime data ──
`avg_angle` is not strictly less than `tol`. Difference: NaN
Backtrace:
█
1. └─nipals:::expect_aligned(m1s$u, m1e$scores) test-uscrime.R:68:2
2. └─testthat::expect_lt(avg_angle, tol) setup-expectations.R:22:2
[ FAIL 1 | WARN 1 | SKIP 2 | PASS 27 ]
Error: Test failures
Execution halted
Flavor: r-release-macos-arm64
Note: arm64 (aka 'Apple Silicon' aka 'M1') Mac.
Thank you very much for the package!
I ran into a little error when calculating the fitted x while setting ncomp = 1
.
I think the problem is, if there is only a single eigenvalue, diag(eig)
leads to an eig×eig identity matrix.
xhat <- tcrossprod(tcrossprod(scores, diag(eig)), loadings)
I encountered this issue trying to implement Wold's cross-validation for PCA, where components get added one after the other, with some steps between each. Easily fixed for my purposes, but thought you might like to know.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.