Thank you for considering a contribution to Logical Neural Networks, with your assistance we can help grow LNNs as the industry's tool of choice for a true Neuro = Symbolic
platform.
We commit to growing LNNs functionality, but we'd also love to see your name expanding into x
, adding to growing our list of contributors:
Contributions = Predicate("Contribution")
Growth = Propostion("LNNs Growth", world=World.TRUE)
Implies(Contributions(x), Growth)
- Due to the complex inference pattern of LNNs upward and downward reasoning strategy, Pycharm is our recommended IDE of choice for development and debugging.
- Make sure that the python version you are using corresponds with the setup file, using a fresh conda environment is recommended:
conda create -n lnn-contrib python=3.9 -y conda activate lnn-contrib
- Clone the
master
branch to keep up to date with the latest supported features:git clone https://github.com/IBM/LNN
- Install the LNN module as editable
cd LNN pip install -e .
ℹ️ Alternatively to install steps 2+3 above in one step:
pip install -e git+https://github.com/IBM/LNN#egg=lnn
- Install Black as an external tool/keyboard shortcut to keep to our code style - this automates our pep8 compliance so that you can code without the styling overhead
- Install and run pytest to ensure that the build is working correctly:
pip install pytest pytest
You are now ready to contribute changes to the codebase
- You want to propose a new feature and implement it.
- Post about your intended feature in an issue, and we shall discuss the design and implementation.
- Add labels to the issue, this should include 3 mandatory flags:
- A blue thread tag that you are working on
- A tag from:
bug
,invalid
,enhancement
orquestion
tag - A yellow tag from:
reasoning
,learning
,gm
ortest
- Once we agree that the plan looks good, go ahead and implement it.
-
You may also want to implement a feature or bug-fix for an outstanding issue:
- Pick an issue
- Comment that you will be working on this issue.
- Add yourself to the assignee list
If you need more context on a particular issue, please ask and we shall guide.
- LNN branches should follow git flow style branching
To create a new feature branch:
git checkout -b feature/my_branch
Please be mindful of existing branches when creating a new branch.
-
Use
Black
formatting to ensure that code contributions abide by our code style -
Commits should contain one of the following tags before the commit message:
ADD
,FIX
,MAINT
-
Run
pytest
locally to ensure all changes passNB: All code contributions corresponding to
enhancement
issues should have additional tests accompanying the code changes, located in thetests/
folder. -
Propose your code changes as a
Pull Request DRAFT
that merge into thedevelop
branch. -
A passed draft can be changed to a formal
Pull Request
. -
Add a reviewer to your code so that they can get notified of the proposal.
LNN documentation can be generated by running generate_docs.sh
in docsrc folder.
A key component in the LNN code base is the Formula
abstract class. Formula
is a
class that refers to itself and the classes that inherit from it. As such, this can lead
to circular imports. To overcome circular imports we use dictionaries that are keyed
with the names of the subclasses and the values are the subclasses themselves. These
dictionaries are populated in the __init__.py
of the logic module. Thus, when one
needs to work with a subclass, the subclass can be accessed by passing in the name of
that subclass to the dictionary. Note that not all classes that inherit from Formula
are added to these dictionaries. Please refer to __init__.py
if you need to add an
existing class or new class to one of the dictionaries.