infomax_ica.h

Go to the documentation of this file.
00001 /* MLPACK 0.2
00002  *
00003  * Copyright (c) 2008, 2009 Alexander Gray,
00004  *                          Garry Boyer,
00005  *                          Ryan Riegel,
00006  *                          Nikolaos Vasiloglou,
00007  *                          Dongryeol Lee,
00008  *                          Chip Mappus, 
00009  *                          Nishant Mehta,
00010  *                          Hua Ouyang,
00011  *                          Parikshit Ram,
00012  *                          Long Tran,
00013  *                          Wee Chin Wong
00014  *
00015  * Copyright (c) 2008, 2009 Georgia Institute of Technology
00016  *
00017  * This program is free software; you can redistribute it and/or
00018  * modify it under the terms of the GNU General Public License as
00019  * published by the Free Software Foundation; either version 2 of the
00020  * License, or (at your option) any later version.
00021  *
00022  * This program is distributed in the hope that it will be useful, but
00023  * WITHOUT ANY WARRANTY; without even the implied warranty of
00024  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00025  * General Public License for more details.
00026  *
00027  * You should have received a copy of the GNU General Public License
00028  * along with this program; if not, write to the Free Software
00029  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00030  * 02110-1301, USA.
00031  */
00047 #ifndef U_INFOMAX_ICA
00048 #define U_INFOMAX_ICA
00049 
00050 //#include <math.h>
00051 //#include <limits>
00052 //#include <values.h>
00053 #include <cmath>
00054 #include <climits>
00055 #include "fastlib/fastlib.h"
00056 
00057 class TestInfomaxICA; // forward reference
00058 
00059 const fx_entry_doc infomax_ica_entries[] = {
00060   {"lambda", FX_PARAM, FX_DOUBLE, NULL,
00061    "  Learning rate for infomax method.\n"},
00062   {"B", FX_PARAM, FX_INT, NULL,
00063    "  Infomax data window size.\n"},
00064   {"epsilon", FX_PARAM, FX_DOUBLE, NULL,
00065    "  Infomax algorithm stop threshold.\n"},
00066   FX_ENTRY_DOC_DONE
00067 };
00068 
00069 const fx_module_doc infomax_ica_doc = {
00070   infomax_ica_entries, NULL,
00071   "Performs ICA decomposition using Infomax method.\n"
00072 };
00073 
00087 class InfomaxICA {
00088 
00089   friend class TestInfomaxICA;
00090   
00091  public:
00092   InfomaxICA();
00093   InfomaxICA(double lambda, int B, double epsilon);
00094   void applyICA(const Matrix &dataset);
00095   void evaluateICA();
00096   void displayMatrix(const Matrix &m);
00097   void displayVector(const Vector &m);
00098   void getUnmixing(Matrix &w);
00099   void getSources(const Matrix &dataset, Matrix &s);
00100   void setLambda(const double lambda);
00101   void setB(const int b);
00102   void setEpsilon(const double epsilon);
00103 
00104  private:
00105   Matrix w_;
00106   Matrix data_;
00107   // learning rate 
00108   double lambda_;
00109   // block size
00110   int b_;
00111   // epsilon for convergence
00112   double epsilon_;
00113   // utility functions
00114   void expM(Matrix &m);
00115   void addOne(Matrix &m);
00116   void invertVals(Matrix &m);
00117   void vectorize(const Matrix &m, Vector &v);
00118   Matrix eye(index_t dim,double diagVal);
00119   Matrix sqrtm(const Matrix &m);
00120   void sphere(Matrix &m);
00121   Matrix subMeans(const Matrix &m);
00122   Vector rowMean(const Matrix &m);
00123   Matrix sampleCovariance(const Matrix &m);
00124   double w_delta(const Matrix &w_prev, const Matrix &w_pres);
00125 };
00126 
00127 #endif
Generated on Mon Jan 24 12:04:38 2011 for FASTlib by  doxygen 1.6.3