Example #1
0
 public bool Load(Stream streamIn)
 {
     Model = new NaiveBayes();
     try
     {
         Model.Load(streamIn);
     } catch (FileNotFoundException)
     {
         return(false);
     }
     return(true);
 }
        public void TestModelSaveAndLoad()
        {
            TestTrainValidData();
            string modelFileName = "NaiveBayesFile.txt";

            NaiveBayesModel.Save(new StreamWriter(modelFileName).BaseStream);
            var nbTestModel = new NaiveBayes();

            nbTestModel.Load(new StreamReader(modelFileName).BaseStream);
            Assert.AreEqual(nbTestModel, NaiveBayesModel);
            File.Delete(modelFileName);
        }