test_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  */
00039 #include "infomax_ica.h"
00040 #include "fastlib/base/test.h"
00041 
00042 class TestInfomaxICA {
00043 
00044  public:
00045   void Init(){
00046     // load some test data that has been verified using the matlab
00047     // implementation of infomax
00048     data::Load("../../fastlib/fake.arff",&testdata_);
00049     lambda_=0.001;
00050     b_=5;
00051     epsilon_=0.001;
00052     ica_ = new InfomaxICA(lambda_,b_,epsilon_);
00053   }
00054 
00055   void Destruct(){
00056     delete ica_;
00057   }    
00058 
00059   void TestCov(){
00060     ica_->sampleCovariance(testdata_);
00061   }
00062   
00063   void TestSqrtm(){
00064     Matrix intermediate = ica_->sampleCovariance(testdata_);
00065     ica_->sqrtm(intermediate);
00066   }
00067 
00068   void TestICA(){
00069     Matrix unmixing;
00070     ica_->applyICA(testdata_);
00071     ica_->getUnmixing(unmixing);
00072     ica_->displayMatrix(unmixing);
00073   }
00074 
00075   void TestAll() {
00076     TestSqrtm();
00077     TestCov();
00078     TestICA();
00079   }
00080 
00081  private:
00082   InfomaxICA *ica_;
00083   Matrix testdata_;
00084   double lambda_;
00085   int b_;
00086   double epsilon_;
00087 };
Generated on Mon Jan 24 12:04:38 2011 for FASTlib by  doxygen 1.6.3