diff --git a/CHANGELOG.md b/CHANGELOG.md index e7b7808..c185628 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,4 +12,4 @@ and this project adheres to [Semantic Versioning][]. ### Added -- Basic tool, preprocessing and plotting functions +- Basic tool, preprocessing and plotting functions diff --git a/README.md b/README.md index 2900d02..3f43747 100644 --- a/README.md +++ b/README.md @@ -22,15 +22,15 @@ TorchGMM models against scikit-learn models is available on the ## Features -- Support for GPU and multi-node training by implementing models in PyTorch and relying on - [PyTorch Lightning](https://lightning.ai/docs/pytorch/stable/) -- Mini-batch training for all models such that they can be used on huge datasets -- Well-structured implementation of models +- Support for GPU and multi-node training by implementing models in PyTorch and relying on + [PyTorch Lightning](https://lightning.ai/docs/pytorch/stable/) +- Mini-batch training for all models such that they can be used on huge datasets +- Well-structured implementation of models - - High-level `Estimator` API allows for easy usage such that models feel and behave like in - scikit-learn - - Medium-level `LightingModule` implements the training algorithm - - Low-level PyTorch `Module` manages the model parameters + - High-level `Estimator` API allows for easy usage such that models feel and behave like in + scikit-learn + - Medium-level `LightingModule` implements the training algorithm + - Low-level PyTorch `Module` manages the model parameters ## Getting started @@ -110,8 +110,8 @@ In fact, **you do not need to change anything else in your code**. Currently, TorchGMM implements two different models: -- [GaussianMixture](https://pycave.borchero.com/sites/generated/bayes/gmm/pycave.bayes.GaussianMixture.html) -- [K-Means](https://pycave.borchero.com/sites/generated/clustering/kmeans/pycave.clustering.KMeans.html) +- [GaussianMixture](https://pycave.borchero.com/sites/generated/bayes/gmm/pycave.bayes.GaussianMixture.html) +- [K-Means](https://pycave.borchero.com/sites/generated/clustering/kmeans/pycave.clustering.KMeans.html) ## Contribution diff --git a/docs/contributing.md b/docs/contributing.md index 1d819aa..fc04c7d 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -99,10 +99,10 @@ Specify `vX.X.X` as a tag name and create a release. For more information, see [ Please write documentation for new or changed features and use-cases. This project uses [sphinx][] with the following features: -- the [myst][] extension allows to write documentation in markdown/Markedly Structured Text -- [Numpy-style docstrings][numpydoc] (through the [napoloen][numpydoc-napoleon] extension). -- Jupyter notebooks as tutorials through [myst-nb][] (See [Tutorials with myst-nb](#tutorials-with-myst-nb-and-jupyter-notebooks)) -- [Sphinx autodoc typehints][], to automatically reference annotated input and output types +- the [myst][] extension allows to write documentation in markdown/Markedly Structured Text +- [Numpy-style docstrings][numpydoc] (through the [napoloen][numpydoc-napoleon] extension). +- Jupyter notebooks as tutorials through [myst-nb][] (See [Tutorials with myst-nb](#tutorials-with-myst-nb-and-jupyter-notebooks)) +- [Sphinx autodoc typehints][], to automatically reference annotated input and output types See the [scanpy developer docs](https://scanpy.readthedocs.io/en/latest/dev/documentation.html) for more information on how to write documentation. @@ -119,10 +119,10 @@ repository. #### Hints -- If you refer to objects from other packages, please add an entry to `intersphinx_mapping` in `docs/conf.py`. Only - if you do so can sphinx automatically create a link to the external documentation. -- If building the documentation fails because of a missing link that is outside your control, you can add an entry to - the `nitpick_ignore` list in `docs/conf.py` +- If you refer to objects from other packages, please add an entry to `intersphinx_mapping` in `docs/conf.py`. Only + if you do so can sphinx automatically create a link to the external documentation. +- If building the documentation fails because of a missing link that is outside your control, you can add an entry to + the `nitpick_ignore` list in `docs/conf.py` #### Building the docs locally diff --git a/docs/extensions/typed_returns.py b/docs/extensions/typed_returns.py index 1135204..0fbffef 100644 --- a/docs/extensions/typed_returns.py +++ b/docs/extensions/typed_returns.py @@ -12,7 +12,7 @@ def _process_return(lines: Iterable[str]) -> Generator[str, None, None]: for line in lines: if m := re.fullmatch(r"(?P\w+)\s+:\s+(?P[\w.]+)", line): - yield f'-{m["param"]} (:class:`~{m["type"]}`)' + yield f"-{m['param']} (:class:`~{m['type']}`)" else: yield line diff --git a/src/torchgmm/base/estimator/base.py b/src/torchgmm/base/estimator/base.py index 19be9fe..fed6ca7 100644 --- a/src/torchgmm/base/estimator/base.py +++ b/src/torchgmm/base/estimator/base.py @@ -173,7 +173,7 @@ def save_parameters(self, path: Path) -> None: f.write(data) except TypeError: warnings.warn( - f"Failed to serialize parameters of `{self.__class__.__name__}` to JSON. " "Falling back to `pickle`.", + f"Failed to serialize parameters of `{self.__class__.__name__}` to JSON. Falling back to `pickle`.", stacklevel=2, ) with (path / "params.pickle").open("wb+") as f: diff --git a/src/torchgmm/base/utils/generics.py b/src/torchgmm/base/utils/generics.py index 5576e42..4ce7266 100644 --- a/src/torchgmm/base/utils/generics.py +++ b/src/torchgmm/base/utils/generics.py @@ -18,6 +18,6 @@ def get_generic_type(cls: Type[Any], origin: Type[Any], index: int = 0) -> Type[ if get_origin(base) == origin: args = get_args(base) if not args: - raise ValueError(f"`{cls.__name__}` does not provide a generic parameter " f"for `{origin.__name__}`") + raise ValueError(f"`{cls.__name__}` does not provide a generic parameter for `{origin.__name__}`") return get_args(base)[index] raise ValueError(f"`{cls.__name__}` does not inherit from `{origin.__name__}`")