コード例 #1
0
 public void TrainNewModel(Corpora cor, CommandLineOption opt)
 {
     InitOption(opt);
     InitModel(cor);
     PrintModelInfo();
     GibbsSampling(niters);
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: kitescat/LDA_CGS
        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
ファイル: Program.cs プロジェクト: ehsan2022002/VirastarE
        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);
        }
コード例 #4
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;
     }
 }
コード例 #5
0
ファイル: frmLDA.cs プロジェクト: ehsan2022002/VirastarE
        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
ファイル: LDAGibbsSampling.cs プロジェクト: kitescat/LDA_CGS
 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
ファイル: Program.cs プロジェクト: kitescat/LDA_CGS
        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);
            }
        }