private void buttonLoadModel_Click(object sender, EventArgs e)
        {
            if (modelFolderDialog.ShowDialog() == DialogResult.OK)
            {
                var path = modelFolderDialog.SelectedPath;
                Parameter = path.Import<Parameter>();
                LDAModel = path.Import<LDAModel>();
                ModelHelper.ImportVoca(path);

                UpdateTopicGridView();
            }
        }
        public void UpdateTopicModel(LDAModel model, Parameter parameter, int topWordCount = 5)
        {
            _ldaModel = model;
            _parameter = parameter;
            _topWordCount = topWordCount;

            var topicCount = _parameter.TopicCount;

            // extract top words from each topic
            _topicTopWordDist = new List<List<Tuple<int, double>>>(topicCount);
            foreach (var topicId in Enumerable.Range(0, _parameter.TopicCount))
            {
                _topicTopWordDist.Add(
                    model.Phi[topicId]
                        .Select((elem, idx) => new Tuple<int, double>(idx, elem))
                        .OrderByDescending(e => e.Item2)
                        .Take(_topWordCount)
                        .ToList());
            }

            // extract top word set
            _topWordSet = new HashSet<int>(_topicTopWordDist
                .SelectMany(e => e.Select(t => t.Item1))
                .Distinct()
                .OrderBy(e => e));

            // resize
            var startX = 160;
            var startY = 160;

            var len = 30;
            var width = len * (topicCount - 1);
            var height = len * (_topWordSet.Count - 1);

            var totalWidth = startX + width + 50;
            var totalHeight = startY + height + 50;

            Width = totalWidth;
            Height = totalHeight;
        }
 public LDA(Parameter parameters)
 {
     _parameter = parameters;
     _ldaModel = new LDAModel(_parameter);
 }