public GetPartitionSize ( int index, int &trainingCount, int &validationCount ) : void | ||
index | int | The index of the bootstrap sample. |
trainingCount | int | The number of instances in the training set. |
validationCount | int | The number of instances in the validation set. |
Результат | void |
/// <summary> /// Initializes a new instance of the <see cref="BootstrapResult"/> class. /// </summary> /// /// <param name="owner">The <see cref="Bootstrap"/> that is creating this result.</param> /// <param name="models">The models created during the cross-validation runs.</param> /// public BootstrapResult(Bootstrap owner, BootstrapValues[] models) { double[] trainingValues = new double[models.Length]; double[] trainingVariances = new double[models.Length]; int[] trainingCount = new int[models.Length]; double[] validationValues = new double[models.Length]; double[] validationVariances = new double[models.Length]; int[] validationCount = new int[models.Length]; for (int i = 0; i < models.Length; i++) { trainingValues[i] = models[i].TrainingValue; trainingVariances[i] = models[i].TrainingVariance; validationValues[i] = models[i].ValidationValue; validationVariances[i] = models[i].ValidationVariance; owner.GetPartitionSize(i, out trainingCount[i], out validationCount[i]); } this.Settings = owner; this.Training = new CrossValidationStatistics(trainingCount, trainingValues, trainingVariances); this.Validation = new CrossValidationStatistics(validationCount, validationValues, validationVariances); this.Estimate = 0.632 * Validation.Mean + 0.368 * Training.Mean; }
/// <summary> /// Initializes a new instance of the <see cref="BootstrapResult"/> class. /// </summary> /// /// <param name="owner">The <see cref="Bootstrap"/> that is creating this result.</param> /// <param name="models">The models created during the cross-validation runs.</param> /// public BootstrapResult(Bootstrap owner, BootstrapValues[] models) { double[] trainingValues = new double[models.Length]; double[] trainingVariances = new double[models.Length]; int[] trainingCount = new int[models.Length]; double[] validationValues = new double[models.Length]; double[] validationVariances = new double[models.Length]; int[] validationCount = new int[models.Length]; for (int i = 0; i < models.Length; i++) { trainingValues[i] = models[i].TrainingValue; trainingVariances[i] = models[i].TrainingVariance; validationValues[i] = models[i].ValidationValue; validationVariances[i] = models[i].ValidationVariance; owner.GetPartitionSize(i, out trainingCount[i], out validationCount[i]); } this.Settings = owner; this.Training = new CrossValidationStatistics(trainingCount, trainingValues, trainingVariances); this.Validation = new CrossValidationStatistics(validationCount, validationValues, validationVariances); this.Estimate = 0.632 * Validation.Mean + 0.368 * Training.Mean; }