https://github.com/gnlow/ml-pca-perf
Benchmark test for method options of ml-pca package
https://github.com/gnlow/ml-pca-perf
ml-pca pca
Last synced: 11 months ago
JSON representation
Benchmark test for method options of ml-pca package
- Host: GitHub
- URL: https://github.com/gnlow/ml-pca-perf
- Owner: gnlow
- Created: 2020-07-24T00:59:40.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-07-24T02:04:09.000Z (about 6 years ago)
- Last Synced: 2025-05-30T01:51:22.465Z (about 1 year ago)
- Topics: ml-pca, pca
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ml-pca-perf
Benchmark test for method options of [ml-pca package](https://github.com/mljs/pca)
## Method Benchmark test
`covarianceMatrix` is the fastest.
Tested in RunKit + npm
| method | hz |
|----------------------------|-----:|
| `SVD` | 3099 |
| `covarianceMatrix` | 6405 |
| `NIPALS` | 220 |
| `NIPALS, {nCompNIPALS: 4}` | 129 |
## Result (`pca.getExplainedVariance()`)
### `SVD`
```json
[0.9246187232017269, 0.05306648311706793, 0.01710260980792975, 0.005212183873275375]
```
### `covarianceMatrix`
```json
[0.9246187232017269, 0.05306648311706785, 0.017102609807929704, 0.005212183873275558]
```
### `NIPALS`
```json
[0.9457223216899879, 0.05427767831001216]
```
### `NIPALS, {nCompNIPALS: 4}`
```json
[0.9246187232017233, 0.053066483117027, 0.017102609807958833, 0.005212183873290879]
```
## Reference
- [The NIPALS Algorithm](http://www.statistics4u.com/fundstat_eng/dd_nipals_algo.html)
> The NIPALS Algorithm gives more numerically accurate results when compared with the SVD of the covariance matrix, but is slower to calculate.