Giter Club home page Giter Club logo

online_psp_matlab's Introduction

Online-PSP

Efficient MATLAB implementation of online Principal Subspace Projection algorithms (Fast Similarity Matching[1], Incremental PCA[2,3], and Candid Covariance Incremental PCA[2,4])

For the more complete Python version please go to the link online-psp

Installation

Clone the repository or unzip the source and add recursively folders from the src folder to the MATLAB path

EXAMPLES

Basic Example

k -> subspace dimension
d -> number of features
% we suggest to standardize data using the standardize_data function
[X,~,~] = standardize_data(X,0,0);

fsm = FSM(k, d, [], [], [], []);
for i = 1:n    
    fsm.fit_next(x(:,i)');
end

components = fsm.get_components([]);

Detailed Example

For more detailed examples explore the demo_XXX.m files

References

[1] Pehlevan, Cengiz, Anirvan M. Sengupta, and Dmitri B. Chklovskii. "Why do similarity matching objectives lead to Hebbian/anti-Hebbian networks?." Neural computation 30, no. 1 (2018): 84-124.

[2] Cardot, Hervé, and David Degras. "Online Principal Component Analysis in High Dimension: Which Algorithm to Choose?." arXiv preprint arXiv:1511.03688 (2015).

[3] Arora, R., Cotter, A., Livescu, K. and Srebro, N., 2012, October. Stochastic optimization for PCA and PLS. In Communication, Control, and Computing (Allerton), 2012 50th Annual Allerton Conference on (pp. 861-868). IEEE.

[4] Weng, J., Zhang, Y. and Hwang, W.S., 2003. Candid covariance-free incremental principal component analysis. IEEE Transactions on Pattern Analysis and Machine Intelligence, 25(8), pp.1034-1040.

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

online_psp_matlab's People

Contributors

agiovann avatar cpehlevan avatar victorminden avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

online_psp_matlab's Issues

Bugs report: IPCA.m

Thanks for sharing the code of online PCA. The implementation is very elegant!
I write to report two bugs in the implementation of IPCA.m. It would be great if you can verify them.

  1. Line 61: x = sqrt(obj.f) * x;
    I think the implementation is missing a factor of sqrt(1-obj.f)
    New Line 61: x = sqrt( obj.f * (1-obj.f) ) * x;

  2. Line 76: obj.lambda_ = s(end:-1:2);
    Line 77: V = V(:, end:-1:2);

When Line 68 ( normx >= obj.tol ) condition is not satisfied (e.g. at least for the first sample), matrix M would have dimention k by k instead of k+1 by k+1. Hence when normx < obj.tol, Line 76 and 77 should keep all of the dimension.

Example fix: (replacing Line 75 - 77)

          obj.lambda_ = diag(s);
          if (normx >= obj.tol)
              obj.lambda_ = obj.lambda_(end:-1:2);
              V = V(:, end:-1:2);
          end

I have done simple testing using your demo_IPCA.m script, and in this way the errors decreased faster (although the final error was about the same).

The IPCA algorithm I referenced is from section 4 "Reduced Rank Incremental Principal Component Analysis" from Cardot, H., & Degras, D. (2018). Online Principal Component Analysis in High Dimension: Which Algorithm to Choose?. International Statistical Review, 86(1), 29-50.

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.