Skip to content

Commit

Permalink
Add progress bar for data synthesizer
Browse files Browse the repository at this point in the history
  • Loading branch information
nanxstats committed Oct 20, 2024
1 parent 31abe7b commit 0fe4a3b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tinytopics/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import torch
import numpy as np
from tqdm import tqdm
from scipy.optimize import linear_sum_assignment


Expand Down Expand Up @@ -46,8 +47,7 @@ def generate_synthetic_data(n, m, k, avg_doc_length=1000, device=None):
# Initialize document-term matrix X
X = np.zeros((n, m), dtype=np.int32)

# For each document i
for i in range(n):
for i in tqdm(range(n), desc="Generating Documents"):
# Sample topic counts for document i
topic_probs = true_L[i]
topic_counts = np.random.multinomial(doc_lengths[i], topic_probs)
Expand Down

0 comments on commit 0fe4a3b

Please sign in to comment.