Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13121 for trunk/sources


Ignore:
Timestamp:
11/05/15 10:28:19 (9 years ago)
Author:
gkronber
Message:

#2502: calculate the variance for the noisy test data instead V(y*) instead of the variance for the posterior GP function V(f*)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/GaussianProcessRegressionSolutionLineChartView.cs

    r12012 r13121  
    7070        var mean = Content.EstimatedTrainingValues.ToArray();
    7171        var s2 = Content.EstimatedTrainingVariance.ToArray();
    72         var lower = mean.Zip(s2, (m, s) => m - 1.96 * Math.Sqrt(s)).ToArray();
    73         var upper = mean.Zip(s2, (m, s) => m + 1.96 * Math.Sqrt(s)).ToArray();
     72        var lower = mean.Zip(s2, GetLowerConfBound).ToArray();
     73        var upper = mean.Zip(s2, GetUpperConfBound).ToArray();
    7474        this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TrainingIndices.ToArray(), lower, upper);
    7575        this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_TRAINING_SERIES_NAME]);
     
    8383        mean = Content.EstimatedTestValues.ToArray();
    8484        s2 = Content.EstimatedTestVariance.ToArray();
    85         lower = mean.Zip(s2, (m, s) => m - 1.96 * Math.Sqrt(s)).ToArray();
    86         upper = mean.Zip(s2, (m, s) => m + 1.96 * Math.Sqrt(s)).ToArray();
     85        lower = mean.Zip(s2, GetLowerConfBound).ToArray();
     86        upper = mean.Zip(s2, GetUpperConfBound).ToArray();
    8787        this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME].Points.DataBindXY(Content.ProblemData.TestIndices.ToArray(), lower, upper);
    8888        this.InsertEmptyPoints(this.chart.Series[ESTIMATEDVALUES_TEST_SERIES_NAME]);
     
    9393        mean = Content.EstimatedValues.ToArray();
    9494        s2 = Content.EstimatedVariance.ToArray();
    95         lower = mean.Zip(s2, (m, s) => m - 1.96 * Math.Sqrt(s)).ToArray();
    96         upper = mean.Zip(s2, (m, s) => m + 1.96 * Math.Sqrt(s)).ToArray();
     95        lower = mean.Zip(s2, GetLowerConfBound).ToArray();
     96        upper = mean.Zip(s2, GetUpperConfBound).ToArray();
    9797        List<double> allLower = allIndices.Select(index => lower[index]).ToList();
    9898        List<double> allUpper = allIndices.Select(index => upper[index]).ToList();
     
    265265            mean = Content.EstimatedValues.ToArray();
    266266            s2 = Content.EstimatedVariance.ToArray();
    267             lower = mean.Zip(s2, (m, s) => m - 1.96 * Math.Sqrt(s)).ToArray();
    268             upper = mean.Zip(s2, (m, s) => m + 1.96 * Math.Sqrt(s)).ToArray();
     267            lower = mean.Zip(s2, GetLowerConfBound).ToArray();
     268            upper = mean.Zip(s2, GetUpperConfBound).ToArray();
    269269            lower = indices.Select(index => lower[index]).ToArray();
    270270            upper = indices.Select(index => upper[index]).ToArray();
     
    274274            mean = Content.EstimatedTrainingValues.ToArray();
    275275            s2 = Content.EstimatedTrainingVariance.ToArray();
    276             lower = mean.Zip(s2, (m, s) => m - 1.96 * Math.Sqrt(s)).ToArray();
    277             upper = mean.Zip(s2, (m, s) => m + 1.96 * Math.Sqrt(s)).ToArray();
     276            lower = mean.Zip(s2, GetLowerConfBound).ToArray();
     277            upper = mean.Zip(s2, GetUpperConfBound).ToArray();
    278278            break;
    279279          case ESTIMATEDVALUES_TEST_SERIES_NAME:
     
    281281            mean = Content.EstimatedTestValues.ToArray();
    282282            s2 = Content.EstimatedTestVariance.ToArray();
    283             lower = mean.Zip(s2, (m, s) => m - 1.96 * Math.Sqrt(s)).ToArray();
    284             upper = mean.Zip(s2, (m, s) => m + 1.96 * Math.Sqrt(s)).ToArray();
     283            lower = mean.Zip(s2, GetLowerConfBound).ToArray();
     284            upper = mean.Zip(s2, GetUpperConfBound).ToArray();
    285285            break;
    286286        }
     
    295295    }
    296296
     297    private double GetLowerConfBound(double m, double s) {
     298      return m - 1.96 * Math.Sqrt(s);
     299    }
     300
     301
     302    private double GetUpperConfBound(double m, double s) {
     303      return m + 1.96 * Math.Sqrt(s);
     304    }
     305
    297306    // workaround as per http://stackoverflow.com/questions/5744930/datapointcollection-clear-performance
    298307    private static void ClearPointsQuick(DataPointCollection points) {
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/GaussianProcess/GaussianProcessModel.cs

    r13118 r13121  
    362362      for (int i = 0; i < newN; i++) {
    363363        var sumV = Util.ScalarProd(Util.GetCol(sWKs, i), Util.GetCol(sWKs, i));
     364        kss[i] += sqrSigmaNoise; // kss is V(f), add noise variance of predictive distibution to get V(y)
    364365        kss[i] -= sumV;
    365366        if (kss[i] < 0) kss[i] = 0;
Note: See TracChangeset for help on using the changeset viewer.