Changeset 279
- Timestamp:
- 03/03/11 18:37:29 (1 year ago)
- Files:
-
- trunk/regress.d (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/regress.d
r273 r279 2024 2024 // Puts x in xCenterScale, with weighted mean subtracted and weighted 2025 2025 // 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() { 2027 2030 immutable weightSum = sum(weights); 2031 if(weightSum < eps) return false; 2032 2028 2033 xMeans[] = 0; 2029 2034 zMean = 0; … … 2057 2062 2058 2063 foreach(i, col; xCenterScale) col[] /= xSds[i]; 2064 return true; 2059 2065 } 2060 2066 … … 2107 2113 } 2108 2114 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; 2110 2121 2111 2122 if(lasso > 0) {
