GithubHelp home page GithubHelp logo

deal with nans about hypertools HOT 5 CLOSED

contextlab avatar contextlab commented on May 24, 2024
deal with nans

from hypertools.

Comments (5)

jeremymanning avatar jeremymanning commented on May 24, 2024

is this still an issue? in the MATLAB version i dealt with nans as follows:

1.) remove all nans
2.) compute PCA transforms
3.) apply PCA transforms to the original (nan-included) data
4.) now the transformed data has nans in the same observations as the original data, and is the same size as the original data

another (fancier! better!) option is to use ppca (probabilistic pca): https://github.com/allentran/pca-magic

ppca is robust to nans and can even fill in missing data.

from hypertools.

andrewheusser avatar andrewheusser commented on May 24, 2024

not resolved yet! happy to implement either one/both. PPCA sounds neat but not confident I understand how it works entirely..

how about any([type(i,np.nan) for i in data]) use PPCA, else use PCA?

from hypertools.

andrewheusser avatar andrewheusser commented on May 24, 2024

with a warning message

from hypertools.

jeremymanning avatar jeremymanning commented on May 24, 2024

sure...that'll be faster than always using ppca. (are you thinking the warning will go with ppca-- i.e. something like "missing data: inexact solution"?)

the ppca paper is here: https://www.microsoft.com/en-us/research/publication/probabilistic-principal-component-analysis/

we can also talk about it with a whiteboard sometime and/or go through the paper together. the basic idea is:

1.) principle components (the "feature space") come from a unit Gaussian: p(z) = N(z | 0, I)
2.) the data come from weighted combinations of features, plus some noise: p(x | z) = N(x | Wz + mu, S), where S is a diagonal covariance matrix-- some constant, sigma^2 times the identify matrix

Then, given x (the data), we have to estimate z (the components) and W (the weights) using Bayes' rule. (For details, see above paper.)

from hypertools.

andrewheusser avatar andrewheusser commented on May 24, 2024

OK cool, thanks for the explanation. and yes, something like that for a warning

from hypertools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.