Changeset 15459 for branches/MathNetNumerics-Exploration-2789/HeuristicLab.Algorithms.DataAnalysis.Experimental/SBART.cs
- Timestamp:
- 11/07/17 19:49:23 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/MathNetNumerics-Exploration-2789/HeuristicLab.Algorithms.DataAnalysis.Experimental/SBART.cs
r15458 r15459 125 125 126 126 int n = x.Length; 127 float[] leverage = new float[n];128 float[] y_smoothed = new float[n];129 127 int ic = n - 1; 130 128 int ier = -99; … … 133 131 134 132 float crit = -99.0f; 135 int icrit = 0; // 0..don't calc CV, 1 .. GCV, 2 CV133 int icrit = 1; // 0..don't calc CV, 1 .. GCV, 2 CV 136 134 137 135 // float smoothingParameter = -99.0f; 138 int smoothingParameterIndicator = 1;136 int smoothingParameterIndicator = 0; 139 137 float lowerSmoothingParameter = 0f; 140 138 float upperSmoothingParameter = 1.0f; … … 153 151 SBART.setreg_x64(xs, ys, ws, 154 152 ref n, xw, ref nx, ref min, ref range, knots, ref nk); 155 if(nx < 4) { 153 154 /* use all points as knot points 155 nk = nx + 2; 156 knots[0] = xs[0]; 157 knots[1] = xs[0]; 158 knots[2] = xs[0]; 159 Array.Copy(xs, 0, knots, 3, nx); 160 knots[nx + 3] = xs[nx - 1]; 161 knots[nx + 4] = xs[nx - 1]; 162 knots[nx + 5] = xs[nx - 1]; 163 */ 164 165 // use uniform grid of knots 166 nk = 20; 167 knots = new float[nk + 4]; 168 knots[0] = xs[0]; 169 knots[1] = xs[0]; 170 knots[2] = xs[0]; 171 for(int i = 3; i<nk+1;i++) { 172 knots[i] = (i-3f) / (nk-1); 173 } 174 knots[nk] = xs[nx - 1]; 175 knots[nk + 1] = xs[nx - 1]; 176 knots[nk + 2] = xs[nx - 1]; 177 knots[nk + 3] = xs[nx - 1]; 178 179 if (nx < 4) { 156 180 report = new SBART_Report(); 157 181 report.leverage = new double[0]; … … 160 184 161 185 float[] coeff = new float[nk]; 186 float[] leverage = new float[nx]; 187 float[] y_smoothed = new float[nx]; 188 162 189 163 190 // working arrays for sbart … … 172 199 float[] sg3 = new float[nk]; 173 200 int ld4 = 4; 174 float[,] adb = new float[ nk, ld4];201 float[,] adb = new float[ld4, nk]; 175 202 176 203 float[,] p1ip = new float[nk, ld4]; 177 204 int ldnk = nk + 4; 178 float[,] p2ip = new float[nk, ldnk]; 179 180 SBART.sbart_x64(xs, ys, ws, ref nx, knots, ref nk, coeff, y_smoothed, leverage, ref crit, ref icrit, 205 float[,] p2ip = new float[nk, nx]; 206 207 SBART.sbart_x64(xs.Take(nx).ToArray(), ys.Take(nx).ToArray(), ws.Take(nx).ToArray(), ref nx, 208 knots, ref nk, 209 coeff, y_smoothed, leverage, 210 ref crit, ref icrit, 181 211 ref smoothingParameter, ref smoothingParameterIndicator, ref lowerSmoothingParameter, ref upperSmoothingParameter, 182 212 ref tol, ref isetup,
Note: See TracChangeset
for help on using the changeset viewer.