main.cc

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 "test_infomax_ica.h"
00041 #include "fastlib/fastlib.h"
00042 #include "fastlib/data/dataset.h"
00043 
00044 const fx_entry_doc infomax_ica_main_entries[] = {
00045   {"data", FX_REQUIRED, FX_STR, NULL,
00046    "  The name of the file containing mixture data.\n"},
00047   {"lambda", FX_PARAM, FX_DOUBLE, NULL,
00048    "  The learning rate.\n"},
00049   {"B", FX_PARAM, FX_INT, NULL,
00050    "  Infomax data window size.\n"},
00051   {"epsilon", FX_PARAM, FX_DOUBLE, NULL,
00052    "  Infomax algorithm stop threshold.\n"},
00053   FX_ENTRY_DOC_DONE
00054 };
00055 
00056 const fx_submodule_doc infomax_ica_main_submodules[] = {
00057   FX_SUBMODULE_DOC_DONE
00058 };
00059 
00060 const fx_module_doc infomax_ica_main_doc = {
00061   infomax_ica_main_entries, infomax_ica_main_submodules,
00062   "This performs ICA decomposition on a given dataset using the Infomax method.\n"
00063 };
00064 
00065 int main(int argc, char *argv[]) {
00066   fx_module *root = fx_init(argc, argv, &infomax_ica_main_doc);
00067 
00068   const char *data_file_name = fx_param_str_req(root, "data");
00069   double lambda = fx_param_double(root,"lambda",0.001);
00070   int B = fx_param_int(root,"B",5);
00071   double epsilon = fx_param_double(root,"epsilon",0.001);
00072   Matrix dataset;
00073   data::Load(data_file_name,&dataset);
00074   InfomaxICA *ica = new InfomaxICA(lambda, B, epsilon);
00075 
00076   ica->applyICA(dataset);  
00077   Matrix west;
00078   ica->getUnmixing(west);
00079   //ica->displayMatrix(west);
00080 
00081   fx_done(NULL);
00082 }
Generated on Mon Jan 24 12:04:37 2011 for FASTlib by  doxygen 1.6.3