This notebook applies Latent Dirichlet Allocation on the word counts. By default the word count files are expected to be found in the folder Counts
. At the end of this notebook the topic model is written to the folder Topics
. We use the Latent Dirichlet Allocation implementation LatentDirichletAllocation from sklearn.decomposition
.
To illustrate the result we show the following:
Visualization are found in the next notebook.
This notebooks writes to and reads from your file system. Per default all used directory are within ~/TextData/Abgeordnetenwatch
, where ~
stands for whatever your operating system considers your home directory. To change this configuration either change the default values in the second next cell or edit LDA Spike - Configuration.ipynb and run it before you run this notebook.
This notebooks operates on word counts extracted from text files. In our case we retrieved these texts from www.abgeordnetenwatch.de guided by data that was made available under the Open Database License (ODbL) v1.0 at that site.
import time
import random as rnd
from operator import itemgetter
from pathlib import Path
import json
import joblib
import numpy as np
from scipy.sparse import csr_matrix
from sklearn.decomposition import LatentDirichletAllocation
%store -r own_configuration_was_read
if not('own_configuration_was_read' in globals()): raise Exception(
'\nReminder: You might want to run your configuration notebook before you run this notebook.' +
'\nIf you want to manage your configuration from each notebook, just remove this check.')
%store -r project_name
if not('project_name' in globals()): project_name = 'AbgeordnetenWatch'
%store -r text_data_dir
if not('text_data_dir' in globals()): text_data_dir = Path.home() / 'TextData'
corpus_dir = text_data_dir / project_name / 'Corpus'
counts_dir = text_data_dir / project_name / 'Counts'
topics_dir = text_data_dir / project_name / 'Topics'
assert corpus_dir.exists(), 'Directory should exist.'
assert corpus_dir.is_dir(), 'Directory should be a directory.'
assert next(corpus_dir.iterdir(), None) != None, 'Directory should not be empty.'
assert counts_dir.exists(), 'Directory should exist.'
assert counts_dir.is_dir(), 'Directory should be a directory.'
assert next(counts_dir.iterdir(), None) != None, 'Directory should not be empty.'
topics_dir.mkdir(parents=True, exist_ok=True) # Creates a local directory!
n_topics = 100
max_iter = 200
evaluate_every = 3 # -1 = never
verbosity_level = 1 # 0 = no output, 1 = iteration and perplexity, 2 = plus jobs and timing
n_jobs = 3
notebook_start_time = time.perf_counter()
The code in the next cell might look a bit tricky. Please ignore it unless you really want to understand this side aspect. It has nothing to do with LDA but with construction Compressed Sparse Row matrix.
load_start_time = time.perf_counter()
document_names = []
vocabulary = {}
next_doc_ptr = [0]
word_indices = []
counts = []
files = list(counts_dir.iterdir())
list.sort(files)
for source_file in files:
print('\rReading {:90.90}'.format(source_file.stem), end='')
document_names.append(source_file.stem)
doc_word_counts = json.loads(source_file.read_text())
for word, count in doc_word_counts.items():
word_idx = vocabulary.setdefault(word, len(vocabulary))
word_indices.append(word_idx)
counts.append(count)
next_doc_ptr.append(len(word_indices))
word_counts = csr_matrix((counts, word_indices, next_doc_ptr), dtype=np.int64)
words = [w for w, i in sorted(vocabulary.items(), key=itemgetter(1))]
load_end_time = time.perf_counter()
print('Loading the word counts from {:d} files took {:.2f}s.'.format(len(document_names), load_end_time - load_start_time))
Reading zaklin-nastic_die-linke_Q0008_2017-10-25_A01_2018-09-24_demokratie-und-bürgerrechte Loading the word counts from 7696 files took 4.15s.
We instantiate the LDA algorithm passing the configuration parameters. As the given text based does cover quite a lot topics (in the intuitve sense), we did indeed only get reasonable results after looking for at least 100 topics (in the sense of LDA). The results with batch learning were much better than with online learning, but we did not explore whether online learning could be rescued by parameter tuning. We search for the probabilities of the words within topics and the shares of the topics within the documents at the same time. "fit" without transform would do the same, but throw away the topic within document distribution. "transform" after a previous "fit" would find the topic shares without adapting the word in topic destribution. The latter would could even be used for previously unseen documents.
lda_start_time = time.perf_counter()
lda_algorithm = LatentDirichletAllocation(n_components = n_topics, learning_method='batch', max_iter = max_iter,
n_jobs=n_jobs, evaluate_every=evaluate_every, verbose=verbosity_level)
topic_model = lda_algorithm.fit_transform(word_counts)
lda_end_time = time.perf_counter()
print('Latent Dirichlet Allocation took {:.2f}s.'.format(lda_end_time - lda_start_time))
iteration: 1 of max_iter: 200 iteration: 2 of max_iter: 200 iteration: 3 of max_iter: 200, perplexity: 6834.2921 iteration: 4 of max_iter: 200 iteration: 5 of max_iter: 200 iteration: 6 of max_iter: 200, perplexity: 4896.6652 iteration: 7 of max_iter: 200 iteration: 8 of max_iter: 200 iteration: 9 of max_iter: 200, perplexity: 4277.6493 iteration: 10 of max_iter: 200 iteration: 11 of max_iter: 200 iteration: 12 of max_iter: 200, perplexity: 3989.7329 iteration: 13 of max_iter: 200 iteration: 14 of max_iter: 200 iteration: 15 of max_iter: 200, perplexity: 3831.3961 iteration: 16 of max_iter: 200 iteration: 17 of max_iter: 200 iteration: 58 of max_iter: 200 iteration: 59 of max_iter: 200 iteration: 60 of max_iter: 200, perplexity: 3454.9064 iteration: 61 of max_iter: 200 iteration: 62 of max_iter: 200 iteration: 63 of max_iter: 200, perplexity: 3451.2249 iteration: 64 of max_iter: 200 iteration: 65 of max_iter: 200 iteration: 66 of max_iter: 200, perplexity: 3448.3414 iteration: 67 of max_iter: 200 iteration: 68 of max_iter: 200 iteration: 69 of max_iter: 200, perplexity: 3445.0951 iteration: 70 of max_iter: 200 iteration: 71 of max_iter: 200 iteration: 72 of max_iter: 200, perplexity: 3441.4744 iteration: 73 of max_iter: 200 iteration: 74 of max_iter: 200 iteration: 75 of max_iter: 200, perplexity: 3438.3519 iteration: 76 of max_iter: 200 iteration: 77 of max_iter: 200 iteration: 78 of max_iter: 200, perplexity: 3435.3976 iteration: 79 of max_iter: 200 iteration: 80 of max_iter: 200 iteration: 81 of max_iter: 200, perplexity: 3433.3682 iteration: 82 of max_iter: 200 iteration: 83 of max_iter: 200 iteration: 84 of max_iter: 200, perplexity: 3430.9551 iteration: 85 of max_iter: 200 iteration: 86 of max_iter: 200 iteration: 87 of max_iter: 200, perplexity: 3429.1322 iteration: 88 of max_iter: 200 iteration: 89 of max_iter: 200 iteration: 90 of max_iter: 200, perplexity: 3427.2633 iteration: 91 of max_iter: 200 iteration: 92 of max_iter: 200 iteration: 93 of max_iter: 200, perplexity: 3425.4356 iteration: 94 of max_iter: 200 iteration: 95 of max_iter: 200 iteration: 96 of max_iter: 200, perplexity: 3423.8502 iteration: 97 of max_iter: 200 iteration: 98 of max_iter: 200 iteration: 99 of max_iter: 200, perplexity: 3422.5645 iteration: 100 of max_iter: 200 iteration: 101 of max_iter: 200 iteration: 102 of max_iter: 200, perplexity: 3421.8201 iteration: 103 of max_iter: 200 iteration: 104 of max_iter: 200 iteration: 105 of max_iter: 200, perplexity: 3420.5685 iteration: 106 of max_iter: 200 iteration: 107 of max_iter: 200 iteration: 108 of max_iter: 200, perplexity: 3419.7537 iteration: 109 of max_iter: 200 iteration: 110 of max_iter: 200 iteration: 111 of max_iter: 200, perplexity: 3418.9977 iteration: 112 of max_iter: 200 iteration: 113 of max_iter: 200 iteration: 114 of max_iter: 200, perplexity: 3418.0095 iteration: 115 of max_iter: 200 iteration: 116 of max_iter: 200 iteration: 117 of max_iter: 200, perplexity: 3417.3094 iteration: 118 of max_iter: 200 iteration: 119 of max_iter: 200 iteration: 120 of max_iter: 200, perplexity: 3416.3804 iteration: 121 of max_iter: 200 iteration: 122 of max_iter: 200 iteration: 123 of max_iter: 200, perplexity: 3415.5097 iteration: 124 of max_iter: 200 iteration: 125 of max_iter: 200 iteration: 126 of max_iter: 200, perplexity: 3415.1100 iteration: 127 of max_iter: 200 iteration: 128 of max_iter: 200 iteration: 129 of max_iter: 200, perplexity: 3414.1839 iteration: 130 of max_iter: 200 iteration: 131 of max_iter: 200 iteration: 132 of max_iter: 200, perplexity: 3413.2978 iteration: 133 of max_iter: 200 iteration: 134 of max_iter: 200 iteration: 135 of max_iter: 200, perplexity: 3412.5730 iteration: 136 of max_iter: 200 iteration: 137 of max_iter: 200 iteration: 138 of max_iter: 200, perplexity: 3411.8831 iteration: 139 of max_iter: 200 iteration: 140 of max_iter: 200 iteration: 141 of max_iter: 200, perplexity: 3411.4031 iteration: 142 of max_iter: 200 iteration: 143 of max_iter: 200 iteration: 144 of max_iter: 200, perplexity: 3411.0697 iteration: 145 of max_iter: 200 iteration: 146 of max_iter: 200 iteration: 147 of max_iter: 200, perplexity: 3410.9884 Latent Dirichlet Allocation took 445.14s.
print('The topic model has the shape {}.'.format(topic_model.shape))
print('corresponding to {} documents and {} topics.'.format(len(document_names), n_topics))
print('The rank of the matrix is {}.'.format(np.linalg.matrix_rank(topic_model)))
The topic model has the shape (7696, 100). corresponding to 7696 documents and 100 topics. The rank of the matrix is 100.
print('The probabilty distribution of words per topics has shape {}'.format(lda_algorithm.components_.shape))
The probabilty distribution of words per topics has shape (100, 19774)
show_max_words = 6
show_max_cummulated_probability = 0.15
topic_descriptions = []
words_per_topic = lda_algorithm.components_ / lda_algorithm.components_.sum(axis=1)[:, np.newaxis]
for topic in range(n_topics):
description = ''
print('\n{:2}: '.format(topic), end='')
most_probable = np.argsort(words_per_topic[topic, :])[:-show_max_words-1:-1]
probabilities = words_per_topic[topic, most_probable]
for word, probability, cummulated in zip(most_probable, probabilities, probabilities.cumsum()):
the_word = words[word]
description = description + the_word + ', '
print('{:.1%} {} '.format(probability, the_word), end = '')
if cummulated > show_max_cummulated_probability: break
description = description + '...'
topic_descriptions.append(description)
0: 8.3% EU 4.3% europäisch 3.3% europäische 1: 2.1% Energie 1.6% Deutschland 1.1% Klimaschutz 1.1% Energiewende 1.1% wollen 0.9% müssen 2: 5.8% Cannabis 1.9% Konsum 1.9% Legalisierung 1.3% Droge 1.1% Jugendliche 0.9% Bundestag 3: 3.3% Ehe 1.6% Frage 1.3% Mensch 0.7% Jahr 0.7% Gesellschaft 0.7% Diskriminierung 4: 5.9% AfD 5.2% Frage 1.8% Antwort 1.2% Partei 1.2% stellen 5: 4.2% Migration 2.8% Pakt 2.1% Deutschland 1.5% Migrationspakt 1.2% Staat 1.2% Migranten 6: 4.8% Cum 3.1% Ex 1.4% Geschäft 1.3% Banken 1.2% Skandal 1.1% Staatsanwaltschaft 7: 2.7% Maut 2.3% spdfraktion 1.3% geben 1.1% deutsch 1.0% SPD 0.8% Datum 8: 4.8% Rente 2.3% Rentenversicherung 2.0% alt 1.9% gesetzlich 1.8% Beitrag 1.6% gesetzliche 9: 1.7% Wolf 1.3% Deutschland 1.0% Rückkehr 0.9% gelten 0.9% Leistung 0.9% Wolfes 10: 2.0% Hartz 1.5% Leistung 1.3% Sozialleistungen 1.2% Bürgergeld 1.2% IV 1.1% Mensch 11: 5.1% Bundeswehr 2.1% Einsatz 2.0% NATO 2.0% Soldat 1.6% Sicherheit 1.3% Jahr 12: 3.4% Demokratie 2.0% bürgern 1.6% Politik 1.5% Volksentscheid 1.5% Frage 1.4% Entscheidung 13: 6.2% Grundeinkommen 4.1% bedingungslos 2.2% Frau 2.2% BGE 2.0% Frage 14: 3.6% Polizei 2.6% Straftat 2.2% Sicherheit 1.6% muss 1.5% Rechtsstaat 1.2% müssen 15: 2.9% Russland 1.3% Ukraine 1.2% Deutschland 1.1% Israel 1.0% Regierung 1.0% Staat 16: 2.3% Frage 2.1% Fall 2.0% Beispiel 1.9% geben 1.8% halte 1.6% zum 17: 5.2% Bundestag 3.1% Fraktion 1.9% deutsche 1.6% Gesetz 1.5% Antrag 1.5% Jahr 18: 2.2% Inhalt 1.4% Medium 1.3% Aussage 1.3% Äußerung 0.9% Meinung 0.9% Kritik 19: 1.0% geben 1.0% Krankheit 0.9% Therapie 0.9% sexuell 0.8% Homosexualität 0.7% Bargeld 20: 2.8% Bildung 2.2% Schule 1.8% gut 1.7% Land 1.3% wollen 1.0% müssen 21: 1.7% Deutschland 1.3% Bundesregierung 1.2% Rüstungsexporte 0.9% Waffe 0.9% Export 0.9% Land 22: 2.6% erhalten 2.5% Direktzahlungen 2.1% Betrieb 1.8% Säule 1.7% Schafhalter 1.6% Schäfer 23: 4.1% Mensch 2.1% wollen 1.5% gut 1.4% brauchen 1.3% müssen 1.1% Frage 24: 1.7% Seehofer 1.5% Regierung 1.5% Schacht 1.5% geben 1.4% Spanien 1.0% spanisch 25: 1.8% Scholz 1.5% Olaf 1.5% Griechenland 1.3% Bundesfinanzminister 1.1% Cum 0.9% gut 26: 2.8% wollen 1.6% muss 1.3% Transparenz 1.3% müssen 1.1% Unternehmen 1.1% Lobbyregister 27: 4.3% Einkommen 3.7% wollen 1.9% mittler 1.6% Prozent 1.5% entlasten 1.4% Steuer 28: 4.0% Frage 2.5% Anfrage 2.4% de 2.4% politisch 2.4% Website 2.3% informieren 29: 1.6% Jahr 1.4% Fristverlängerung 1.4% SPD 1.3% Deutschland 1.0% schaffen 1.0% Alternative 30: 2.3% Deutschland 1.8% Integration 1.7% wollen 1.6% Mensch 1.2% gut 1.0% deutsch 31: 3.9% Deutschland 2.5% Atomwaffen 1.6% Welt 1.6% Abrüstung 1.3% US 1.1% nuklear 32: 7.0% Partei 2.3% politisch 1.4% Spende 1.3% Obergrenze 1.2% Parteienfinanzierung 1.1% absolut 33: 1.5% Frage 1.5% geben 1.1% gut 0.8% Jahr 0.7% stellen 0.7% mögen 34: 3.9% Bayer 3.1% Baukindergeld 2.6% Familie 1.9% Jahr 1.3% bayerische 1.3% Wohneigentum 35: 1.0% geben 0.9% Deutschland 0.8% Frage 0.8% Staat 0.8% muss 0.8% Statistik 36: 1.0% Regelung 0.9% Datum 0.7% BKA 0.7% Hinblick 0.7% Möglichkeit 0.7% SPD 37: 1.2% Doppelverbeitragung 1.1% Fall 1.0% Betriebsrenten 1.0% GKV 0.9% Immunität 0.8% Versorgungsbezüge 38: 2.0% öffentlich 1.3% Rundfunk 1.2% Frage 1.0% rechtlichen 0.8% Gienger 0.7% sollen 39: 16.4% de 40: 3.8% Hebammen 1.7% Versorgung 1.4% Geburtshilfe 1.4% Geburt 1.3% GKV 0.8% Jahr 41: 6.8% Euro 4.8% Jahr 3.0% Milliarde 2.2% Million 42: 2.7% Türkei 1.5% Syrien 1.2% Deutschland 1.0% müssen 1.0% muss 0.9% deutsch 43: 1.7% Verordnung 1.4% genannt 1.2% Transport 1.0% so 0.8% Antibiotika 0.7% handeln 44: 3.4% Frage 2.6% persönlich 2.3% Gespräch 1.8% finden 1.8% Termin 1.7% Büro 45: 1.7% Jahr 1.4% hoch 1.2% Österreich 1.0% Rente 0.9% geben 0.9% Rentner 46: 2.7% Jahr 2.2% Rente 1.8% Verbesserung 1.8% Erwerbsminderungsrente 1.1% gelten 1.1% beziehen 47: 2.0% Richtlinie 1.5% Unternehmen 1.1% Transparenz 1.0% Country 1.0% Tempolimit 0.9% Verbot 48: 5.2% Kontakt 4.5% Mail 4.3% direkt 4.0% de 49: 1.7% müssen 1.1% Lösung 1.0% Hochschule 0.9% Frage 0.9% muss 0.9% mitteln 50: 2.8% Regelung 2.6% Art 2.3% Artikel 2.3% Abs 2.1% Gesetz 1.9% GG 51: 2.9% Diesel 1.9% Fahrzeug 1.5% Hersteller 1.5% müssen 1.3% Grenzwert 1.3% muss 52: 1.2% offen 1.0% Software 0.9% digitale 0.9% öffentlich 0.9% Verwaltung 0.8% Open 53: 2.3% Kindertagespflege 1.8% wollen 1.7% Bund 1.3% gut 1.2% Qualität 1.2% Land 54: 3.0% Pflege 2.5% gut 1.4% Krankenhäuser 1.3% Pflegekräfte 1.2% Vergütung 1.1% Versorgung 55: 2.8% Leiharbeit 1.8% gleich 1.6% Monat 1.3% Werkverträgen 1.1% Zeitarbeit 1.0% Missbrauch 56: 3.2% Berlin 1.6% Libyen 1.1% Tegel 1.0% rot 1.0% Afrika 0.9% Mensch 57: 1.4% Untersuchungsausschuss 1.1% müssen 1.1% Cum 1.0% Ex 1.0% rechtswidrig 0.9% Dietmar 58: 5.2% Amt 2.5% auswärtige 1.5% Frage 1.3% tagen 1.3% mögen 1.1% bedanken 59: 5.0% bundestag 4.0% grün 3.6% dip21 3.4% de 60: 1.6% Ausbau 1.4% Mobilität 1.3% wollen 1.3% Stadt 1.2% ÖPNV 1.1% gut 61: 2.5% CETA 1.7% EU 1.5% Abkomme 1.3% Freihandelsabkommen 1.1% öffentlich 1.0% Verhandlung 62: 10.1% Frau 3.9% Mann 1.0% Gewalt 63: 1.5% Waffe 1.3% muss 1.2% Jahr 1.1% öffentlich 0.8% Waffenrecht 0.6% Standard 64: 2.0% Tier 1.5% Jahr 1.4% Ferkelkastration 1.3% Tierschutz 1.2% Deutschland 1.1% betäubungslosen 65: 2.5% Bundesminister 2.5% Schmidt 1.7% Landwirtschaft 1.5% Ernährung 1.5% Christian 1.4% Glyphosat 66: 6.4% Demokrat 4.9% frei 4.1% freie 67: 6.8% Bundestag 4.0% Abgeordnete 3.2% deutsche 2.6% Mitglied 68: 1.3% wollen 1.2% muss 0.7% Journalist 0.7% müssen 0.6% gut 0.6% ander 69: 2.2% Organspende 2.1% Widerspruchslösung 1.4% Mensch 1.3% Deutschland 1.2% zahlen 1.2% Organspenden 70: 5.7% zuständig 2.7% anfragen 2.6% Thema 2.1% Frage 2.0% Bundesministerium 71: 3.2% Wohnung 2.5% Wohnraum 1.9% sozial 1.9% Mieter 1.8% wollen 1.8% bezahlbar 72: 3.5% Bürgerin 3.0% Bürger 2.0% bürgern 2.0% Abgeordnete 1.5% Wahlkreis 1.4% Gespräch 73: 4.9% Kirche 1.6% erheben 1.5% Kirchensteuer 1.2% Staat 1.0% Frage 0.9% lehne 74: 2.9% Baden 2.4% Württemberg 1.7% EZB 1.6% Deutschland 1.4% Stuttgart 1.0% Zentralbank 75: 8.5% spielen 8.4% rollen 76: 2.9% Glyphosat 1.5% Anwendung 1.3% wissenschaftlich 1.2% Zulassung 1.0% Pflanzenschutzmitteln 1.0% EU 77: 6.4% de 3.9% anfragen 3.6% direkt 2.9% Mail 78: 1.8% Tat 1.0% Geheimdienst 1.0% entziehen 0.9% LINKE 0.8% öffentlich 0.8% bewegen 79: 2.2% Gesellschaft 1.2% Ziegenhalter 1.2% fördern 1.1% mögen 1.1% müssen 1.1% groß 80: 1.6% Verbot 1.0% setzen 0.9% Frage 0.8% möglich 0.8% Waffe 0.7% umgehen 81: 2.3% Patient 1.9% Krankenkasse 1.8% Arzt 1.4% Versorgung 1.2% medizinisch 1.2% Patientin 82: 1.9% Afghanistan 1.9% Nation 1.6% vereinte 1.5% Sicherheit 1.5% IS 1.1% Rahmen 83: 3.5% Flüchtling 1.9% Mensch 1.8% Land 1.6% Deutschland 1.1% müssen 1.0% Jahr 84: 1.0% Diät 1.0% Frage 0.9% Erhöhung 0.8% sollen 0.8% geben 0.8% Jahr 85: 1.6% Jahr 1.3% SPD 1.3% Alternative 1.2% Bundestagsfraktion 0.9% möglich 0.9% CDU 86: 1.5% gemeinsam 1.3% sorgen 1.2% Kind 1.2% Vater 1.1% Gericht 1.0% Gesetz 87: 2.7% hambacher 2.2% Forst 2.1% Wald 2.1% Landesregierung 1.9% NRW 1.5% RWE 88: 2.3% Schleswig 2.1% LNG 2.0% Holstein 1.1% Frage 1.0% Projekt 0.9% deutsch 89: 1.8% Landwirtschaft 1.6% wollen 1.2% ökologisch 1.1% Tier 1.1% gut 1.0% Produkt 90: 2.7% Saudi 2.6% Jemen 2.4% Arabien 2.0% Bundesregierung 0.9% deutsch 0.7% Rüstungsexporte 91: 1.2% Jahr 1.0% Medikament 0.8% Deutschland 0.7% Bundesregierung 0.7% muss 0.6% Entscheidung 92: 1.9% Deutschland 1.1% anfragen 0.8% finden 0.8% klein 0.6% müssen 0.6% Problem 93: 2.0% gut 1.9% Arbeit 1.5% Mensch 1.2% Arbeitnehmer 1.2% Mindestlohn 1.2% wollen 94: 2.4% wollen 1.1% Deutschland 1.1% Kommission 0.7% Steuervermeidung 0.7% Vorschlag 0.7% Steuer 95: 2.8% Kommune 1.7% Bund 1.7% Land 1.4% Mensch 1.0% Frage 1.0% kommunal 96: 1.9% Flughafen 1.0% Uhr 0.9% Fluglärm 0.7% Flugzeug 0.7% Region 0.7% Anwohner 97: 2.5% innen 2.0% Frage 1.5% grüßen 1.2% Katja 1.2% freundlich 1.0% Recht 98: 8.5% Kind 4.6% Familie 3.1% Eltern 99: 8.0% SPD 4.2% CDU 3.4% CSU
show_max_topics = 7
show_max_cummulated_probability = 0.75
sample_documents = rnd.sample(range(len(document_names)), 5)
for doc in sample_documents:
print('\n', document_names[doc], '\n')
most_probable = np.argsort(topic_model[doc, :])[:-show_max_topics-1:-1]
cummulated = 0
for topic in most_probable:
probability = topic_model[doc, topic]
print('{:6.2%} {:2} {}'.format(probability, topic, topic_descriptions[topic]))
cummulated = cummulated + probability
if cummulated > show_max_cummulated_probability: break
andrea-nahles_spd_Q0171_2018-03-27_A01_2018-05-02_kinder-und-jugend 56.55% 11 Bundeswehr, Einsatz, NATO, Soldat, Sicherheit, Jahr, ... 34.14% 39 de, ... dr-matthias-miersch_spd_Q0015_2018-03-13_A01_2018-03-23_demokratie-und-bürgerrechte 22.14% 99 SPD, CDU, CSU, ... 19.78% 44 Frage, persönlich, Gespräch, finden, Termin, Büro, ... 13.40% 23 Mensch, wollen, gut, brauchen, müssen, Frage, ... 11.15% 18 Inhalt, Medium, Aussage, Äußerung, Meinung, Kritik, ... 11.02% 17 Bundestag, Fraktion, deutsche, Gesetz, Antrag, Jahr, ... manuel-sarrazin_die-grünen_Q0002_2017-08-12_A01_2017-08-18_arbeit 47.80% 65 Bundesminister, Schmidt, Landwirtschaft, Ernährung, Christian, Glyphosat, ... 18.52% 89 Landwirtschaft, wollen, ökologisch, Tier, gut, Produkt, ... 17.28% 59 bundestag, grün, dip21, de, ... marc-biadacz_cdu_Q0009_2018-09-04_A01_2018-09-05_demokratie-und-bürgerrechte 21.41% 77 de, anfragen, direkt, Mail, ... 21.37% 72 Bürgerin, Bürger, bürgern, Abgeordnete, Wahlkreis, Gespräch, ... 20.78% 67 Bundestag, Abgeordnete, deutsche, Mitglied, ... 20.51% 61 CETA, EU, Abkomme, Freihandelsabkommen, öffentlich, Verhandlung, ... stephan-brandner_afd_Q0032_2018-05-29_A01_2018-05-29_familie 58.05% 4 AfD, Frage, Antwort, Partei, stellen, ... 27.95% 44 Frage, persönlich, Gespräch, finden, Termin, Büro, ...
show_max_documents = 20
show_min_probability = 0.75
sample_topics = rnd.sample(range(n_topics), 5)
list.sort(sample_topics)
for topic in sample_topics:
print('{:2} {}'.format(topic, topic_descriptions[topic]))
most_focussed = np.argsort(topic_model[:, topic])[:-show_max_documents-1:-1]
most_focussed = [doc for doc in most_focussed if topic_model[doc, topic] >= show_min_probability]
if not most_focussed:
print(' The topic contributes to no document {:.0%} or more.'.format(show_min_probability))
continue
for doc in most_focussed:
probability = topic_model[doc, topic]
name, party, _, _, _, date, category = document_names[doc].split('_')
print(' {:6.2%} {} {:24} {:12} {}'.format(probability, date, name, party, category))
6 Cum, Ex, Geschäft, Banken, Skandal, Staatsanwaltschaft, ... 99.23% 2018-11-27 soren-bartol spd finanzen 99.12% 2018-11-28 stefan-schwartze spd demokratie-und-bürgerrechte 93.71% 2017-09-11 wolfgang-kubicki fdp demokratie-und-bürgerrechte 93.37% 2017-09-11 wolfgang-kubicki fdp demokratie-und-bürgerrechte 89.74% 2018-12-03 lars-klingbeil spd demokratie-und-bürgerrechte 86.07% 2018-11-13 annalena-baerbock die-grünen demokratie-und-bürgerrechte 82.22% 2018-11-14 margit-stumpp die-grünen finanzen 81.20% 2018-12-12 nicole-westig fdp demokratie-und-bürgerrechte 80.38% 2018-06-05 dr-katarina-barley spd verbraucherschutz 78.74% 2018-11-13 claudia-muller die-grünen finanzen 61 CETA, EU, Abkomme, Freihandelsabkommen, öffentlich, Verhandlung, ... 99.11% 2018-11-22 stefan-sauer cdu demokratie-und-bürgerrechte 97.95% 2018-07-10 eva-hogl spd soziales 94.18% 2018-11-14 andrea-nahles spd demokratie-und-bürgerrechte 94.18% 2018-11-14 andrea-nahles spd demokratie-und-bürgerrechte 91.94% 2018-11-27 heike-baehrens spd wirtschaft 89.09% 2018-11-13 roderich-kiesewetter cdu demokratie-und-bürgerrechte 83.13% 2017-09-18 rudolf-henke cdu gesundheit 76.70% 2018-01-19 heike-brehmer cdu demokratie-und-bürgerrechte 76.52% 2018-02-06 tino-sorge cdu demokratie-und-bürgerrechte 75 spielen, rollen, ... 98.38% 2018-08-31 katja-dorner die-grünen internationales 97.80% 2018-11-29 dr-gregor-gysi die-linke inneres-und-justiz 90.44% 2018-02-28 dr-katarina-barley spd soziales 78.85% 2017-11-16 danyal-bayaz die-grünen internationales 78.85% 2017-11-08 oliver-krischer die-grünen internationales 78.85% 2017-11-09 katharina-droge die-grünen internationales 76.76% 2017-12-01 ingrid-nestle die-grünen internationales 78 Tat, Geheimdienst, entziehen, LINKE, öffentlich, bewegen, ... 99.02% 2018-11-06 niema-movassat die-linke inneres-und-justiz 97.89% 2018-11-07 dr-gregor-gysi die-linke soziales 87.72% 2017-09-19 nadine-schon cdu verkehr-und-infrastruktur 86.68% 2018-11-13 karsten-moring cdu arbeit 85.94% 2017-09-18 dr-carola-reimann spd finanzen 75.43% 2017-09-21 astrid-mannes cdu sicherheit 80 Verbot, setzen, Frage, möglich, Waffe, umgehen, ... 99.27% 2017-08-21 gustav-herzog spd internationales 98.26% 2017-10-04 wolfgang-kubicki fdp demokratie-und-bürgerrechte 96.26% 2017-09-22 wolfgang-kubicki fdp demokratie-und-bürgerrechte
show_max_documents = 3
show_min_probability = 0.9
sample_topics = rnd.sample(range(n_topics), 5)
rest = []
def url_for_answer(document_name):
name, party, q, date, _, _, category = document_names[doc].split('_')
url_file = corpus_dir / ('_'.join([name, party, q, date, category]) + '.url')
try:
return url_file.read_text()
except:
return 'URL not found'
for topic in range(n_topics):
most_focussed = np.argsort(topic_model[:, topic])[:-show_max_documents-1:-1]
most_focussed = [doc for doc in most_focussed if topic_model[doc, topic] > show_min_probability]
if not most_focussed:
rest.append(topic)
continue
print('{:2} {}'.format(topic, topic_descriptions[topic]))
for doc in most_focussed:
probability = topic_model[doc, topic]
name, party, _, _, _, date, category = document_names[doc].split('_')
print(' {:6.2%} {} {:24} {:12} {}'.format(probability, date, name, party, category))
print(10 * ' ', url_for_answer(document_names[doc]))
print('\nTopics that never contribute to a document upto {:.0%}:'.format(show_min_probability))
for topic in rest:
print('{:2} {}'.format(topic, topic_descriptions[topic]))
1 Energie, Deutschland, Klimaschutz, Energiewende, wollen, müssen, ... 99.10% 2017-08-11 peter-bleser cdu wirtschaft https://www.abgeordnetenwatch.de/profile/peter-bleser/question/2017-08-11/283319 97.31% 2018-12-04 dr-frank-steffel cdu umwelt https://www.abgeordnetenwatch.de/profile/dr-frank-steffel/question/2018-11-28/307583 90.75% 2018-12-22 markus-uhl cdu umwelt https://www.abgeordnetenwatch.de/profile/markus-uhl/question/2018-12-17/308278 2 Cannabis, Konsum, Legalisierung, Droge, Jugendliche, Bundestag, ... 99.27% 2018-01-16 sybille-benning cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/sybille-benning/question/2017-12-21/295618 99.25% 2018-03-22 volkmar-klein cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/volkmar-klein/question/2018-03-18/297709 99.25% 2017-11-28 gunter-krings cdu gesundheit https://www.abgeordnetenwatch.de/profile/gunter-krings/question/2017-11-20/294670 4 AfD, Frage, Antwort, Partei, stellen, ... 91.75% 2018-12-20 florian-post spd bildung-und-forschung https://www.abgeordnetenwatch.de/profile/florian-post/question/2018-12-09/307886 91.71% 2018-02-15 michael-roth spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/michael-roth/question/2018-01-21/296378 90.81% 2018-02-15 michael-roth spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/michael-roth/question/2018-01-20/296360 5 Migration, Pakt, Deutschland, Migrationspakt, Staat, Migranten, ... 99.42% 2018-11-16 andrea-lindholz csu internationales https://www.abgeordnetenwatch.de/profile/andrea-lindholz/question/2018-11-07/306354 99.32% 2018-11-30 hansjorg-durz csu internationales https://www.abgeordnetenwatch.de/profile/hansjorg-durz/question/2018-10-31/306056 99.29% 2018-12-13 christian-lindner fdp integration https://www.abgeordnetenwatch.de/profile/christian-lindner/question/2018-11-29/307639 6 Cum, Ex, Geschäft, Banken, Skandal, Staatsanwaltschaft, ... 99.23% 2018-11-27 soren-bartol spd finanzen https://www.abgeordnetenwatch.de/profile/soren-bartol/question/2018-11-10/306581 99.12% 2018-11-28 stefan-schwartze spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/stefan-schwartze/question/2018-11-10/306609 93.71% 2017-09-11 wolfgang-kubicki fdp demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/wolfgang-kubicki/question/2017-09-10/290188 7 Maut, spdfraktion, geben, deutsch, SPD, Datum, ... 91.00% 2017-09-18 mathias-stein spd arbeit https://www.abgeordnetenwatch.de/profile/mathias-stein/question/2017-09-17/291687 8 Rente, Rentenversicherung, alt, gesetzlich, Beitrag, gesetzliche, ... 99.27% 2018-12-18 markus-kurth die-grünen soziales https://www.abgeordnetenwatch.de/profile/markus-kurth/question/2018-11-11/306719 99.27% 2018-12-18 corinna-ruffer die-grünen soziales https://www.abgeordnetenwatch.de/profile/corinna-ruffer/question/2018-11-11/306723 99.12% 2019-01-02 annalena-baerbock die-grünen senioren https://www.abgeordnetenwatch.de/profile/annalena-baerbock/question/2018-12-21/308488 9 Wolf, Deutschland, Rückkehr, gelten, Leistung, Wolfes, ... 91.23% 2018-06-27 frank-schaffler fdp land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/frank-schaffler/question/2018-06-26/299943 90.93% 2017-09-13 pascal-meiser die-linke inneres-und-justiz https://www.abgeordnetenwatch.de/profile/pascal-meiser/question/2017-08-20/284621 10 Hartz, Leistung, Sozialleistungen, Bürgergeld, IV, Mensch, ... 99.24% 2018-05-23 bernd-reuther fdp arbeit https://www.abgeordnetenwatch.de/profile/bernd-reuther/question/2018-05-21/298791 99.21% 2017-09-21 michael-theurer fdp soziales https://www.abgeordnetenwatch.de/profile/michael-theurer/question/2017-08-31/288102 97.39% 2017-08-25 manja-schule spd soziales https://www.abgeordnetenwatch.de/profile/manja-schule/question/2017-08-21/285530 12 Demokratie, bürgern, Politik, Volksentscheid, Frage, Entscheidung, ... 98.20% 2017-09-05 prof-dr-heribert-hirte cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/prof-dr-iur-heribert-hirte/question/2017-08-27/287085 97.29% 2017-09-01 johannes-kahrs spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/johannes-kahrs/question/2017-07-29/279513 96.91% 2017-08-27 elisabeth-kaiser spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/elisabeth-kaiser/question/2017-08-23/286475 16 Frage, Fall, Beispiel, geben, halte, zum, ... 98.85% 2017-11-10 ralph-brinkhaus cdu wirtschaft https://www.abgeordnetenwatch.de/profile/ralph-brinkhaus/question/2017-11-07/294459 17 Bundestag, Fraktion, deutsche, Gesetz, Antrag, Jahr, ... 91.37% 2017-09-13 alois-rainer csu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/alois-rainer/question/2017-09-08/289871 18 Inhalt, Medium, Aussage, Äußerung, Meinung, Kritik, ... 99.03% 2018-07-02 dr-katarina-barley spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/dr-katarina-barley/question/2018-05-14/298658 98.07% 2018-01-17 marcus-held spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/marcus-held/question/2018-01-15/296229 19 geben, Krankheit, Therapie, sexuell, Homosexualität, Bargeld, ... 98.62% 2017-09-11 dr-johannes-fechner spd finanzen https://www.abgeordnetenwatch.de/profile/dr-johannes-fechner/question/2017-09-07/289724 21 Deutschland, Bundesregierung, Rüstungsexporte, Waffe, Export, Land, ... 99.40% 2017-09-08 lothar-riebsamen cdu wirtschaft https://www.abgeordnetenwatch.de/profile/lothar-riebsamen/question/2017-09-05/289081 99.26% 2017-09-22 olav-gutting cdu internationales https://www.abgeordnetenwatch.de/profile/olav-gutting/question/2017-09-11/290519 98.95% 2017-09-23 thorsten-frei cdu internationales https://www.abgeordnetenwatch.de/profile/thorsten-frei/question/2017-09-22/293254 22 erhalten, Direktzahlungen, Betrieb, Säule, Schafhalter, Schäfer, ... 99.72% 2018-07-04 eckhard-pols cdu land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/eckhard-pols/question/2018-06-18/299616 99.70% 2018-06-26 klaus-dieter-grohler cdu arbeit https://www.abgeordnetenwatch.de/profile/klaus-dieter-grohler/question/2018-06-25/299906 99.66% 2018-07-09 dr-stephan-harbarth cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/dr-stephan-harbarth/question/2018-06-18/299673 24 Seehofer, Regierung, Schacht, geben, Spanien, spanisch, ... 99.01% 2018-07-30 norbert-barthle cdu land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/norbert-barthle/question/2018-06-13/299412 99.01% 2018-08-01 sybille-benning cdu land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/sybille-benning/question/2018-06-13/299417 97.70% 2018-10-09 dr-anton-hofreiter die-grünen integration https://www.abgeordnetenwatch.de/profile/dr-anton-hofreiter/question/2018-09-06/302409 25 Scholz, Olaf, Griechenland, Bundesfinanzminister, Cum, gut, ... 99.42% 2018-11-22 dr-fritz-felgentreu spd finanzen https://www.abgeordnetenwatch.de/profile/dr-fritz-felgentreu/question/2018-11-12/306855 91.45% 2018-11-26 dr-fritz-felgentreu spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/dr-fritz-felgentreu/question/2018-11-09/306495 91.45% 2018-12-19 dr-fritz-felgentreu spd finanzen https://www.abgeordnetenwatch.de/profile/dr-fritz-felgentreu/question/2018-11-17/307084 27 Einkommen, wollen, mittler, Prozent, entlasten, Steuer, ... 99.15% 2017-09-23 christine-lambrecht spd soziales https://www.abgeordnetenwatch.de/profile/christine-lambrecht/question/2017-09-21/293089 97.89% 2017-08-17 sven-lehmann die-grünen finanzen https://www.abgeordnetenwatch.de/profile/sven-lehmann/question/2017-08-02/281693 28 Frage, Anfrage, de, politisch, Website, informieren, ... 98.70% 2017-08-24 hermann-grohe cdu gesundheit https://www.abgeordnetenwatch.de/profile/hermann-grohe/question/2017-08-21/285293 98.66% 2017-12-01 hermann-grohe cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/hermann-grohe/question/2017-11-28/294967 98.62% 2017-09-15 hermann-grohe cdu verbraucherschutz https://www.abgeordnetenwatch.de/profile/hermann-grohe/question/2017-09-14/291089 29 Jahr, Fristverlängerung, SPD, Deutschland, schaffen, Alternative, ... 99.67% 2019-01-11 hubertus-heil spd land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/hubertus-heil/question/2018-12-21/308473 99.67% 2019-01-07 ingrid-arndt-brauer spd land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/ingrid-arndt-brauer/question/2018-12-20/308411 99.67% 2018-12-21 rainer-spiering spd land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/rainer-spiering/question/2018-12-19/308365 30 Deutschland, Integration, wollen, Mensch, gut, deutsch, ... 98.50% 2017-08-30 christoph-bernstiel cdu integration https://www.abgeordnetenwatch.de/profile/christoph-bernstiel/question/2017-08-21/285215 93.78% 2017-09-19 jens-beeck fdp integration https://www.abgeordnetenwatch.de/profile/jens-beeck/question/2017-09-17/291870 31 Deutschland, Atomwaffen, Welt, Abrüstung, US, nuklear, ... 99.53% 2017-09-22 dirk-vopel spd sicherheit https://www.abgeordnetenwatch.de/profile/dirk-vopel/question/2017-09-04/288926 99.24% 2017-09-20 christine-lambrecht spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/christine-lambrecht/question/2017-09-10/290288 94.16% 2018-06-28 sarah-ryglewski spd internationales https://www.abgeordnetenwatch.de/profile/sarah-ryglewski/question/2018-04-02/297985 32 Partei, politisch, Spende, Obergrenze, Parteienfinanzierung, absolut, ... 99.69% 2018-06-18 stefan-schwartze spd finanzen https://www.abgeordnetenwatch.de/profile/stefan-schwartze/question/2018-06-16/299536 99.68% 2018-06-14 burkhard-lischka spd inneres-und-justiz https://www.abgeordnetenwatch.de/profile/burkhard-lischka/question/2018-06-08/299269 99.68% 2018-06-15 mahmut-ozdemir spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/mahmut-ozdemir/question/2018-06-15/299500 33 Frage, geben, gut, Jahr, stellen, mögen, ... 93.36% 2017-11-02 nikolas-lobel cdu finanzen https://www.abgeordnetenwatch.de/profile/nikolas-lobel/question/2017-10-25/294230 34 Bayer, Baukindergeld, Familie, Jahr, bayerische, Wohneigentum, ... 99.51% 2018-10-04 artur-auernhammer csu umwelt https://www.abgeordnetenwatch.de/profile/artur-auernhammer/question/2018-09-14/302913 99.24% 2018-07-06 kai-wegner cdu familie https://www.abgeordnetenwatch.de/profile/kai-wegner/question/2018-06-23/299851 95.05% 2018-06-28 bernhard-daldrup spd familie https://www.abgeordnetenwatch.de/profile/bernhard-daldrup/question/2018-06-23/299846 35 geben, Deutschland, Frage, Staat, muss, Statistik, ... 99.27% 2017-09-08 chris-kuhn die-grünen gesundheit https://www.abgeordnetenwatch.de/profile/chris-kuhn/question/2017-09-01/288272 98.06% 2018-09-11 christian-hirte cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/christian-hirte/question/2018-09-06/302443 37 Doppelverbeitragung, Fall, Betriebsrenten, GKV, Immunität, Versorgungsbezüge, ... 98.26% 2018-11-22 andrea-nahles spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/andrea-nahles/question/2018-11-10/306608 98.26% 2018-11-22 andrea-nahles spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/andrea-nahles/question/2018-11-10/306592 98.26% 2018-11-22 andrea-nahles spd finanzen https://www.abgeordnetenwatch.de/profile/andrea-nahles/question/2018-10-21/305673 38 öffentlich, Rundfunk, Frage, rechtlichen, Gienger, sollen, ... 92.56% 2017-08-30 eva-hogl spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/eva-hogl/question/2017-08-28/287406 39 de, ... 97.17% 2018-11-12 alexander-graf-lambsdorff fdp demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/alexander-graf-lambsdorff/question/2018-11-11/306745 97.17% 2018-11-12 alexander-graf-lambsdorff fdp demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/alexander-graf-lambsdorff/question/2018-11-12/306827 97.17% 2018-11-12 alexander-graf-lambsdorff fdp demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/alexander-graf-lambsdorff/question/2018-11-11/306749 40 Hebammen, Versorgung, Geburtshilfe, Geburt, GKV, Jahr, ... 99.72% 2017-08-07 arno-klare spd gesundheit https://www.abgeordnetenwatch.de/profile/arno-klare/question/2017-07-26/279374 42 Türkei, Syrien, Deutschland, müssen, muss, deutsch, ... 99.31% 2017-09-19 ulrike-bahr spd internationales https://www.abgeordnetenwatch.de/profile/ulrike-bahr/question/2017-09-15/291463 92.79% 2017-09-18 svenja-stadler spd internationales https://www.abgeordnetenwatch.de/profile/svenja-stadler/question/2017-09-10/290201 90.92% 2018-03-23 michael-hennrich cdu internationales https://www.abgeordnetenwatch.de/profile/michael-hennrich/question/2018-03-16/297669 44 Frage, persönlich, Gespräch, finden, Termin, Büro, ... 99.18% 2017-11-17 stephan-albani cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/stephan-albani/question/2017-11-13/294566 99.16% 2017-10-24 stephan-albani cdu gesundheit https://www.abgeordnetenwatch.de/profile/stephan-albani/question/2017-10-22/294166 99.16% 2017-08-14 stephan-albani cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/stephan-albani/question/2017-08-10/283117 45 Jahr, hoch, Österreich, Rente, geben, Rentner, ... 92.38% 2018-03-05 stephan-brandner afd kultur https://www.abgeordnetenwatch.de/profile/stephan-brandner/question/2018-03-02/297406 46 Jahr, Rente, Verbesserung, Erwerbsminderungsrente, gelten, beziehen, ... 99.24% 2018-12-11 peter-weis cdu soziales https://www.abgeordnetenwatch.de/profile/peter-weis/question/2018-12-04/307771 98.92% 2018-12-12 joachim-pfeiffer cdu soziales https://www.abgeordnetenwatch.de/profile/joachim-pfeiffer/question/2018-11-22/307347 92.84% 2018-12-11 peter-aumer csu soziales https://www.abgeordnetenwatch.de/profile/peter-aumer/question/2018-11-04/306231 47 Richtlinie, Unternehmen, Transparenz, Country, Tempolimit, Verbot, ... 99.59% 2018-07-06 hubertus-heil spd finanzen https://www.abgeordnetenwatch.de/profile/hubertus-heil/question/2018-05-14/298657 99.11% 2018-06-25 thomas-oppermann spd finanzen https://www.abgeordnetenwatch.de/profile/thomas-oppermann/question/2018-05-14/298654 97.00% 2019-01-11 anja-hajduk die-grünen inneres-und-justiz https://www.abgeordnetenwatch.de/profile/anja-hajduk/question/2019-01-03/308737 48 Kontakt, Mail, direkt, de, ... 98.38% 2017-08-16 axel-eduard-fischer cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/axel-eduard-fischer/question/2017-08-16/284051 98.38% 2017-08-16 axel-eduard-fischer cdu frauen https://www.abgeordnetenwatch.de/profile/axel-eduard-fischer/question/2017-08-16/284071 98.38% 2017-08-16 axel-eduard-fischer cdu soziales https://www.abgeordnetenwatch.de/profile/axel-eduard-fischer/question/2017-08-16/284078 49 müssen, Lösung, Hochschule, Frage, muss, mitteln, ... 98.99% 2017-08-24 kerstin-andreae die-grünen verkehr-und-infrastruktur https://www.abgeordnetenwatch.de/profile/kerstin-andreae/question/2017-08-22/286131 50 Regelung, Art, Artikel, Abs, Gesetz, GG, ... 99.75% 2017-12-11 andreas-schwarz spd bildung-und-forschung https://www.abgeordnetenwatch.de/profile/andreas-schwarz/question/2017-12-08/295153 51 Diesel, Fahrzeug, Hersteller, müssen, Grenzwert, muss, ... 98.17% 2017-08-07 christine-aschenberg-dugnus fdp demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/christine-aschenberg-dugnus/question/2017-08-04/282036 90.95% 2018-03-05 dr-rolf-mutzenich spd verkehr-und-infrastruktur https://www.abgeordnetenwatch.de/profile/dr-rolf-mutzenich/question/2018-03-02/297404 52 offen, Software, digitale, öffentlich, Verwaltung, Open, ... 98.89% 2018-08-15 dr-katarina-barley spd inneres-und-justiz https://www.abgeordnetenwatch.de/profile/dr-katarina-barley/question/2018-06-23/299844 53 Kindertagespflege, wollen, Bund, gut, Qualität, Land, ... 99.60% 2017-08-21 sonja-steffen spd kinder-und-jugend https://www.abgeordnetenwatch.de/profile/sonja-steffen/question/2017-08-09/282976 99.60% 2017-08-21 sonja-steffen spd kinder-und-jugend https://www.abgeordnetenwatch.de/profile/sonja-steffen/question/2017-08-09/283069 98.46% 2017-08-29 dr-katarina-barley spd kinder-und-jugend https://www.abgeordnetenwatch.de/profile/dr-katarina-barley/question/2017-08-09/282964 54 Pflege, gut, Krankenhäuser, Pflegekräfte, Vergütung, Versorgung, ... 99.00% 2017-08-28 christine-lambrecht spd gesundheit https://www.abgeordnetenwatch.de/profile/christine-lambrecht/question/2017-08-25/286836 55 Leiharbeit, gleich, Monat, Werkverträgen, Zeitarbeit, Missbrauch, ... 99.45% 2017-08-31 cansel-kiziltepe spd arbeit https://www.abgeordnetenwatch.de/profile/cansel-kiziltepe/question/2017-08-09/282931 57 Untersuchungsausschuss, müssen, Cum, Ex, rechtswidrig, Dietmar, ... 99.28% 2018-11-13 roderich-kiesewetter cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/roderich-kiesewetter/question/2018-11-10/306601 92.78% 2018-11-13 roderich-kiesewetter cdu finanzen https://www.abgeordnetenwatch.de/profile/roderich-kiesewetter/question/2018-11-10/306558 58 Amt, auswärtige, Frage, tagen, mögen, bedanken, ... 98.10% 2018-12-11 marja-liisa-vollers spd arbeit https://www.abgeordnetenwatch.de/profile/marja-liisa-vollers/question/2018-10-02/304663 98.10% 2018-12-11 marja-liisa-vollers spd inneres-und-justiz https://www.abgeordnetenwatch.de/profile/marja-liisa-vollers/question/2018-10-11/305236 98.10% 2018-12-11 marja-liisa-vollers spd soziales https://www.abgeordnetenwatch.de/profile/marja-liisa-vollers/question/2018-10-31/306079 60 Ausbau, Mobilität, wollen, Stadt, ÖPNV, gut, ... 95.50% 2017-08-16 beate-walter-rosenheimer die-grünen umwelt https://www.abgeordnetenwatch.de/profile/beate-walter-rosenheimer/question/2017-08-11/283405 61 CETA, EU, Abkomme, Freihandelsabkommen, öffentlich, Verhandlung, ... 99.11% 2018-11-22 stefan-sauer cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/stefan-sauer/question/2018-11-12/306858 97.95% 2018-07-10 eva-hogl spd soziales https://www.abgeordnetenwatch.de/profile/eva-hogl/question/2018-07-02/300446 94.18% 2018-11-14 andrea-nahles spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/andrea-nahles/question/2018-11-12/306859 62 Frau, Mann, Gewalt, ... 98.70% 2018-06-04 dr-gregor-gysi die-linke frauen https://www.abgeordnetenwatch.de/profile/dr-gregor-gysi/question/2018-05-29/298904 95.68% 2017-08-10 florian-hahn csu frauen https://www.abgeordnetenwatch.de/profile/florian-hahn/question/2017-07-31/279820 95.29% 2017-08-13 canan-bayram die-grünen frauen https://www.abgeordnetenwatch.de/profile/canan-bayram/question/2017-08-09/283000 63 Waffe, muss, Jahr, öffentlich, Waffenrecht, Standard, ... 99.37% 2017-08-15 ingo-wellenreuther cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/ingo-wellenreuther/question/2017-08-14/283808 99.00% 2017-08-22 annalena-baerbock die-grünen soziales https://www.abgeordnetenwatch.de/profile/annalena-baerbock/question/2017-08-14/283778 94.88% 2017-08-17 lothar-riebsamen cdu inneres-und-justiz https://www.abgeordnetenwatch.de/profile/lothar-riebsamen/question/2017-08-14/283766 64 Tier, Jahr, Ferkelkastration, Tierschutz, Deutschland, betäubungslosen, ... 99.74% 2019-01-02 marcus-weinberg cdu land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/marcus-weinberg/question/2018-12-19/308369 99.59% 2018-12-20 dr-katarina-barley spd arbeit https://www.abgeordnetenwatch.de/profile/dr-katarina-barley/question/2018-12-19/308337 99.59% 2018-12-20 dr-katarina-barley spd land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/dr-katarina-barley/question/2018-12-18/308284 65 Bundesminister, Schmidt, Landwirtschaft, Ernährung, Christian, Glyphosat, ... 99.53% 2017-08-10 anna-christmann die-grünen internationales https://www.abgeordnetenwatch.de/profile/anna-christmann/question/2017-07-30/279623 97.95% 2017-09-15 gerhard-schick die-grünen internationales https://www.abgeordnetenwatch.de/profile/gerhard-schick/question/2017-09-12/290707 97.75% 2017-12-07 christian-schmidt-2 csu land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/christian-schmidt-2/question/2017-11-27/294832 66 Demokrat, frei, freie, ... 96.67% 2018-06-27 christian-lindner fdp demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/christian-lindner/question/2017-12-07/295127 67 Bundestag, Abgeordnete, deutsche, Mitglied, ... 99.32% 2018-07-02 anke-domscheit-berg die-linke demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/anke-domscheit-berg/question/2018-05-29/298892 99.27% 2018-05-30 simone-barrientos die-linke demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/simone-barrientos/question/2018-05-20/298767 95.74% 2018-05-28 dr-dietmar-bartsch die-linke demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/dr-dietmar-bartsch/question/2018-05-20/298771 68 wollen, muss, Journalist, müssen, gut, ander, ... 99.15% 2018-09-10 dr-katarina-barley spd inneres-und-justiz https://www.abgeordnetenwatch.de/profile/dr-katarina-barley/question/2018-08-14/301292 98.00% 2018-09-10 dr-katarina-barley spd inneres-und-justiz https://www.abgeordnetenwatch.de/profile/dr-katarina-barley/question/2018-07-16/300780 94.50% 2017-12-01 christian-lindner fdp demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/christian-lindner/question/2017-11-20/294664 69 Organspende, Widerspruchslösung, Mensch, Deutschland, zahlen, Organspenden, ... 99.52% 2018-09-26 sven-christian-kindler die-grünen gesundheit https://www.abgeordnetenwatch.de/profile/sven-christian-kindler/question/2018-08-22/301554 97.91% 2018-11-01 jurgen-trittin die-grünen gesundheit https://www.abgeordnetenwatch.de/profile/jurgen-trittin/question/2018-09-03/302189 97.64% 2018-10-25 soren-bartol spd gesundheit https://www.abgeordnetenwatch.de/profile/soren-bartol/question/2018-10-18/305591 70 zuständig, anfragen, Thema, Frage, Bundesministerium, ... 97.09% 2017-09-12 stefan-zierke spd verkehr-und-infrastruktur https://www.abgeordnetenwatch.de/profile/stefan-zierke/question/2017-09-08/289802 90.61% 2017-08-28 eva-hogl spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/eva-hogl/question/2017-08-23/286515 72 Bürgerin, Bürger, bürgern, Abgeordnete, Wahlkreis, Gespräch, ... 90.41% 2018-06-19 andreas-mattfeldt cdu land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/andreas-mattfeldt/question/2018-06-18/299576 73 Kirche, erheben, Kirchensteuer, Staat, Frage, lehne, ... 99.20% 2017-09-28 sybille-benning cdu finanzen https://www.abgeordnetenwatch.de/profile/sybille-benning/question/2017-09-12/290625 97.98% 2018-11-08 dr-helge-braun cdu städtebau-und-stadtentwicklung https://www.abgeordnetenwatch.de/profile/dr-helge-braun/question/2018-10-14/305462 96.46% 2017-09-15 gerhard-zickenheiner die-grünen soziales https://www.abgeordnetenwatch.de/profile/gerhard-zickenheiner/question/2017-09-12/290708 74 Baden, Württemberg, EZB, Deutschland, Stuttgart, Zentralbank, ... 99.01% 2017-09-06 thomas-jarzombek cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/thomas-jarzombek/question/2017-08-03/281750 99.01% 2017-09-06 thomas-jarzombek cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/thomas-jarzombek/question/2017-08-03/281754 97.25% 2018-11-23 dr-kirsten-kappert-gonther die-grünen gesundheit https://www.abgeordnetenwatch.de/profile/dr-kirsten-kappert-gonther/question/2018-11-16/307050 75 spielen, rollen, ... 98.38% 2018-08-31 katja-dorner die-grünen internationales https://www.abgeordnetenwatch.de/profile/katja-dorner/question/2017-11-07/294472 97.80% 2018-11-29 dr-gregor-gysi die-linke inneres-und-justiz https://www.abgeordnetenwatch.de/profile/dr-gregor-gysi/question/2018-11-24/307408 90.44% 2018-02-28 dr-katarina-barley spd soziales https://www.abgeordnetenwatch.de/profile/dr-katarina-barley/question/2018-02-27/297329 76 Glyphosat, Anwendung, wissenschaftlich, Zulassung, Pflanzenschutzmitteln, EU, ... 99.65% 2017-12-04 henning-otte cdu land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/henning-otte/question/2017-11-27/294817 98.43% 2017-12-22 ursula-groden-kranich cdu gesundheit https://www.abgeordnetenwatch.de/profile/ursula-groden-kranich/question/2017-10-30/294342 93.09% 2017-12-01 antje-tillmann cdu umwelt https://www.abgeordnetenwatch.de/profile/antje-tillmann/question/2017-11-27/294820 77 de, anfragen, direkt, Mail, ... 98.68% 2018-10-17 michael-grosse-bromer-2 cdu finanzen https://www.abgeordnetenwatch.de/profile/michael-grosse-bromer-2/question/2018-10-15/305486 98.68% 2018-09-21 michael-grosse-bromer-2 cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/michael-grosse-bromer-2/question/2018-09-20/303679 98.68% 2018-09-10 michael-grosse-bromer-2 cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/michael-grosse-bromer-2/question/2018-09-07/302463 78 Tat, Geheimdienst, entziehen, LINKE, öffentlich, bewegen, ... 99.02% 2018-11-06 niema-movassat die-linke inneres-und-justiz https://www.abgeordnetenwatch.de/profile/niema-movassat/question/2018-11-05/306289 97.89% 2018-11-07 dr-gregor-gysi die-linke soziales https://www.abgeordnetenwatch.de/profile/dr-gregor-gysi/question/2018-10-30/306033 79 Gesellschaft, Ziegenhalter, fördern, mögen, müssen, groß, ... 98.82% 2018-06-27 dr-jens-zimmermann spd land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/dr-jens-zimmermann/question/2018-06-18/299653 98.71% 2018-06-27 manja-schule spd wirtschaft https://www.abgeordnetenwatch.de/profile/manja-schule/question/2018-06-24/299882 98.59% 2018-09-14 martin-burkert spd land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/martin-burkert/question/2018-06-25/299895 80 Verbot, setzen, Frage, möglich, Waffe, umgehen, ... 99.27% 2017-08-21 gustav-herzog spd internationales https://www.abgeordnetenwatch.de/profile/gustav-herzog/question/2017-08-12/283516 98.26% 2017-10-04 wolfgang-kubicki fdp demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/wolfgang-kubicki/question/2017-09-06/289462 96.26% 2017-09-22 wolfgang-kubicki fdp demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/wolfgang-kubicki/question/2017-09-06/289462 81 Patient, Krankenkasse, Arzt, Versorgung, medizinisch, Patientin, ... 98.62% 2017-09-22 barbel-bas spd gesundheit https://www.abgeordnetenwatch.de/profile/barbel-bas/question/2017-09-15/291339 92.78% 2017-09-22 ingo-wellenreuther cdu gesundheit https://www.abgeordnetenwatch.de/profile/ingo-wellenreuther/question/2017-09-21/292961 82 Afghanistan, Nation, vereinte, Sicherheit, IS, Rahmen, ... 99.53% 2018-11-14 elisabeth-motschmann-2 cdu internationales https://www.abgeordnetenwatch.de/profile/elisabeth-motschmann-2/question/2018-09-12/302699 92.95% 2018-04-06 michael-brand cdu internationales https://www.abgeordnetenwatch.de/profile/michael-brand/question/2018-01-06/295904 83 Flüchtling, Mensch, Land, Deutschland, müssen, Jahr, ... 99.25% 2017-08-28 gunther-krichbaum cdu integration https://www.abgeordnetenwatch.de/profile/gunther-krichbaum/question/2017-08-27/287108 98.14% 2017-09-01 michaela-noll cdu demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/michaela-noll/question/2017-08-15/283992 97.33% 2017-08-18 dr-maria-flachsbarth cdu inneres-und-justiz https://www.abgeordnetenwatch.de/profile/dr-maria-flachsbarth/question/2017-08-02/280317 84 Diät, Frage, Erhöhung, sollen, geben, Jahr, ... 99.49% 2018-01-11 roderich-kiesewetter cdu finanzen https://www.abgeordnetenwatch.de/profile/roderich-kiesewetter/question/2017-12-31/295726 97.59% 2018-01-18 gustav-herzog spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/gustav-herzog/question/2018-01-16/296248 85 Jahr, SPD, Alternative, Bundestagsfraktion, möglich, CDU, ... 99.73% 2019-01-09 manja-schule spd land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/manja-schule/question/2018-12-21/308547 99.69% 2018-12-21 ralf-kapschack spd land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/ralf-kapschack/question/2018-12-21/308481 99.67% 2018-12-21 heike-baehrens spd land--und-forstwirtschaft https://www.abgeordnetenwatch.de/profile/heike-baehrens/question/2018-12-19/308375 86 gemeinsam, sorgen, Kind, Vater, Gericht, Gesetz, ... 99.75% 2018-07-10 eva-schreiber die-linke familie https://www.abgeordnetenwatch.de/profile/eva-schreiber/question/2018-06-13/299364 99.74% 2018-07-11 caren-lay die-linke familie https://www.abgeordnetenwatch.de/profile/caren-lay/question/2018-06-13/299374 99.52% 2018-07-12 agnieszka-brugger die-grünen familie https://www.abgeordnetenwatch.de/profile/agnieszka-brugger/question/2018-06-27/300026 87 hambacher, Forst, Wald, Landesregierung, NRW, RWE, ... 98.29% 2018-11-12 bernhard-daldrup spd umwelt https://www.abgeordnetenwatch.de/profile/bernhard-daldrup/question/2018-10-04/304791 88 Schleswig, LNG, Holstein, Frage, Projekt, deutsch, ... 98.87% 2018-12-07 silvia-breher cdu umwelt https://www.abgeordnetenwatch.de/profile/silvia-breher/question/2018-11-02/306141 98.87% 2018-11-14 silvia-breher cdu umwelt https://www.abgeordnetenwatch.de/profile/silvia-breher/question/2018-11-02/306141 96.82% 2018-07-17 kerstin-andreae die-grünen familie https://www.abgeordnetenwatch.de/profile/kerstin-andreae/question/2018-06-27/300025 89 Landwirtschaft, wollen, ökologisch, Tier, gut, Produkt, ... 98.84% 2018-07-11 anna-christmann die-grünen umwelt https://www.abgeordnetenwatch.de/profile/anna-christmann/question/2018-06-06/299162 93.38% 2017-08-31 lisa-paus die-grünen umwelt https://www.abgeordnetenwatch.de/profile/lisa-paus/question/2017-08-26/287014 91.61% 2018-06-28 harald-ebner die-grünen umwelt https://www.abgeordnetenwatch.de/profile/harald-ebner/question/2018-06-06/299164 90 Saudi, Jemen, Arabien, Bundesregierung, deutsch, Rüstungsexporte, ... 92.31% 2017-09-23 dr-nina-scheer spd integration https://www.abgeordnetenwatch.de/profile/dr-nina-scheer/question/2017-08-29/287670 90.45% 2018-12-18 anja-weisgerber csu umwelt https://www.abgeordnetenwatch.de/profile/anja-weisgerber/question/2018-12-13/308114 92 Deutschland, anfragen, finden, klein, müssen, Problem, ... 98.90% 2018-09-25 andrea-nahles spd inneres-und-justiz https://www.abgeordnetenwatch.de/profile/andrea-nahles/question/2018-09-21/303762 98.90% 2018-09-25 andrea-nahles spd demokratie-und-bürgerrechte https://www.abgeordnetenwatch.de/profile/andrea-nahles/question/2018-09-21/303772 98.90% 2018-09-25 andrea-nahles spd verwaltung-und-föderalismus https://www.abgeordnetenwatch.de/profile/andrea-nahles/question/2018-09-21/303815 94 wollen, Deutschland, Kommission, Steuervermeidung, Vorschlag, Steuer, ... 98.66% 2017-09-19 thomas-gebhart cdu wirtschaft https://www.abgeordnetenwatch.de/profile/thomas-gebhart/question/2017-08-31/288035 95 Kommune, Bund, Land, Mensch, Frage, kommunal, ... 97.53% 2018-05-28 monika-grutters cdu kultur https://www.abgeordnetenwatch.de/profile/monika-grutters/question/2018-05-22/298808 94.50% 2018-02-28 manfred-grund cdu soziales https://www.abgeordnetenwatch.de/profile/manfred-grund/question/2018-02-26/297287 96 Flughafen, Uhr, Fluglärm, Flugzeug, Region, Anwohner, ... 92.24% 2018-11-22 michael-thews spd umwelt https://www.abgeordnetenwatch.de/profile/michael-thews/question/2018-11-12/306800 98 Kind, Familie, Eltern, ... 98.06% 2018-09-04 daniela-ludwig csu familie https://www.abgeordnetenwatch.de/profile/daniela-ludwig/question/2018-08-24/301744 93.85% 2018-02-28 dr-katarina-barley spd familie https://www.abgeordnetenwatch.de/profile/dr-katarina-barley/question/2018-01-12/296080 90.10% 2017-09-01 christoph-plos cdu familie https://www.abgeordnetenwatch.de/profile/christoph-plos/question/2017-08-31/288216 Topics that never contribute to a document upto 90%: 0 EU, europäisch, europäische, ... 3 Ehe, Frage, Mensch, Jahr, Gesellschaft, Diskriminierung, ... 11 Bundeswehr, Einsatz, NATO, Soldat, Sicherheit, Jahr, ... 13 Grundeinkommen, bedingungslos, Frau, BGE, Frage, ... 14 Polizei, Straftat, Sicherheit, muss, Rechtsstaat, müssen, ... 15 Russland, Ukraine, Deutschland, Israel, Regierung, Staat, ... 20 Bildung, Schule, gut, Land, wollen, müssen, ... 23 Mensch, wollen, gut, brauchen, müssen, Frage, ... 26 wollen, muss, Transparenz, müssen, Unternehmen, Lobbyregister, ... 36 Regelung, Datum, BKA, Hinblick, Möglichkeit, SPD, ... 41 Euro, Jahr, Milliarde, Million, ... 43 Verordnung, genannt, Transport, so, Antibiotika, handeln, ... 56 Berlin, Libyen, Tegel, rot, Afrika, Mensch, ... 59 bundestag, grün, dip21, de, ... 71 Wohnung, Wohnraum, sozial, Mieter, wollen, bezahlbar, ... 91 Jahr, Medikament, Deutschland, Bundesregierung, muss, Entscheidung, ... 93 gut, Arbeit, Mensch, Arbeitnehmer, Mindestlohn, wollen, ... 97 innen, Frage, grüßen, Katja, freundlich, Recht, ... 99 SPD, CDU, CSU, ...
For recommendations on how to store a learned model see https://scikit-learn.org/stable/modules/model_persistence.html and consequently https://joblib.readthedocs.io/en/latest/persistence.html.
dump_start_time = time.perf_counter()
joblib.dump(document_names, topics_dir / 'document_names.dumb')
joblib.dump(topic_model, topics_dir / 'topics_per_document.dumb')
joblib.dump(words_per_topic, topics_dir / 'words_per_topic.dumb')
joblib.dump(words, topics_dir / 'words.dumb')
joblib.dump(lda_algorithm, topics_dir / 'lda_algorithm.dumb')
print('{:25} {:8} {}'.format('file name', 'size', 'modification time'))
for file in topics_dir.iterdir():
print('{:25} {:8} {}'.format(file.name, file.stat().st_size,
time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(file.stat().st_mtime))))
dump_end_time = time.perf_counter()
print('Dumping all state took {:.2f}s.'.format(dump_end_time - dump_start_time))
file name size modification time lda_algorithm.dumb 31642071 2019-01-28 19:56:08 words_per_topic.dumb 15819420 2019-01-28 19:56:00 document_names.dumb 616331 2019-01-28 19:55:54 topics_per_document.dumb 6157020 2019-01-28 19:55:56 words.dumb 423221 2019-01-28 19:56:00 Dumping all state took 14.44s.
notebook_end_time = time.perf_counter()
print()
print(' Runtime of the notebook ')
print('-------------------------')
print('{:8.2f}s Loading the word counts from files.'.format(
load_end_time - load_start_time))
print('{:8.2f}s Latent Dirichlet Allocation'.format(
lda_end_time - lda_start_time))
print('{:8.2f}s All calculations together'.format(
notebook_end_time - notebook_start_time))
Runtime of the notebook ------------------------- 4.15s Loading the word counts from files. 445.14s Latent Dirichlet Allocation 465.49s All calculations together
![]() Licensed under a CC BY-NC 4.0 . |
Acknowledgments: This material was prepared within the project P3ML which is funded by the Ministry of Education and Research of Germany (BMBF) under grant number 01/S17064. The authors gratefully acknowledge this support. |