Ejemplo n.º 1
0
 /// <summary>
 ///   Initializes a new instance of the <see cref="SplitSetValidation&lt;TModel&gt;"/> class.
 /// </summary>
 ///
 /// <param name="owner">The <see cref="SplitSetValidation{TModel}"/> that is creating this result.</param>
 /// <param name="training">The training set statistics.</param>
 /// <param name="testing">The testing set statistics.</param>
 ///
 public SplitSetResult(SplitSetValidation <TModel> owner,
                       SplitSetStatistics <TModel> training, SplitSetStatistics <TModel> testing)
 {
     this.Settings   = owner;
     this.Training   = training;
     this.Validation = testing;
 }
Ejemplo n.º 2
0
        /// <summary>
        ///   Computes the split-set validation algorithm.
        /// </summary>
        ///
        public SplitSetResult <TModel> Compute()
        {
            if (Fitting == null)
            {
                throw new InvalidOperationException("Fitting function must have been previously defined.");
            }

            // Fit and evaluate the model
            SplitSetStatistics <TModel> training = fitting(TrainingSet);
            SplitSetStatistics <TModel> testing  = estimation(ValidationSet, training.Model);

            // Return validation statistics
            return(new SplitSetResult <TModel>(this, training, testing));
        }