Skip to content

Commit

Permalink
LARS bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mazumdarparijat committed Feb 26, 2014
1 parent 67db617 commit 0252eee
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/shogun/regression/LeastAngleRegression.cpp
Expand Up @@ -67,6 +67,7 @@ static void find_max_abs(const vector<float64_t> &vec, const vector<bool> &ignor
{
if (ignore[i])
continue;

if (CMath::abs(vec[i]) > vmax)
{
vmax = CMath::abs(vec[i]);
Expand Down Expand Up @@ -163,12 +164,15 @@ bool CLeastAngleRegression::train_machine(CFeatures* data)
// first entry: all coefficients are zero
m_beta_path.push_back(beta);
m_beta_idx.push_back(0);


//maximum allowed active variables at a time
int32_t max_active_allowed = CMath::min(n_vec-1, n_fea);

//========================================
// main loop
//========================================
int32_t nloop=0;
while (m_num_active < n_fea && max_corr > CMath::MACHINE_EPSILON && !stop_cond)
while (m_num_active < max_active_allowed && max_corr > CMath::MACHINE_EPSILON && !stop_cond)
{
// corr = X' * (y-mu) = - X'*mu + Xy
copy(Xy.begin(), Xy.end(), corr.begin());
Expand Down

0 comments on commit 0252eee

Please sign in to comment.