Beispiel #1
0
        public static void RunExperiments(Outputter outputter)
        {
            ModelRunner runner = new ModelRunner(outputter);

            Console.WriteLine($"\n{Contents.S2TestingOutTheModel.NumberedName}.\n");
            runner.ToyWith3QuestionsAnd2Skills();
            Console.WriteLine($"\n{Contents.S3Loopiness.NumberedName}.\n");
            runner.LoopyExample();

            // Inference on the real data. Sections 4-6.
            runner.RealDataInference();

            // PDF demo
            Console.WriteLine("PDF demonstration");
            runner.ProbabilityDensityFunctionDemo();

            // Demo of Beta distribution
            Console.WriteLine("Beta function demonstration");
            runner.BetaDemo();

            // For Beta self assessment
            runner.BetaSelfAssessment();

            Console.WriteLine("\nCompleted all experiments.");
        }
Beispiel #2
0
        /// <summary>
        /// The entry point for the application.
        /// The first argument, if present, sets the folder to save the output artifacts in.
        /// </summary>
        public static void Main(string[] args)
        {
            var engine = new InferenceEngine();

            InitializeUI();
            Outputter outputter = new Outputter(Contents.ChapterName);

            try
            {
                ModelRunner runner = new ModelRunner(outputter);

                Console.WriteLine($"\n{Contents.S2TestingOutTheModel.NumberedName}.\n");
                runner.ToyWith3QuestionsAnd2Skills();
                Console.WriteLine($"\n{Contents.S3Loopiness.NumberedName}.\n");
                runner.LoopyExample();

                // Inference on the real data. Sections 4-6.
                runner.RealDataInference();

                // PDF demo
                Console.WriteLine("PDF demonstration");
                runner.ProbabilityDensityFunctionDemo();

                // Demo of Beta distribution
                Console.WriteLine("Beta function demonstration");
                runner.BetaDemo();

                // For Beta self assessment
                runner.BetaSelfAssessment();

                Console.WriteLine("\nCompleted all experiments.");
            }
            catch (Exception e)
            {
                Console.WriteLine($"\nAn unhandled exception was thrown:\n{e}");
            }
            finally
            {
                if (args.Length == 1)
                {
                    Console.WriteLine("\n\nSaving outputs...");
                    outputter.SaveOutputAsProducedFlattening(args[0]);
                    Console.WriteLine("Done saving.");
                }
            }
        }