public void LoadRFModel(string file_name = "")
        {
            if (file_name == "")
                file_name = RF_model_file_path_;
            
            decisionForest = new dforest.decisionforest();
            alglib.serializer Serializer = new alglib.serializer();
            string modelFile = System.IO.File.ReadAllText(file_name);
            Serializer.ustart_str(modelFile);
            dforest.dfunserialize(Serializer, decisionForest);
            Serializer.stop();
            Console.WriteLine("Finish loading the RF model");
            Console.WriteLine("Total tree size: {0}", decisionForest.trees.Length);
            int treeSize = (int)(decisionForest.trees.Length / decisionForest.ntrees);
            Console.WriteLine("single tree size:{0}", treeSize);
            Console.WriteLine("Number of variable: {0}", decisionForest.nvars);
            Console.WriteLine("ntress: {0}", decisionForest.ntrees);
            Console.WriteLine("nclasses: {0}", decisionForest.nclasses);
            // turn the tree from double type to int type to make it more efficient
            trees_int_ = new int[decisionForest.trees.Length];
            Console.WriteLine("Length of the original tree: {0}", trees_int_.Length);
            for (int i = 0; i < decisionForest.trees.Length; i++)
                trees_int_[i] = (int)Math.Ceiling(decisionForest.trees[i]);

        }
        /*
        public void LoadRFModel(string file_name = "")
        {
            if (file_name == "")
                file_name = RF_model_file_path_;
            
            decisionForest = new dforest.decisionforest();
            alglib.serializer Serializer = new alglib.serializer();
            string modelFile = System.IO.File.ReadAllText(file_name);
            Serializer.ustart_str(modelFile);
            dforest.dfunserialize(Serializer, decisionForest);
            Serializer.stop();
            Console.WriteLine("Finish loading the RF model");
            Console.WriteLine("Total tree size: {0}", decisionForest.trees.Length);
            int treeSize = (int)(decisionForest.trees.Length / decisionForest.ntrees);
            Console.WriteLine("single tree size:{0}", treeSize);
            Console.WriteLine("Number of variable: {0}", decisionForest.nvars);
            Console.WriteLine("ntress: {0}", decisionForest.ntrees);
            Console.WriteLine("nclasses: {0}", decisionForest.nclasses);
            // turn the tree from double type to int type to make it more efficient
            trees_int_ = new int[decisionForest.trees.Length];
            Console.WriteLine("Length of the original tree: {0}", trees_int_.Length);
            for (int i = 0; i < decisionForest.trees.Length; i++)
                trees_int_[i] = (int)Math.Ceiling(decisionForest.trees[i]);

        }
        */
        #endregion

        public void LoadRFModel(string file_name = "")
        {
            if (file_name == "")
                file_name = RF_model_file_path_;
            decisionForest = new dforest.decisionforest();
            ProcessStartInfo start = new ProcessStartInfo();
            start.FileName = @"..\..\..\..\Experiments\floatversion\Test\Release\Test.exe";// @"C:\Users\Michael Zhang\Desktop\HandGestureRecognition\Experiments\floatversion\Test\Release\Test.exe"; // Specify exe name.
            Console.WriteLine(" Read model file exe: {0}", Path.GetFullPath(start.FileName)); 
            start.UseShellExecute = false;// "..\\..\\..\\Data"
            start.RedirectStandardOutput = true;
            start.Arguments = "\"" + file_name  + "\"";   // "\"C:\\Users\\Michael Zhang\\Desktop\\HandGestureRecognition\\ColorGlove\\Data\\RF.demo.1000.800.1.model\"";
            Console.WriteLine(" Read model file: {0}", start.Arguments);
            //
            // Start the process.
            //
            using (Process process = Process.Start(start))
            {
                //
                // Read in all the text from the process with the StreamReader.
                //
                using (StreamReader reader = process.StandardOutput)
                {
                    string result = reader.ReadToEnd();
                    string[] parts = result.Split(' ');
                    int nvars = int.Parse(parts[0]);
                    int nclass = int.Parse(parts[1]);
                    int ntrees = int.Parse(parts[2]);
                    int bufsize = int.Parse(parts[3]);
                    int[] buf = new int[bufsize];
                    for (int i = 0; i < bufsize; i++)
                    {
                        buf[i] = int.Parse(parts[4 + i]);
                    }
                    decisionForest.nvars = nvars;
                    decisionForest.nclasses = nclass;
                    decisionForest.ntrees = ntrees;
                    decisionForest.bufsize = bufsize;
                    trees_int_ = buf;
                    Debug.WriteLine("Done in reading the file from a C++ program. bufsize: {0}", bufsize);
                    //Console.Write(result);

                }
            }
        }