private void saveBranchToDisk(object key1)
        {
            try
            {
                SerializeFile.Save(base_filename + "." + key1.ToString(), trunk[key1]);
            }

            catch (Exception e)
            {
                Console.WriteLine("Error saving branch {0}: {1}", key1, e.Message);
            }
        }
Beispiel #2
0
        public static void TestFastSaveLoad()
        {
            // Random data
            double alpha      = 0.1;
            double beta       = 0.2;
            int    num_topics = 200;
            int    num_words  = 10000;
            int    num_docs   = 20000;

            int[][] WORDS_IN_DOCS = new int[num_docs][];
            for (int i = 0; i < num_docs; ++i)
            {
                WORDS_IN_DOCS[i] = new int[i % 100 + 1];
            }

            LDASampler lda_sampler = new LDASampler(alpha, beta, num_topics, num_words, num_docs, WORDS_IN_DOCS);

            {
                string lda_sampler_filename = @"C:\temp\ldatest_old.dat";
                Logging.Info("+OldSave");
                SerializeFile.Save(lda_sampler_filename, lda_sampler);
                Logging.Info("-OldSave");
                Logging.Info("+OldLoad");
                lda_sampler = (LDASampler)SerializeFile.Load(lda_sampler_filename);
                Logging.Info("-OldLoad");
            }
            {
                string lda_sampler_filename = @"C:\temp\ldatest_new.dat";
                Logging.Info("+NewSave");
                lda_sampler.FastSave(lda_sampler_filename);
                Logging.Info("-NewSave");
                Logging.Info("+NewLoad");
                lda_sampler = FastLoad(lda_sampler_filename, WORDS_IN_DOCS);
                Logging.Info("-NewLoad");
            }
        }