Browse Source

[DOC] add color in basics

pull/1/head
troyyyyy 2 years ago
parent
commit
5cf3378ca5
5 changed files with 43 additions and 8 deletions
  1. +7
    -7
      docs/Intro/Basics.rst
  2. +1
    -1
      docs/References.rst
  3. +21
    -0
      docs/_static/custom.css
  4. +14
    -0
      docs/conf.py
  5. BIN
      docs/img/usage.png

+ 7
- 7
docs/Intro/Basics.rst View File

@@ -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.

+ 1
- 1
docs/References.rst View File

@@ -1,7 +1,7 @@
References
==========

Zhi-Hua Zhou. Abductive learning: `Towards bridging machine learning and logical reasoning. <https://link.springer.com/epdf/10.1007/s11432-018-9801-4?author_access_token=jgJe1Ox3Mk-K7ORSnX7jtfe4RwlQNchNByi7wbcMAY7_PxTx-xNLP7Lp0mIZ04ORp3VG4wioIBHSCIAO3B_TBJkj87YzapmdnYVSQvgBIO3aEpQWppxZG25KolINetygc2W_Cj2gtoBdiG_J1hU3pA==>`_. **Science China Information Sciences**, 2019, 62: 076101.
Zhi-Hua Zhou. `Abductive learning: Towards bridging machine learning and logical reasoning. <https://link.springer.com/epdf/10.1007/s11432-018-9801-4?author_access_token=jgJe1Ox3Mk-K7ORSnX7jtfe4RwlQNchNByi7wbcMAY7_PxTx-xNLP7Lp0mIZ04ORp3VG4wioIBHSCIAO3B_TBJkj87YzapmdnYVSQvgBIO3aEpQWppxZG25KolINetygc2W_Cj2gtoBdiG_J1hU3pA==>`_. **Science China Information Sciences**, 2019, 62: 076101.

Zhi-Hua Zhou and Yu-Xuan Huang. `Abductive learning <https://www.lamda.nju.edu.cn/publication/chap_ABL.pdf>`_. In P. Hitzler and M. K. Sarker eds., **Neuro-Symbolic Artificial Intelligence: The State of the Art**, IOP Press, Amsterdam, 2022, p.353-379



+ 21
- 0
docs/_static/custom.css View File

@@ -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);
}

+ 14
- 0
docs/conf.py View File

@@ -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:


BIN
docs/img/usage.png View File

Before After
Width: 1458  |  Height: 425  |  Size: 245 kB Width: 1410  |  Height: 429  |  Size: 298 kB

Loading…
Cancel
Save