Changeset 279

Show
Ignore:
Timestamp:
03/03/11 18:37:29 (1 year ago)
Author:
dsimcha
Message:

Fix convergence issues.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/regress.d

    r273 r279  
    20242024    // Puts x in xCenterScale, with weighted mean subtracted and weighted 
    20252025    // biased stdev divided.  Also standardizes z similarly. 
    2026     void doCenterScale() { 
     2026    // 
     2027    // Returns:  true if successful, false if weightSum is so small that the 
     2028    //           algorithm has converged for all practical purposes. 
     2029    bool doCenterScale() { 
    20272030        immutable weightSum = sum(weights); 
     2031        if(weightSum < eps) return false; 
     2032 
    20282033        xMeans[] = 0; 
    20292034        zMean = 0; 
     
    20572062 
    20582063        foreach(i, col; xCenterScale) col[] /= xSds[i]; 
     2064        return true; 
    20592065    } 
    20602066 
     
    21072113        } 
    21082114 
    2109         doCenterScale(); 
     2115        immutable centerScaleRes = doCenterScale(); 
     2116 
     2117        // If this is false then weightSum is so small that all probabilities 
     2118        // are for all practical purposes either 0 or 1.  We can declare 
     2119        // convergence and go home. 
     2120        if(!centerScaleRes) return; 
    21102121 
    21112122        if(lasso > 0) {