public void TrainNewModel(Corpora cor, CommandLineOption opt)
 {
     InitOption(opt);
     InitModel(cor);
     PrintModelInfo();
     GibbsSampling(niters);
 }
示例#2
0
        static private CommandLineOption GetDefaultOption()
        {
            CommandLineOption option = new CommandLineOption();

            option.alpha      = 0.1;
            option.beta       = 0.1;
            option.topics     = 10;
            option.savestep   = 100;
            option.niters     = 1000;
            option.twords     = 30;
            option.input      = @"C:\Users\yanghuaj\Workspace\LDAGibbs\LDA\bin\Release\testX.txt";
            option.outputfile = @"C:\Users\yanghuaj\Workspace\LDAGibbs\LDA\bin\Release\a";

            return(option);
        }
示例#3
0
        static private CommandLineOption GetDefaultOption()
        {
            CommandLineOption option = new CommandLineOption();

            option.alpha      = 0.1;
            option.beta       = 0.1;
            option.topics     = 1;
            option.savestep   = 100;
            option.niters     = 100;
            option.twords     = 30;
            option.input      = @"C:\download\dictionary\LDA_CGS-master\LDA_CGS-master\LDA2\ConsoleApplication1\ConsoleApplication1\bin\Debug\docs.dat";
            option.outputfile = @"C:\download\dictionary\LDA_CGS-master\LDA_CGS-master\LDA2\ConsoleApplication1\ConsoleApplication1\bin\Debug\out.txt";

            return(option);
        }
 public void InitOption(CommandLineOption opt)
 {
     try
     {
         K          = opt.Topics;
         alpha      = opt.Alpha;
         beta       = opt.Beta;
         savestep   = opt.Savestep;
         niters     = opt.Niters;
         outputfile = opt.Outputfile;
         twords     = opt.Twords;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#5
0
        private CommandLineOption GetDefaultOption()
        {
            var option = new CommandLineOption();


            option.Alpha    = double.Parse(txtalpha.Text);
            option.Beta     = double.Parse(txtbeta.Text);
            option.Topics   = int.Parse(txttopics.Text);
            option.Savestep = int.Parse(txtsavestep.Text);
            option.Niters   = int.Parse(txtniters.Text);
            option.Twords   = int.Parse(txttwords.Text);

            option.Input      = txtinput.Text;
            option.Outputfile = txtoutput.Text + @"\out.txt";

            return(option);
        }
示例#6
0
 public void InitOption(CommandLineOption opt)
 {
     try
     {
         K          = opt.topics;
         alpha      = opt.alpha;
         beta       = opt.beta;
         savestep   = opt.savestep;
         niters     = opt.niters;
         outputfile = opt.outputfile;
         twords     = opt.twords;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#7
0
        static void Main(string[] args)
        {
            CommandLineOption opt    = GetDefaultOption();
            Parser            parser = new Parser();
            var stopwatch            = new Stopwatch();

            try
            {
                parser.ParseArguments(args, opt);
                LDAGibbsSampling model = new LDAGibbsSampling();
                Corpora          cor   = new Corpora();
                cor.LoadDataFile(opt.input);
                model.TrainNewModel(cor, opt);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
                Console.WriteLine(ex.Message);
            }
        }