Skip to content

Commit 6581f58

Browse files
Bugfixes and typos in dynamic models
1 parent 2e35ee8 commit 6581f58

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

turftopic/models/cluster.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,6 @@ def fit_transform_dynamic(
338338
time_labels, self.time_bin_edges = self.bin_timestamps(
339339
timestamps, bins
340340
)
341-
n_comp, n_vocab = self.components_.shape
342-
n_bins = len(self.time_bin_edges) - 1
343341
if hasattr(self, "components_"):
344342
doc_topic_matrix = label_binarize(
345343
self.labels_, classes=self.classes_
@@ -348,7 +346,9 @@ def fit_transform_dynamic(
348346
doc_topic_matrix = self.fit_transform(
349347
raw_documents, embeddings=embeddings
350348
)
351-
self.temporal_components = np.zeros(
349+
n_comp, n_vocab = self.components_.shape
350+
n_bins = len(self.time_bin_edges) - 1
351+
self.temporal_components_ = np.zeros(
352352
(n_bins, n_comp, n_vocab), dtype=doc_topic_matrix.dtype
353353
)
354354
self.temporal_importance_ = np.zeros((n_bins, n_comp))

turftopic/models/gmm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def fit_transform_dynamic(
182182
document_term_matrix = self.vectorizer.transform(raw_documents)
183183
n_comp, n_vocab = self.components_.shape
184184
n_bins = len(self.time_bin_edges) - 1
185-
self.temporal_components = np.zeros(
185+
self.temporal_components_ = np.zeros(
186186
(n_bins, n_comp, n_vocab), dtype=document_term_matrix.dtype
187187
)
188188
self.temporal_importance_ = np.zeros((n_bins, n_comp))

turftopic/models/keynmf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,9 @@ def fit_transform_dynamic(
248248
keywords = self.extract_keywords(
249249
raw_documents, embeddings=embeddings
250250
)
251-
time_labels, self.time_bin_edges = bin_timestamps(timestamps, bins)
251+
time_labels, self.time_bin_edges = self.bin_timestamps(
252+
timestamps, bins
253+
)
252254
doc_topic_matrix = self.model.fit_transform_dynamic(
253255
keywords, time_labels, self.time_bin_edges
254256
)

0 commit comments

Comments
 (0)