<commit_before>package knub.master_thesis

import cc.mallet.topics.ParallelTopicModel
import cc.mallet.types.InstanceList

class TopicModel(args: Args) {

    def run(dataFolderName: String, stopWordsFileName: String): TopicModelResult = {
        val instances = new InstanceList(PreprocessingPipe.pipe(stopWordsFileName))
        instances.addThruPipe(new WikiPlainTextIterator(dataFolderName))

        val numTopics = args.numTopics
        // alpha = 1 / 100, 1 / 10
        // beta - dependend on vocabulary size
        // longer documents? not all documents
        val model = new ParallelTopicModel(numTopics, 1.0, 1.0 / args.numTopics)
        model.setOptimizeInterval(10)
        model.setBurninPeriod(100)
        model.addInstances(instances)
        model.setNumThreads(args.numThreads)
        model.setNumIterations(args.numIterations)
        model.showTopicsInterval = 0
        model.estimate()

        new TopicModelResult(model)
    }
}<commit_msg>Higher alpha for topic modelling<commit_after>package knub.master_thesis

import cc.mallet.topics.ParallelTopicModel
import cc.mallet.types.InstanceList

class TopicModel(args: Args) {

    def run(dataFolderName: String, stopWordsFileName: String): TopicModelResult = {
        val instances = new InstanceList(PreprocessingPipe.pipe(stopWordsFileName))
        instances.addThruPipe(new WikiPlainTextIterator(dataFolderName))

        val numTopics = args.numTopics
        // alpha = 1 / 100, 1 / 10
        // beta - dependend on vocabulary size
        // longer documents? not all documents
        val model = new ParallelTopicModel(numTopics, 256.0 / 100.0, 1.0 / args.numTopics)
        model.setOptimizeInterval(10)
        model.setBurninPeriod(100)
        model.addInstances(instances)
        model.setNumThreads(args.numThreads)
        model.setNumIterations(args.numIterations)
        model.showTopicsInterval = 0
        model.estimate()

        new TopicModelResult(model)
    }
}
{'fraction_non_alphanumeric': 0.08413583375570198, 'fraction_numerical': 0.02027369488089204, 'mean_word_length': 3.0869565217391304, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5323876', 'n_tokens_mistral': 629, 'n_tokens_neox': 584, 'n_words': 117}