Ejemplo n.º 1
0
        /// <summary>
        /// The entry point of the program, where the program control starts and ends.
        /// </summary>
        public static void Main()
        {
            // Demo of plotting utility
#if FALSE
            {
                var x = Enumerable.Range(0, 200).Select(ia => (double)ia / 100.0);
                var y = x.Select(ia => Math.Sin(2.0 * ia * Math.PI));
                PythonPlotter.Plot(x, y, "Test figure", "$x$", @"$\sin(2 \pi x)$");
            }
#endif

            Rand.Restart(0);

            Console.WriteLine("Run Toy Experiments [Y]/n");

            if (Console.ReadKey(true).Key.ToString().ToLower() != "n")
            {
                Console.WriteLine("Run Transfer [Y]/n");
                bool runTransfer = Console.ReadKey(true).Key.ToString().ToLower() != "n";
                Console.WriteLine("Run Active y/[N]");
                bool runActive = Console.ReadKey(true).Key.ToString().ToLower() == "y";
                Console.WriteLine("Run Active Transfer y/[N]");
                bool runActiveTransfer = Console.ReadKey(true).Key.ToString().ToLower() == "y";

                ToyDataRunner.Run(trainModel, testModel, runTransfer, runActive, runActiveTransfer);
            }

            Console.WriteLine("Run Real Experiments y/[N]");

            if (Console.ReadKey(true).Key.ToString().ToLower() == "y")
            {
                var accelerometerRunner = new RealDataRunner
                {
                    Target      = JsonConvert.DeserializeObject <DataLoader>(File.ReadAllText("../../../data/accel/real_target_3.json")),
                    Source      = JsonConvert.DeserializeObject <DataLoader>(File.ReadAllText("../../../data/accel/real_source_3.json")),
                    ActiveSteps = 20,
                    ShowPlots   = true,
                    AddBias     = true
                };

                Console.WriteLine("Run VOI [Y]/n");
                bool runVOI = Console.ReadKey(true).Key.ToString().ToLower() != "n";
                Console.WriteLine("Run Active Evidence y/[N]");
                bool runActiveEvidence = Console.ReadKey(true).Key.ToString().ToLower() == "y";

                accelerometerRunner.Run(trainModel, testModel, evidenceModel, runVOI, runActiveEvidence);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The entry point of the program, where the program control starts and ends.
        /// </summary>
        public static void Main()
        {
            // Demo of plotting utility
            #if FALSE
            {
                var x = Enumerable.Range(0, 200).Select(ia => (double)ia / 100.0);
                var y = x.Select(ia => Math.Sin(2.0 * ia * Math.PI));
                PythonPlotter.Plot(x, y, "Test figure", "$x$", @"$\sin(2 \pi x)$");

            }
            #endif

            Rand.Restart(0);

            Console.WriteLine("Run Toy Experiments [Y]/n");

            if (Console.ReadKey(true).Key.ToString().ToLower() != "n")
            {
                Console.WriteLine("Run Transfer [Y]/n");
                bool runTransfer = Console.ReadKey(true).Key.ToString().ToLower() != "n";
                Console.WriteLine("Run Active y/[N]");
                bool runActive = Console.ReadKey(true).Key.ToString().ToLower() == "y";
                Console.WriteLine("Run Active Transfer y/[N]");
                bool runActiveTransfer = Console.ReadKey(true).Key.ToString().ToLower() == "y";

                ToyDataRunner.Run(trainModel, testModel, runTransfer, runActive, runActiveTransfer);
            }

            Console.WriteLine("Run Real Experiments y/[N]");

            if (Console.ReadKey(true).Key.ToString().ToLower() == "y")
            {
                var accelerometerRunner = new RealDataRunner
                {
                    Target = JsonConvert.DeserializeObject<DataLoader>(File.ReadAllText("../../../data/accel/real_target_3.json")),
                    Source = JsonConvert.DeserializeObject<DataLoader>(File.ReadAllText("../../../data/accel/real_source_3.json")),
                    ActiveSteps = 20,
                    ShowPlots = true,
                    AddBias = true
                };

                Console.WriteLine("Run VOI [Y]/n");
                bool runVOI = Console.ReadKey(true).Key.ToString().ToLower() != "n";
                Console.WriteLine("Run Active Evidence y/[N]");
                bool runActiveEvidence = Console.ReadKey(true).Key.ToString().ToLower() == "y";

                accelerometerRunner.Run(trainModel, testModel, evidenceModel, runVOI, runActiveEvidence);
            }
        }