Skip to content

Commit

Permalink
Merge pull request #9 from nanxstats/typing
Browse files Browse the repository at this point in the history
Add type hints & functional refactor
  • Loading branch information
nanxstats authored Nov 11, 2024
2 parents 75431b2 + a883e6d commit 80e5816
Show file tree
Hide file tree
Showing 16 changed files with 327 additions and 256 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## tinytopics 0.3.0

### Improvements

- Refactor the code to use a more functional style and add type hints
to improve code clarity (#9).

## tinytopics 0.2.0

### New features
Expand Down
2 changes: 2 additions & 0 deletions docs/articles/benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ Experiment environment:

``` python
import time

import torch
import pandas as pd
import matplotlib.pyplot as plt

from tinytopics.fit import fit_model
from tinytopics.utils import generate_synthetic_data, set_random_seed
from tinytopics.colors import scale_color_tinytopics
Expand Down
2 changes: 2 additions & 0 deletions docs/articles/benchmark.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ Experiment environment:

```{python}
import time
import torch
import pandas as pd
import matplotlib.pyplot as plt
from tinytopics.fit import fit_model
from tinytopics.utils import generate_synthetic_data, set_random_seed
from tinytopics.colors import scale_color_tinytopics
Expand Down
3 changes: 2 additions & 1 deletion docs/articles/text.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ repo](https://github.com/stephenslab/fastTopics-experiments).
## Import tinytopics

``` python
import torch
import numpy as np
import pandas as pd
import torch
from pyreadr import read_r

from tinytopics.fit import fit_model
from tinytopics.plot import plot_loss, plot_structure, plot_top_terms
from tinytopics.utils import (
Expand Down
3 changes: 2 additions & 1 deletion docs/articles/text.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ The NIPS dataset contains a count matrix for 2483 research papers on
## Import tinytopics

```{python}
import torch
import numpy as np
import pandas as pd
import torch
from pyreadr import read_r
from tinytopics.fit import fit_model
from tinytopics.plot import plot_loss, plot_structure, plot_top_terms
from tinytopics.utils import (
Expand Down
7 changes: 7 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## tinytopics 0.3.0

### Improvements

- Refactor the code to use a more functional style and add type hints
to improve code clarity (#9).

## tinytopics 0.2.0

### New features
Expand Down
2 changes: 2 additions & 0 deletions examples/benchmark.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import time

import torch
import pandas as pd
import matplotlib.pyplot as plt

from tinytopics.fit import fit_model
from tinytopics.utils import generate_synthetic_data, set_random_seed
from tinytopics.colors import scale_color_tinytopics
Expand Down
3 changes: 2 additions & 1 deletion examples/text.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import torch
import numpy as np
import pandas as pd
import torch
from pyreadr import read_r

from tinytopics.fit import fit_model
from tinytopics.plot import plot_loss, plot_structure, plot_top_terms
from tinytopics.utils import (
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "tinytopics"
version = "0.2.0"
version = "0.3.0"
description = "Topic modeling via sum-to-one constrained neural Poisson non-negative matrix factorization"
authors = [
{ name = "Nan Xiao", email = "[email protected]" }
Expand Down
39 changes: 19 additions & 20 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ babel==2.16.0
# via mkdocs-material
beautifulsoup4==4.12.3
# via nbconvert
bleach==6.1.0
bleach==6.2.0
# via nbconvert
certifi==2024.8.30
# via httpcore
Expand All @@ -56,7 +56,7 @@ contourpy==1.3.0
# via matplotlib
cycler==0.12.1
# via matplotlib
debugpy==1.8.7
debugpy==1.8.8
# via ipykernel
decorator==5.1.1
# via ipython
Expand Down Expand Up @@ -95,15 +95,15 @@ ipykernel==6.29.5
# via jupyter
# via jupyter-console
# via jupyterlab
ipython==8.28.0
ipython==8.29.0
# via ipykernel
# via ipywidgets
# via jupyter-console
ipywidgets==8.1.5
# via jupyter
isoduration==20.11.0
# via jsonschema
jedi==0.19.1
jedi==0.19.2
# via ipython
jinja2==3.1.4
# via jupyter-server
Expand All @@ -114,7 +114,7 @@ jinja2==3.1.4
# via mkdocstrings
# via nbconvert
# via torch
json5==0.9.25
json5==0.9.28
# via jupyterlab-server
jsonpointer==3.0.0
# via jsonschema
Expand Down Expand Up @@ -198,10 +198,10 @@ mkdocs-autorefs==1.2.0
# via mkdocstrings-python
mkdocs-get-deps==0.2.0
# via mkdocs
mkdocs-material==9.5.42
mkdocs-material==9.5.44
mkdocs-material-extensions==1.3.1
# via mkdocs-material
mkdocstrings==0.26.2
mkdocstrings==0.27.0
# via mkdocstrings-python
mkdocstrings-python==1.12.2
mpmath==1.3.0
Expand All @@ -225,7 +225,7 @@ notebook==7.2.2
notebook-shim==0.2.4
# via jupyterlab
# via notebook
numpy==2.1.2
numpy==2.1.3
# via contourpy
# via imageio
# via matplotlib
Expand All @@ -235,7 +235,7 @@ numpy==2.1.2
# via tinytopics
overrides==7.7.0
# via jupyter-server
packaging==24.1
packaging==24.2
# via ipykernel
# via jupyter-server
# via jupyterlab
Expand Down Expand Up @@ -282,7 +282,7 @@ pygments==2.18.0
# via jupyter-console
# via mkdocs-material
# via nbconvert
pymdown-extensions==10.11.2
pymdown-extensions==10.12
# via mkdocs-material
# via mkdocstrings
pyparsing==3.2.0
Expand Down Expand Up @@ -311,7 +311,7 @@ referencing==0.35.1
# via jsonschema
# via jsonschema-specifications
# via jupyter-events
regex==2024.9.11
regex==2024.11.6
# via mkdocs-material
requests==2.32.3
# via jupyterlab-server
Expand All @@ -322,23 +322,22 @@ rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
# via jsonschema
# via jupyter-events
rpds-py==0.20.0
rpds-py==0.21.0
# via jsonschema
# via referencing
ruff==0.7.0
ruff==0.7.3
scikit-image==0.24.0
# via tinytopics
scipy==1.14.1
# via scikit-image
# via tinytopics
send2trash==1.8.3
# via jupyter-server
setuptools==75.2.0
setuptools==75.4.0
# via jupyterlab
# via torch
six==1.16.0
# via asttokens
# via bleach
# via python-dateutil
# via rfc3339-validator
sniffio==1.3.1
Expand All @@ -355,9 +354,9 @@ terminado==0.18.1
# via jupyter-server-terminals
tifffile==2024.9.20
# via scikit-image
tinycss2==1.3.0
tinycss2==1.4.0
# via nbconvert
torch==2.5.0
torch==2.5.1
# via tinytopics
tornado==6.4.1
# via ipykernel
Expand All @@ -366,7 +365,7 @@ tornado==6.4.1
# via jupyterlab
# via notebook
# via terminado
tqdm==4.66.5
tqdm==4.67.0
# via tinytopics
traitlets==5.14.3
# via comm
Expand All @@ -391,11 +390,11 @@ uri-template==1.3.0
# via jsonschema
urllib3==2.2.3
# via requests
watchdog==5.0.3
watchdog==6.0.0
# via mkdocs
wcwidth==0.2.13
# via prompt-toolkit
webcolors==24.8.0
webcolors==24.11.1
# via jsonschema
webencodings==0.5.1
# via bleach
Expand Down
10 changes: 5 additions & 5 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ mpmath==1.3.0
networkx==3.4.2
# via scikit-image
# via torch
numpy==2.1.2
numpy==2.1.3
# via contourpy
# via imageio
# via matplotlib
# via scikit-image
# via scipy
# via tifffile
# via tinytopics
packaging==24.1
packaging==24.2
# via lazy-loader
# via matplotlib
# via scikit-image
Expand All @@ -62,17 +62,17 @@ scikit-image==0.24.0
scipy==1.14.1
# via scikit-image
# via tinytopics
setuptools==75.2.0
setuptools==75.4.0
# via torch
six==1.16.0
# via python-dateutil
sympy==1.13.1
# via torch
tifffile==2024.9.20
# via scikit-image
torch==2.5.0
torch==2.5.1
# via tinytopics
tqdm==4.66.5
tqdm==4.67.0
# via tinytopics
typing-extensions==4.12.2
# via torch
Loading

0 comments on commit 80e5816

Please sign in to comment.