diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 6f2205f..1d0f2a5 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -1,6 +1,3 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions - name: Python package on: diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..2672e00 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,13 @@ +version: 2 +build: + os: ubuntu-20.04 + tools: + python: "3.9" +sphinx: + configuration: docs/conf.py +formats: + - pdf +python: + install: + - requirements: requirements.txt + - requirements: requirements.dev.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29..8379f39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1,16 @@ +# v0 + +## v0.1 + +### v0.1.2 - 2022-06-05 + +- Make documentation available as a website through readthedocs.io + +### v0.1.1 - 2022-06-05 + +- Fixed wrong minimum Python version in package metadata. +- Updated README.md with more information about the package. + +### v0.1.0 - 2022-06-05 + +Initial public release \ No newline at end of file diff --git a/README.md b/README.md index 4869cbb..eabc186 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,18 @@ # lgbn -Structure learning for linear Gaussian Bayesian networks. +[![Documentation Status](https://readthedocs.org/projects/lgbn/badge/?version=latest)](https://lgbn.readthedocs.io/en/latest/?badge=latest) + +Structure and parameter learning for linear Gaussian Bayesian networks. + +This package provides structure learning of linear Gaussian Bayesian networks via score-based search algorithms. Available algorithms include K2, Greedy Hill Climbing and Greedy Equivalent Search. Available scores include the Log Likelihood score and the Bayesian Information Criterion score. + +This is a well-tested (with 100% coverage) and well-documented (full API documentation + design and usage guides) package that focuses on training for a particular kind of Bayesian network: those in which every node has a Gaussian distribution where the mean is a linear combination of the parent nodes plus a bias factor and where the variances are independent across all nodes. This particular kind of Bayesian network has applications in all sorts of problems involving continuous data, even if the distribution of the data itself is not Gaussian. + +To our knowledge, this is the only available Python package able to work with these kinds of structures and data. Other Bayesian network packages such as [pgmpy](https://github.com/pgmpy/pgmpy) have not yet implemented continuous Gaussian nodes with the restrictions mentioned before. There exists software in other programming languages such as the [Bayesian Network Toolbox](https://github.com/bayesnet/bnt) (BNT) for MatLab, last released in 2003 or the R package [bnlearn](https://www.bnlearn.com/) which is actively maintained. We have used both as reference implementations and verified that the results obtained with this package match those returned by BNT and bnlearn with a relative error less than one part per million. + +## Documentation + +Documentation for this package is available online at https://lgbn.readthedocs.io/en/latest/ ## Development @@ -33,7 +45,7 @@ Test coverage can be measured with coverage.py: Ensure you have installed all dev dependencies. Then run - python3 setup.py sdist + python3 -m build from the repository root. This will build the package and place it under `dist/lgbn-x.y.z.tar.gz`. You can install it on your own machine by running @@ -53,6 +65,13 @@ Documentation can be compiled in to a set of HTML documents plus many other form cd docs make html +### Uploading the package to PyPI + +Build the package and execute + + python3 -m twine upload dist/* + +After that you will be asked for credentials and the updated package will be available for installation with `pip install lgbn`. ## Acknowledgements diff --git a/requirements.dev.txt b/requirements.dev.txt index 12a238c..06c5b1b 100644 --- a/requirements.dev.txt +++ b/requirements.dev.txt @@ -1,3 +1,5 @@ yapf==0.31.0 Sphinx==5.0.1 -coverage==6.4.1 \ No newline at end of file +coverage==6.4.1 +build==0.8.0 +twine==4.0.1 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index bec2efa..34b324f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,4 @@ networkx>=2.8 pandas>=1.4 # Estimators -scikit-learn >= 1.1 \ No newline at end of file +scikit-learn>= 1.1 \ No newline at end of file diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 36184ea..0000000 --- a/setup.cfg +++ /dev/null @@ -1,24 +0,0 @@ -[metadata] -name = lgbn -version = 0.1.0 -description = Structure and parameter learning for linear Gaussian Bayesian networks. -long_description = file: README.md -author = Elias Hernandis -author_email = elias@hernandis.me -license = MIT -classifiers = - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3 :: Only - -[options] -include_package_data = true -packages = find: -python_requires = >=3.9 -install_requires = - scipy >= 1.8 - networkx >= 2.8 - pandas >= 1.4 - scikit-learn >= 1.1 diff --git a/setup.py b/setup.py index fc1f76c..746745e 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,29 @@ -from setuptools import setup +import setuptools -setup() \ No newline at end of file +with open("README.md", "r", encoding="utf-8") as fh: + long_description = fh.read() + +setuptools.setup( + name="lgbn", + version="0.1.2", + author="Elias Hernandis", + author_email="elias@hernandis.me", + description="Structure and parameter learning for linear Gaussian Bayesian networks.", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/knifecake/lgbn", + project_urls={ + "Bug Tracker": "https://github.com/knifecake/lgbn/issues", + "Documentation": "https://lgbn.readthedocs.io/en/latest/" + }, + classifiers=[ + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3 :: Only", + "License :: OSI Approved :: MIT License", + "Operating System :: OS Independent", + ], + packages=setuptools.find_packages(include=['lgbn', 'lgbn.*']), + python_requires=">=3.9", + install_requires=['scipy >= 1.8', 'networkx >= 2.8', 'pandas >= 1.4', 'scikit-learn >= 1.1'] +) \ No newline at end of file