Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation #9

Merged
merged 7 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ deepproblog/examples/CLUTRR/data/data_d83ecc3e/
deepproblog/examples/CLUTRR/data/data_7c5b0e70/

deepproblog/examples/MNIST/log/

docs/source/.DS_Store
20 changes: 20 additions & 0 deletions src/docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions src/docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
79 changes: 79 additions & 0 deletions src/docs/source/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
API Documentation
=================

embeddings
----------
.. automodule:: deepproblog.embeddings
:members:
:show-inheritance:

tensor
------
.. automodule:: deepproblog.tensor
:members:
:show-inheritance:

query
-----
.. automodule:: deepproblog.query
:members:
:show-inheritance:

dataset
-------
.. automodule:: deepproblog.dataset
:members:
:show-inheritance:


network
-------
.. automodule:: deepproblog.network
:members:
:show-inheritance:

optimizer
---------
.. automodule:: deepproblog.optimizer
:members:
:show-inheritance:

model
-----
.. autoclass:: deepproblog.model.Model
:members:

train
-----
.. automodule:: deepproblog.train
:members:
:show-inheritance:

evaluate
--------
.. automodule:: deepproblog.evaluate
:members:
:show-inheritance:

solver
-------
.. automodule:: deepproblog.solver
:members:
:show-inheritance:

engine
------
.. automodule:: deepproblog.engines.engine
:members:
:show-inheritance:

semiring
--------
.. automodule:: deepproblog.semiring
:members:
:show-inheritance:

arithmetic circuit
------------------
.. autoclass:: deepproblog.arithmetic_circuit.ArithmeticCircuit
:members:
55 changes: 55 additions & 0 deletions src/docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here.
#import pathlib
#import sys
#sys.path.insert(0, pathlib.Path(__file__).parents[2].resolve().as_posix())

import sys
import os

# If extensions (or modules to document with autodoc) are in another directory,
# 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.
# sys.path.insert(0, os.path.abspath('.'))

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

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'DeepProbLog'
copyright = '2023, KU Leuven, DTAI Research Group'
author = 'KU Leuven, DTAI Research Group'
#release = '1.0'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.todo",
"sphinx.ext.coverage",
"sphinx.ext.mathjax",
"sphinx.ext.graphviz",
"sphinx.ext.ifconfig",
"sphinx.ext.viewcode",
"sphinx.ext.inheritance_diagram",
]

templates_path = ['_templates']
exclude_patterns = []



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'furo'
html_static_path = ['_static']
32 changes: 32 additions & 0 deletions src/docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. DeepProbLog documentation master file, created by
sphinx-quickstart on Tue Aug 8 11:25:48 2023.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

DeepProbLog
=======================================
Welcome to DeepProbLog's documentation.

DeepProbLog is an extension of ProbLog that integrates Probabilistic Logic Programming with deep learning by introducing the neural predicate. The neural predicate represents probabilistic facts whose probabilites are parameterized by neural networks.

.. raw:: html

<br />

.. toctree::
:maxdepth: 2
:caption: Contents:

install
problog
neural_predicate
api



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
56 changes: 56 additions & 0 deletions src/docs/source/install.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Installing DeepProbLog
======================

Installation
------------
DeepProbLog can easily be installed using the following command:
Make sure the following packages are installed:

.. code-block:: bash

pip install deepproblog

Test
----
To make sure your installation works, install pytest

.. code-block:: bash

pip install pytest

and run

.. code-block:: bash

python -m deepproblog test


Requirements
------------

DeepProbLog has the following requirements:

* Python > 3.9
* [ProbLog](https://dtai.cs.kuleuven.be/problog/)
* [PySDD](https://pysdd.readthedocs.io/en/latest/)
* [PyTorch](https://pytorch.org/)
* [TorchVision](https://pytorch.org/vision/stable/index.html)

Approximate Inference
---------------------
To use Approximate Inference, we have the followign additional requirements

* [PySwip](https://github.com/ML-KULeuven/pyswip)

.. code-block::

pip install git+https://github.com/ML-KULeuven/pyswip

* [SWI-Prolog < 9.0.0](https://www.swi-prolog.org/)

The latter can be installed on Ubuntu with the following commands:

.. code-block:: bash

sudo apt-add-repository ppa:swi-prolog/stable
sudo apt install swi-prolog=8.4* swi-prolog-nox=8.4* swi-prolog-x=8.4*
4 changes: 4 additions & 0 deletions src/docs/source/neural_predicate.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DeepProbLog and the Neural Predicate
====================================

Information about the neural predicate is available `here <https://dtai.cs.kuleuven.be/stories/post/robin-manhaeve/deepproblog/>`_.
4 changes: 4 additions & 0 deletions src/docs/source/problog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ProbLog
=======

ProbLog documentation and tutorials are available `here <https://dtai.cs.kuleuven.be/problog/>`_.
Loading