예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GaussianBayesPointMachineClassifierAdvancedTrainingSettings"/> class
        /// from a reader of a binary stream.
        /// </summary>
        /// <param name="reader">The binary reader to read the advanced training settings from.</param>
        /// <param name="isTrained">Indicates whether the Bayes point machine classifier is trained.</param>
        internal GaussianBayesPointMachineClassifierAdvancedTrainingSettings(BinaryReader reader, Func <bool> isTrained)
        {
            if (reader == null)
            {
                throw new ArgumentNullException(nameof(reader));
            }

            reader.VerifySerializationGuid(
                this.customSerializationGuid,
                "The binary stream does not contain the advanced training settings of an Infer.NET Bayes point machine classifier.");

            int deserializedVersion = reader.ReadSerializationVersion(CustomSerializationVersion);

            if (deserializedVersion == CustomSerializationVersion)
            {
                this.trainingSettingsGuard = new SettingsGuard(reader, isTrained);

                this.weightPriorVariance = reader.ReadDouble();
            }
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GaussianBayesPointMachineClassifierAdvancedTrainingSettings"/> class.
        /// </summary>
        /// <param name="isTrained">Indicates whether the Bayes point machine classifier is trained.</param>
        internal GaussianBayesPointMachineClassifierAdvancedTrainingSettings(Func <bool> isTrained)
        {
            this.trainingSettingsGuard = new SettingsGuard(isTrained, "This setting cannot be changed after training.");

            this.weightPriorVariance = 1.0;
        }