Skip to content

Commit

Permalink
Support python 3.9/3.10; Improve documentation for add_factor; Bump u…
Browse files Browse the repository at this point in the history
…p version for new release (#120)
  • Loading branch information
StannisZhou authored Feb 19, 2022
1 parent f7f3e3f commit 716abd6
Show file tree
Hide file tree
Showing 8 changed files with 244 additions and 270 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
poetry-version: [1.1.8]
python-version: [3.7, 3.8, 3.9, '3.10']
poetry-version: [1.1.13]
steps:
#----------------------------------------------
# cancel any pending actions
Expand All @@ -38,7 +38,7 @@ jobs:
# install & configure poetry
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1.1.6
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
Expand All @@ -56,12 +56,16 @@ jobs:
#----------------------------------------------
- name: Install dependencies
if: ${{ steps.cached-poetry-dependencies.outputs.cache-hit != 'true' }}
run: poetry install --no-interaction --no-root
run: |
poetry env use ${{ matrix.python-version }}
poetry install --no-interaction --no-root
#----------------------------------------------
# install your root project, if not already done
#----------------------------------------------
- name: Install library
run: poetry install --no-interaction
run: |
poetry env use ${{ matrix.python-version }}
poetry install --no-interaction
#----------------------------------------------
# run test suite with coverage
#----------------------------------------------
Expand Down
3 changes: 1 addition & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# sphinx <4 required by myst-nb v0.12.0 (Feb 2021)
# We might want to use myst-nb for doc tutorials with jupyter notebooks!
sphinx >=3, <4
sphinx >=4
sphinx-rtd-theme==0.5.2
.
25 changes: 0 additions & 25 deletions docs/source/_templates/custom-class-template.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,3 @@
:show-inheritance:
:inherited-members:
:special-members: __call__, __add__, __mul__

{% block methods %}
{% if methods %}
.. rubric:: {{ _('Methods') }}

.. autosummary::
:nosignatures:
{% for item in methods %}
{%- if not item.startswith('_') %}
~{{ name }}.{{ item }}
{%- endif -%}
{%- endfor %}
{% endif %}
{% endblock %}

{% block attributes %}
{% if attributes %}
.. rubric:: {{ _('Attributes') }}

.. autosummary::
{% for item in attributes %}
~{{ name }}.{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
8 changes: 1 addition & 7 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,14 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.

import os
import sys

sys.path.insert(0, os.path.abspath("../pgmax/"))


# -- Project information -----------------------------------------------------

project = "PGMax"
copyright = "2021, Vicarious FPC Inc"
author = "Guangyao Zhou, Nishanth Kumar, Miguel Lazaro-Gredilla, Shrinu Kushagra, Dileep George"

# The full version, including alpha/beta/rc tags
release = "0.2.2"
release = "0.2.3"


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion pgmax/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""A container package for the entire PGMax library."""

__version__ = "0.1.0"
__version__ = "0.2.3"
11 changes: 8 additions & 3 deletions pgmax/fg/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,16 @@ def add_factor(
Args:
variable_names: A list containing the connected variable names.
Variable names are tuples of the type (variable_group_name, variable_name_within_variable_group)
factor_configs: Array of shape (num_val_configs, num_variables)
An array containing explicit enumeration of all valid configurations
An array containing explicit enumeration of all valid configurations.
If the connected variables have n1, n2, ... states, 1 <= num_val_configs <= n1 * n2 * ...
factor_configs[config_idx, variable_idx] represents the state of variable_names[variable_idx]
in the configuration factor_configs[config_idx].
log_potentials: Optional array of shape (num_val_configs,).
If specified, it contains the log of the potential value for every possible configuration.
If none, it is assumed the log potential is uniform 0 and such an array is automatically
If specified, log_potentials[config_idx] contains the log of the potential value for
the valid configuration factor_configs[config_idx].
If None, it is assumed the log potential is uniform 0 and such an array is automatically
initialized.
"""
factor_group = groups.EnumerationFactorGroup(
Expand Down
Loading

0 comments on commit 716abd6

Please sign in to comment.