diff --git a/fastlib/trunk/mlpack/fastica/fastica.h b/fastlib/trunk/mlpack/fastica/fastica.h index bf4a77c1ef..83069e8a54 100644 --- a/fastlib/trunk/mlpack/fastica/fastica.h +++ b/fastlib/trunk/mlpack/fastica/fastica.h @@ -33,6 +33,8 @@ const fx_entry_doc fastica_entries[] = { "Independent component recovery approach: 'deflation' or 'symmetric'.\n"}, {"nonlinearity", FX_PARAM, FX_STR, NULL, "Nonlinear function to use: 'logcosh', 'gauss', 'kurtosis', or 'skew'.\n"}, + {"num_of_IC", FX_PARAM, FX_INT, NULL, + " Number of independent components to find: integer between 1 and dimensionality of data.\n"}, {"fine_tune", FX_PARAM, FX_BOOL, NULL, "Enable fine tuning.\n"}, {"a1", FX_PARAM, FX_DOUBLE, NULL, @@ -643,7 +645,13 @@ class FastICA { //const index_t first_eig_ = fx_param_int(module_, "first_eig", 1); // for now, the last eig must be d, and num_of IC must be d, until I have time to incorporate PCA into this code //const index_t last_eig_ = fx_param_int(module_, "last_eig", d); - num_of_IC_ = d; //fx_param_int(module_, "num_of_IC", d); + num_of_IC_ = fx_param_int(module_, "num_of_IC", d); + if(num_of_IC_ < 1 || num_of_IC_ > d) { + printf("ERROR: num_of_IC = %d must be >= 1 and <= dimensionality of data", + num_of_IC_); + return SUCCESS_FAIL; + } + fine_tune_ = fx_param_bool(module_, "fine_tune", false); a1_ = fx_param_double(module_, "a1", 1); a2_ = fx_param_double(module_, "a2", 1); @@ -1366,7 +1374,7 @@ class FastICA { FixedPointICA(X_whitened, whitening_matrix, W); if(ret_val == SUCCESS_PASS) { - la::MulInit(*W, X(), Y); + la::MulTransAInit(*W, X(), Y); } else { Y -> Init(0,0); diff --git a/fastlib/trunk/mlpack/fastica/fastica_main.cc b/fastlib/trunk/mlpack/fastica/fastica_main.cc index fa6b559a89..e9a838c2a3 100644 --- a/fastlib/trunk/mlpack/fastica/fastica_main.cc +++ b/fastlib/trunk/mlpack/fastica/fastica_main.cc @@ -24,6 +24,7 @@ * @param seed = (long) seed to the random number generator (clock() + time(0)) * @param approach = {deflation, symmetric} (deflation) * @param nonlinearity = {logcosh, gauss, kurtosis, skew} (logcosh) + * @param num_of_IC = integer constant for number of independent components to find (dimensionality of data) * @param fine_tune = {true, false} (false) * @param a1 = numeric constant for logcosh nonlinearity (1) * @param a2 = numeric constant for gauss nonlinearity (1)