Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ValidationJobResult"/> struct.
 /// </summary>
 /// <param name="job">The job.</param>
 /// <param name="confusion">The confusion.</param>
 /// <param name="duration">The duration.</param>
 /// <remarks></remarks>
 public ValidationJobResult(ValidationJob job, ClassConfusionMatrix confusion, TimeSpan duration)
 {
     Job       = job;
     Duration  = duration;
     Confusion = confusion;
     JobNumber = 0;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Computes this instance.
        /// </summary>
        /// <remarks></remarks>
        public override void Compute()
        {
            ConfusionMatrix = new ClassConfusionMatrix();

            TrainingFunction(Training);

            foreach (Instance test in Testing)
            {
                Result p = ClassifyFunction(test);
                ConfusionMatrix[test.Class, p.Class] += 1;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Runs the validation process. Results are avaliable in the form of the ConfusionMatrix property.
        /// </summary>
        /// <remarks></remarks>
        public override void Compute()
        {
            ConfusionMatrix              = new ClassConfusionMatrix();
            ConfusionMatrix.SampleSize   = (int)Math.Ceiling((double)Instances.Count / Folds);
            ConfusionMatrix.ExampleCount = Instances.Count;

            Stopwatch timer = new Stopwatch();

            for (int i = 0; i < Repetitions; i += 1)
            {
                List <Instance[]> instFolds = CreateFolds(Instances, Folds);

                for (int j = 0; j < instFolds.Count; j++)
                {
                    Instance[] curFold = instFolds[j];

                    List <Instance> train = new List <Instance>();
                    for (int k = 0; k < instFolds.Count; k++)
                    {
                        if (k != j)
                        {
                            train.AddRange(instFolds[k]);
                        }
                    }

                    TrainingFunction(train);

                    for (int k = 0; k < curFold.Length; k++)
                    {
                        Instance x = curFold[k];
                        timer.Start();
                        Result p = ClassifyFunction(x);
                        timer.Stop();
                        ConfusionMatrix[x.Class, p.Class] += 1;
                    }
                }
            }

            ConfusionMatrix.Rate = (float)ConfusionMatrix.Observations / (float)timer.Elapsed.TotalSeconds;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Runs the validation process. Results are avaliable in the form of the ConfusionMatrix property.
        /// </summary>
        /// <remarks></remarks>
        public override void Compute()
        {
            ConfusionMatrix = new ClassConfusionMatrix();
            ConfusionMatrix.SampleSize = (int)Math.Ceiling((double)Instances.Count / Folds);
            ConfusionMatrix.ExampleCount = Instances.Count;

            Stopwatch timer = new Stopwatch();

            for (int i = 0; i < Repetitions; i += 1)
            {
                List<Instance[]> instFolds = CreateFolds(Instances, Folds);

                for (int j = 0; j < instFolds.Count; j++)
                {
                    Instance[] curFold = instFolds[j];

                    List<Instance> train = new List<Instance>();
                    for (int k = 0; k < instFolds.Count; k++) 
                    {
                        if (k != j)
                        {
                            train.AddRange(instFolds[k]);
                        }
                    }

                    TrainingFunction(train);

                    for (int k = 0; k < curFold.Length; k++) 
                    {
                        Instance x = curFold[k];
                        timer.Start();
                        Result p = ClassifyFunction(x);
                        timer.Stop();
                        ConfusionMatrix[x.Class, p.Class] += 1;
                    }
                }
            }

            ConfusionMatrix.Rate = (float)ConfusionMatrix.Observations / (float)timer.Elapsed.TotalSeconds;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Computes this instance.
        /// </summary>
        /// <remarks></remarks>
        public override void Compute()
        {
            ConfusionMatrix = new ClassConfusionMatrix();

            TrainingFunction(Training);

            foreach (Instance test in Testing)
            {
                Result p = ClassifyFunction(test);
                ConfusionMatrix[test.Class, p.Class] += 1;
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ValidationJobResult"/> struct.
 /// </summary>
 /// <param name="job">The job.</param>
 /// <param name="confusion">The confusion.</param>
 /// <param name="duration">The duration.</param>
 /// <remarks></remarks>
 public ValidationJobResult(ValidationJob job, ClassConfusionMatrix confusion, TimeSpan duration)
 {
     Job = job;
     Duration = duration;
     Confusion = confusion;
     JobNumber = 0;
 }