Navigation Menu

Skip to content


Repository files navigation

Uncertainty-aware principal component analysis

Build Status npm GitHub

This is an implementation of uncertainty-aware principal component analysis, which generalizes PCA to work on probability distributions. You can find a live Observable notebook demonstrating our method here.


You can find a preprint of our paper at arXiv:1905.01127 or on my personal website. We also extracted means and covariances from the student grades dataset.


// Loading the library
import * as uapca from 'uapca';

// Loading and converting the dataset
const student_grades = (await fetch('')).json();
const distributions = => new uapca.MultivariateNormal(d.mean, d.cov));

// Perform uncertainty-aware PCA with scaling factor k = 0.5
const pca =, 0.5).aligned();

// Project the data onto 2D
const projected_distributions = pca.transform(distributions, 2);


The dependencies can be install using yarn:

yarn install

Builds can be prepared using:

yarn run build
yarn run dev # watches for changes

Run tests:

yarn run test

To perform linter checks you there is:

yarn run lint
yarn run lint-fix # tries to fix some of the warnings


To cite this work, you can use the BibTex entry in CITATION.cff.