Add News dataset simulator generation notebook#17
Draft
Gitanaskhan26 wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
news_nytimes_lda.npzto thepgmpy/example_datasetsrepo. This file contains the pre-computed Latent Dirichlet Allocation (LDA) arrays and sparse word counts thatpgmpy.datasets.NewsDatasetloads on instantiation to simulate the causal inference benchmark from Johansson et al. (2016).Related Issue : pgmpy/pgmpy#3522
Provenance
docword.nytimes.txt.gzandvocab.nytimes.txt) from the UCI Machine Learning Repository.NewsDatasetacts as a simulator and regenerates the response surfaces dynamically based on user-defined parameters (News_Dataset_Generation.ipynb(included in this PR), which acts as a clean, reproducible pipeline to download the UCI data, fit the LDA models, select the vocabulary, and package the compressed sparse arrays.Validated properties
.npzfile is ~245 MB.NewsDatasetto dynamically merge topics (via agglomerative clustering) to fulfill user requests for anyseed=42LDA initialization.Why
news_nytimes_lda.npzinstead of the Raw NYT Corpus?Because
NewsDatasettreats this as a simulator, the covariates are derived from real NYT text. However, running LDA inference on 300,000 documents takes ~30-60 minutes to compute. By hosting the pre-computed topic distributions as an.npzfile, users can instantly load the high-dimensional covariates without expensive LDA training, while retaining the flexibility to request custom topic sizes and vocabulary counts on the fly.What the NPZ arrays actually are
topic_distributions_k50topic_distributions_k200lda_components_k50/_k200vocab_3477word_counts_3477_*full_vocab&word_counts_full_*NewsDatasetto scale the vocabulary if the user requests it.Checklist
pgmpy/example_datasetson HuggingFace_get_raw_data("news_nytimes_lda.npz")News_Dataset_Generation.ipynbincluded in this PR for reproducibilitySEED=42reproduces this exact.npzfile)