示例#1
0
 /**
  * External callable method for changing the measurement mode
  * */
 public void changeSelectedMode(ExperimentMode mode)
 {
     if (cmbMode.SelectedIndex != (int)mode)
     {
         cmbMode.SelectedIndex = (int)mode;
     }
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Metrics" /> class.
        /// </summary>
        /// <param name="inputs">The inputs.</param>
        /// <param name="results">The results.</param>
        /// <param name="mode">The mode.</param>
        public Metrics(Inputs inputs, Results results, ExperimentMode mode)
        {
            this.UserName = inputs.UserName;

            if (results.Validation != null)
            {
                this.Validation = new MetricsSet(inputs.Validation, results.Validation, inputs.UserName, mode);
            }

            if (results.Test != null)
            {
                this.Test = new MetricsSet(inputs.Test, results.Test, inputs.UserName, mode);
            }
        }
示例#3
0
            /// <summary>
            /// Initializes a new instance of the <see cref="MetricsSet" /> class.
            /// </summary>
            /// <param name="inputsSet">The inputs set.</param>
            /// <param name="resultsSet">The results set.</param>
            /// <param name="userName">Name of the user.</param>
            /// <param name="mode">The mode.</param>
            public MetricsSet(Inputs.DataSet inputsSet, Results.ResultsSet resultsSet, string userName, ExperimentMode mode)
            {
                this.UserName = userName;

                this.DataSetSize = inputsSet.Instances.Count;

                var instances = inputsSet.Instances;

                var instanceScores =
                    instances.Zip(resultsSet.IsRepliedProbTrue, (x, y) => new KeyValuePair <Inputs.Instance, double>(x, y)).ToArray();

                var positiveInstances = inputsSet.PositiveInstances;

                this.FractionPositive = (double)positiveInstances.Count / instances.Count;

                var calibrationCurve =
                    Evaluator.CalibrationCurve(true, inputsSet, resultsSet.PredictionDicts, Bins, MinBinInstanceCount)
                    .Select(ia => new Point(ia.First, ia.Second));

                var precisionRecallCurve = InferMetrics.PrecisionRecallCurve(positiveInstances, instanceScores).ToList();

                this.AreaUnderCurve   = InferMetrics.AreaUnderRocCurve(positiveInstances, instanceScores);
                this.AveragePrecision = ComputeAveragePrecision(precisionRecallCurve, 0.1, 0.9);
                this.CalibrationError = Math.Sqrt(calibrationCurve.Select(ia => Math.Pow(ia.X - ia.Y, 2)).Average());

                if (mode != ExperimentMode.Online && mode != ExperimentMode.Incremental)
                {
                    this.CalibrationCurve = calibrationCurve.ToArray();

                    // Save some memory by not calculating these in online mode
                    this.PrecisionRecallCurve = precisionRecallCurve.Select(ia => new Point(ia.First, ia.Second)).ToArray();

                    this.PrecisionRecallRandomCurve = new[] { new Point(0.0, this.FractionPositive), new Point(1.0, this.FractionPositive) };

                    this.RocCurve =
                        InferMetrics.ReceiverOperatingCharacteristicCurve(instances.Where(ia => ia.Label), instanceScores)
                        .Select(ia => new Point(ia.First, ia.Second))
                        .ToArray();
                }

                this.ReplyCount    = inputsSet.PositiveInstances.Count;
                this.ReplyFraction = (double)this.ReplyCount / inputsSet.Count;
            }
 public void changeSelectedMode(ExperimentMode mode)
 {
     k2700Setup.changeSelectedMode(mode);
 }
示例#5
0
 public void SwypeKeyboardMode()
 {
     experimentMode = ExperimentMode.SWYPE_KEYBOARD;
 }
示例#6
0
 public void NormalKeyboardMode()
 {
     experimentMode = ExperimentMode.NORMAL_KEYBOARD;
 }