Пример #1
0
        public void VisualizeOutcomeCodeSampling_Test()
        {
            double[] values       = new double[300];
            bool[][] outcomeCodes = new bool[300][];
            Random   z            = new Random();

            for (int i = 0; i < values.Length; i++)
            {
                double d = z.NextDouble();
                if (d > 0.7)
                {
                    outcomeCodes[i] = new bool[] { z.NextDouble() > 0.2, z.NextDouble() > 0.1 }
                }
                ;
                else
                {
                    outcomeCodes[i] = new bool[] { z.NextDouble() > 0.6, z.NextDouble() > 0.7 }
                };

                values[i] = d;
            }

            outcomeCodes[50] = null;

            double validRatio;

            double[][] samples = IndicatorSampler.sampleValuesOutcomeCode(values, outcomeCodes, 0, 1, 10, out validRatio);

            samples[3] = null;

            Image img = OutcomeSamplingVisualizer.visualizeOutcomeCodeSamplingTable(samples, 500, 300, 0.3d);
            //ArrayVisualizer.showImg(img); //Todo: Test somehow
        }
        public Image visualizeTables(int width, int height, bool showState = false)
        {
            double currentIndicatorValue = indicator.getIndicator();
            Image  outcomeImg            = OutcomeSamplingVisualizer.visualizeOutcomeSamplingTable(outcomeSamplingTable, width, height / 2, showState ? currentIndicatorValue : double.NaN);
            Image  outcomeCodeImg        = OutcomeSamplingVisualizer.visualizeOutcomeCodeSamplingTable(outcomeCodeSamplingTable, width, height / 2, showState ? currentIndicatorValue : double.NaN);

            Image    o = new Bitmap(width, height);
            Graphics g = Graphics.FromImage(o);

            g.Clear(Color.White);
            g.DrawImage(outcomeImg, 0, 0);
            g.DrawImage(outcomeCodeImg, 0, outcomeImg.Height);
            g.DrawLine(new Pen(Color.Blue, 3), 0, outcomeImg.Height, outcomeImg.Width, outcomeImg.Height);

            return(o);
        }