/// <summary> /// Initializes a new instance of the /// <see cref="NativeDataFormatBayesPointMachineClassifier{TInstanceSource, TInstance, TLabelSource, TLabel, TLabelDistribution, TTrainingSettings, TPredictionSettings}"/> /// class. /// </summary> /// <param name="mapping">The mapping used for accessing data in the native format.</param> protected NativeDataFormatBayesPointMachineClassifier(IBayesPointMachineClassifierMapping <TInstanceSource, TInstance, TLabelSource, TLabel> mapping) { Debug.Assert(mapping != null, "The mapping must not be null."); this.Mapping = mapping; this.capabilities = new BayesPointMachineClassifierCapabilities(); this.IsTrained = false; this.isIncrementallyTrained = false; }
/// <summary> /// Initializes a new instance of the /// <see cref="NativeDataFormatBayesPointMachineClassifier{TInstanceSource, TInstance, TLabelSource, TLabel, TLabelDistribution, TTrainingSettings, TPredictionSettings}"/> /// class from a reader of a binary stream. /// </summary> /// <param name="reader">The binary reader to read the state of the Bayes point machine classifier from.</param> /// <param name="mapping">The mapping used for accessing data in the native format.</param> protected NativeDataFormatBayesPointMachineClassifier( BinaryReader reader, IBayesPointMachineClassifierMapping <TInstanceSource, TInstance, TLabelSource, TLabel> mapping) { Debug.Assert(reader != null, "The reader must not be null."); Debug.Assert(mapping != null, "The mapping must not be null."); this.Mapping = mapping; this.capabilities = new BayesPointMachineClassifierCapabilities(); reader.VerifySerializationGuid( this.customSerializationGuid, "The binary stream does not contain an Infer.NET Bayes point machine classifier."); int deserializedVersion = reader.ReadSerializationVersion(CustomSerializationVersion); if (deserializedVersion == CustomSerializationVersion) { this.IsTrained = reader.ReadBoolean(); this.isIncrementallyTrained = reader.ReadBoolean(); this.logModelEvidence = reader.ReadDouble(); } }