Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/07/17 19:49:23 (6 years ago)
Author:
gkronber
Message:

experimentation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/MathNetNumerics-Exploration-2789/HeuristicLab.Algorithms.DataAnalysis.Experimental/SBART.cs

    r15458 r15459  
    125125
    126126      int n = x.Length;
    127       float[] leverage = new float[n];
    128       float[] y_smoothed = new float[n];
    129127      int ic = n - 1;
    130128      int ier = -99;
     
    133131
    134132      float crit = -99.0f;
    135       int icrit = 0; // 0..don't calc CV,  1 .. GCV, 2 CV
     133      int icrit = 1; // 0..don't calc CV,  1 .. GCV, 2 CV
    136134
    137135      // float smoothingParameter = -99.0f;
    138       int smoothingParameterIndicator = 1;
     136      int smoothingParameterIndicator = 0;
    139137      float lowerSmoothingParameter = 0f;
    140138      float upperSmoothingParameter = 1.0f;
     
    153151        SBART.setreg_x64(xs, ys, ws,
    154152          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) {
    156180          report = new SBART_Report();
    157181          report.leverage = new double[0];
     
    160184
    161185        float[] coeff = new float[nk];
     186        float[] leverage = new float[nx];
     187        float[] y_smoothed = new float[nx];
     188
    162189
    163190        // working arrays for sbart
     
    172199        float[] sg3 = new float[nk];
    173200        int ld4 = 4;
    174         float[,] adb = new float[nk, ld4];
     201        float[,] adb = new float[ld4, nk];
    175202
    176203        float[,] p1ip = new float[nk, ld4];
    177204        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,
    181211          ref smoothingParameter, ref smoothingParameterIndicator, ref lowerSmoothingParameter, ref upperSmoothingParameter,
    182212          ref tol, ref isetup,
Note: See TracChangeset for help on using the changeset viewer.