diff --git a/docs/Intro/Basics.rst b/docs/Intro/Basics.rst index 492e854..bd57a3f 100644 --- a/docs/Intro/Basics.rst +++ b/docs/Intro/Basics.rst @@ -28,13 +28,13 @@ such as ``SymbolAccuracy`` and ``ReasoningMetric`` (both specialized metrics inherited from the ``BaseMetric`` class), for evaluating model quality from a data perspective. -**Learning** part focuses on the construction, deployment, and +:blue:`Learning` part focuses on the construction, deployment, and training of machine learning models. The ``ABLModel`` class is the central class that encapsulates the machine learning model. This class is compatible with various frameworks, including those based on Scikit-learn or PyTorch neural networks constructed by the ``BasicNN`` class. -**Reasoning** part concentrates on constructing domain knowledge and +:green:`Reasoning` part concentrates on constructing domain knowledge and performing reasoning. The ``KBBase`` class allows users to define a domain knowledge base. For diverse types of knowledge, we also offer implementations like ``GroundKB`` and ``PrologKB`` (both inherited @@ -45,7 +45,7 @@ responsible for minimizing the inconsistency between the knowledge base and data. The integration of these three parts are achieved through the -**Bridge** part, which features the ``SimpleBridge`` class (derived +:yellow:`Bridge` part, which features the ``SimpleBridge`` class (derived from the ``BaseBridge`` class). The Bridge part synthesizes data, learning, and reasoning, facilitating the training and testing of the entire ABL framework. @@ -68,16 +68,16 @@ fed back for further training ``ABLModel.train``. To implement this process, the following five steps are necessary: -1. Prepare datasets +1. Prepare **datasets** Prepare the data's input, ground truth for pseudo-labels (optional), and ground truth for reasoning results. -2. Build the learning part +2. :blue:`Build the` :blue-bold:`learning` :blue:`part` Build a machine learning base model that can predict inputs to pseudo-labels. Then, use ``ABLModel`` to encapsulate the base model. -3. Build the reasoning part +3. :green:`Build the` :green-bold:`reasoning` :green:`part` Define a knowledge base by building a subclass of ``KBBase``, specifying how to process pseudo-label examples to reasoning results. @@ -89,7 +89,7 @@ To implement this process, the following five steps are necessary: Define the metrics by building a subclass of ``BaseMetric``. The metrics will specify how to measure performance during the training and testing of the ABL framework. -5. Bridge learning and reasoning +5. :yellow-bold:`Bridge` :yellow:`learning and reasoning` Use ``SimpleBridge`` to bridge the learning and reasoning part for integrated training and testing. diff --git a/docs/References.rst b/docs/References.rst index 3256408..85ad7e5 100644 --- a/docs/References.rst +++ b/docs/References.rst @@ -1,7 +1,7 @@ References ========== -Zhi-Hua Zhou. Abductive learning: `Towards bridging machine learning and logical reasoning. `_. **Science China Information Sciences**, 2019, 62: 076101. +Zhi-Hua Zhou. `Abductive learning: Towards bridging machine learning and logical reasoning. `_. **Science China Information Sciences**, 2019, 62: 076101. Zhi-Hua Zhou and Yu-Xuan Huang. `Abductive learning `_. In P. Hitzler and M. K. Sarker eds., **Neuro-Symbolic Artificial Intelligence: The State of the Art**, IOP Press, Amsterdam, 2022, p.353-379 diff --git a/docs/_static/custom.css b/docs/_static/custom.css index 548c6ab..de4f232 100644 --- a/docs/_static/custom.css +++ b/docs/_static/custom.css @@ -1,3 +1,24 @@ div.code-out > div.highlight > pre { background-color: #d3effd !important; } +.green-bold { + color: green; + font-weight: bold; +} +.blue-bold { + color: blue; + font-weight: bold; +} +.yellow-bold { + color: rgb(255, 192, 0); + font-weight: bold; +} +.green { + color: green; +} +.blue { + color: blue; +} +.yellow { + color: rgb(255, 192, 0); +} \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index d6e943f..d67b6a8 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,6 +1,20 @@ import os import re import sys +from docutils import nodes +from docutils.parsers.rst import roles + +def colored_text_role(role, rawtext, text, lineno, inliner, options={}, content=[]): + node = nodes.inline(rawtext, text, classes=[role]) + return [node], [] + +roles.register_local_role('green-bold', colored_text_role) +roles.register_local_role('blue-bold', colored_text_role) +roles.register_local_role('yellow-bold', colored_text_role) +roles.register_local_role('green', colored_text_role) +roles.register_local_role('blue', colored_text_role) +roles.register_local_role('yellow', colored_text_role) + if "READTHEDOCS" not in os.environ: diff --git a/docs/img/usage.png b/docs/img/usage.png index faabc60..d16e940 100644 Binary files a/docs/img/usage.png and b/docs/img/usage.png differ