Beispiel #1
0
        public static void biasvar(List <int> classes, List <List <int> > preds, int ntestexs, int ntrsets)
        {
            double loss = 0;
            double bias = 0;
            double var  = 0;
            double varp = 0;
            double varn = 0;
            double varc = 0;

            BiasVariance.biasvar(classes, preds, ntestexs, ntrsets, ref loss, ref bias, ref var, ref varp, ref varn, ref varc);
        }
Beispiel #2
0
        public static void biasvar(List <int> classes, List <List <int> > preds, int ntestexs, int ntrsets, ref double loss, ref double bias, ref double var, ref double varp, ref double varn, ref double varc)
        {
            double lossx = 0;
            double biasx = 0;
            double varx  = 0;

            loss = 0.0;
            bias = 0.0;
            varp = 0.0;
            varn = 0.0;
            varc = 0.0;

            for (int e = 0; e < ntestexs; e++)
            {
                BiasVariance.biasvarx(classes[e], preds[e], ntrsets, ref lossx, ref biasx, ref varx);
                loss += lossx;
                bias += biasx;
                if (biasx != 0.0)
                {
                    varn += varx;
                    varc += 1.0;
                    varc -= lossx;
                }
                else
                {
                    varp += varx;
                }
            }

            loss /= ntestexs;
            bias /= ntestexs;
            var   = loss - bias;
            varp /= ntestexs;
            varn /= ntestexs;
            varc /= ntestexs;

            Trace.TraceInformation("");
            Trace.TraceInformation("loss,bias,var,varp,varn,varc");
            Trace.TraceInformation("{0},{1},{2},{3},{4},{5}", loss, bias, var, varp, varn, varc);
        }