Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
c4c85dd
add BDD-OIA example
wnqn1597 Jun 13, 2025
c9c82ed
update readme
wnqn1597 Jun 13, 2025
79a26a0
Merge pull request #12 from wnqn1597/examples
AbductiveLearning Jun 13, 2025
8db8c1b
[FIX] pass flake8
troyyyyy Jun 13, 2025
695f9d2
[ENH] add contributors
troyyyyy Jun 13, 2025
e86f12e
[FIX] fix placeholder
troyyyyy Jun 13, 2025
51274d3
[FIX] change font size
troyyyyy Jun 13, 2025
d0df086
[FIX] add emoji in title
troyyyyy Jun 13, 2025
559e2ac
[DOC] update readme doc
troyyyyy Jun 16, 2025
0cd57ef
[FEATURE] Enhance SimpleBridge with wandb integration and type parame…
WaTerminator Jun 19, 2025
c2687de
Merge branch
troyyyyy Mar 2, 2026
f18ba61
add TODO
troyyyyy Mar 2, 2026
7ba694b
[DOC] Contributor Yang Hang added
Hygebra Mar 3, 2026
b71961a
[DOC] Update bdd_oia/bdd_oia.ipynb and bdd_oia/README.md, unable to e…
Hygebra Mar 3, 2026
43ffc0d
[FIX] Fix the bug in ablkit/simple_bridge.py: inconsistent type and u…
Hygebra Mar 3, 2026
d91dcbd
[DOC, FIX] Execution of file bdd_oia.ipynb, import nn in bdd_oia/main.py
Hygebra Mar 3, 2026
d9d17db
[MNT] Update href of Yang Hang in ./README.md
Hygebra Mar 4, 2026
b32ab11
[ENH] Class A3BLReasoner(Reasoner) added in ablkit/reasoning/reasoner…
Hygebra Mar 4, 2026
44035c5
Merge branch 'hangy/a3bl' into hangy/master
Hygebra Mar 4, 2026
31aa865
[MNT] Executing "black -l 100 .", limiting code length of characters …
Hygebra Mar 4, 2026
891deb5
[ENH] Adding semi-supervised abduce method to ablkit\reasoning.py and…
Hygebra Mar 6, 2026
a6d2451
[MNT] Code formatting by "black -l 100 ."
Hygebra Mar 6, 2026
3df7750
[FIX] Unchanged mistake "or True" deleted in ablkit\bridge\simple_bri…
Hygebra Mar 6, 2026
f5d8f4a
Merge branch 'hangy/semi-supervise' into hangy/master
Hygebra Mar 6, 2026
0c50d39
[MNT] Changing descriptions of method supervised_abduce_pseudo_label …
Hygebra Mar 6, 2026
6c7ee85
Merge pull request #13 from AbductiveLearning/hangy/master
AbductiveLearning Mar 12, 2026
100c522
add TODO (0318 ver.)
troyyyyy Mar 18, 2026
a78a513
[ENH] Add A3BL, semi-supervised, similarity & rejection options to MN…
troyyyyy May 17, 2026
ff02bab
[MNT] Stop tracking dataset.zip and ignore dataset binaries
troyyyyy May 17, 2026
5b3ee2d
[DOC] Document new dist_func options and mnist_add CLI flags
troyyyyy May 17, 2026
74da984
[FIX] Quick-win audit fixes: typos, bare except, sphinx underlines
troyyyyy May 17, 2026
300e381
[REFACTOR] Promote extract_features/embeddings to core ABLModel
troyyyyy May 17, 2026
fc689cd
[TYPE] Add type hints and replace eval() in HWF
troyyyyy May 17, 2026
4eea499
[LOG] Use print_log for dataset download status and Prolog hints
troyyyyy May 17, 2026
3d508bd
[REFACTOR] Naming/pedagogy cleanup across examples
troyyyyy May 17, 2026
79cab06
[REFACTOR] Split SimpleBridge.train into single-responsibility helpers
troyyyyy May 17, 2026
f5673ff
[ENH] Flatten mnist_add bridge layout; add __init__.py to example dirs
troyyyyy May 17, 2026
acc43ca
[ENH] Add Verification Learning support; lift extract_features to Bas…
troyyyyy May 17, 2026
cd4366d
[CI] Modernize workflows; fix test regressions; clean up flake8 findings
troyyyyy May 17, 2026
15df31a
[REFACTOR] Consolidate VerificationReasoner into reasoner.py
troyyyyy May 17, 2026
9a0cf54
[ENH] Promote A3BLBridge and multi-label classes to ablkit core; add …
troyyyyy May 17, 2026
04a4e53
[FIX] Drop an optional dependency that was not installed on CI
troyyyyy May 17, 2026
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
87 changes: 40 additions & 47 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,52 @@ name: ABLkit-CI

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- uses: syphar/restore-virtualenv@v1
id: cache-virtualenv
with:
custom_cache_key_element: ABLkit
requirement_files: requirements.txt

- uses: syphar/restore-pip-download-cache@v1
if: steps.cache-virtualenv.outputs.cache-hit != 'true'

- name: Install SWI-Prolog on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install swi-prolog
- name: Install SWI-Prolog on Windows
if: matrix.os == 'windows-latest'
run: choco install swi-prolog
- name: Install SWI-Prolog on MACOS
if: matrix.os == 'macos-latest'
run: brew install swi-prolog

- name: Install package dependencies
if : steps.cache-virtualenv.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
- name: Install
if : steps.cache-virtualenv.outputs.cache-hit != 'true'
run: pip install -v -e .

- name: Run tests
run: |
pytest --cov-config=.coveragerc --cov-report=xml --cov=ablkit ./tests

- name: Publish code coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
cache-dependency-path: pyproject.toml

- name: Install SWI-Prolog (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y swi-prolog

- name: Install SWI-Prolog (Windows)
if: matrix.os == 'windows-latest'
run: choco install -y swi-prolog

- name: Install SWI-Prolog (macOS)
if: matrix.os == 'macos-latest'
run: brew install swi-prolog

- name: Install package and test dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[test]"

- name: Run tests
run: pytest --cov-config=.coveragerc --cov-report=xml --cov=ablkit ./tests

- name: Publish code coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: false
51 changes: 27 additions & 24 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
name: flake8 Lint

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
flake8-lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Check out source repository
uses: actions/checkout@v3
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: flake8 Lint
uses: py-actions/flake8@v2
with:
max-line-length: "100"
args: --ignore=E203,W503,F821
name: flake8 Lint

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
flake8-lint:
runs-on: ubuntu-latest
name: Lint
steps:
- name: Check out source repository
uses: actions/checkout@v4

- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: flake8 Lint
uses: py-actions/flake8@v2
with:
path: ablkit
max-line-length: "100"
args: --ignore=E203,W503,F821
22 changes: 20 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,13 +1,31 @@
*.pyc
examples/**/*.png
examples/**/*.jpg
*.pk
*.pkl
*.pth
*.json
*.ckpt
results
raw/
ablkit.egg-info/
examples/**/*.jpg
.idea/
build/
.history
.history

# Datasets and large binaries
*.zip
*.tar
*.tar.gz
*.tgz
*.gz
*.npz
*.npy
*.h5
*.hdf5
*.parquet
*.feather
*.arrow
*-ubyte
*.data
*.arff
69 changes: 60 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

<img src="https://raw.githubusercontent.com/AbductiveLearning/ABLkit/main/docs/_static/img/logo.png" width="180">

[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ablkit)](https://pypi.org/project/ablkit/) [![PyPI version](https://badgen.net/pypi/v/ablkit)](https://pypi.org/project/ablkit/) [![Documentation Status](https://readthedocs.org/projects/ablkit/badge/?version=latest)](https://ablkit.readthedocs.io/en/latest/?badge=latest) [![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/AbductiveLearning/ABLkit/blob/main/LICENSE) [![flake8 Lint](https://github.com/AbductiveLearning/ABLkit/actions/workflows/lint.yaml/badge.svg)](https://github.com/AbductiveLearning/ABLkit/actions/workflows/lint.yaml) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![ABLkit-CI](https://github.com/AbductiveLearning/ABLkit/actions/workflows/build-and-test.yaml/badge.svg)](https://github.com/AbductiveLearning/ABLkit/actions/workflows/build-and-test.yaml)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/AbductiveLearning/ABLkit/blob/main/LICENSE) [![last commit](https://img.shields.io/github/last-commit/AbductiveLearning/ablkit)](https://img.shields.io/github/last-commit/AbductiveLearning/ablkit) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ablkit)](https://pypi.org/project/ablkit/) [![PyPI version](https://badgen.net/pypi/v/ablkit)](https://pypi.org/project/ablkit/) [![Documentation Status](https://readthedocs.org/projects/ablkit/badge/?version=latest)](https://ablkit.readthedocs.io/en/latest/?badge=latest) [![ABLkit-CI](https://github.com/AbductiveLearning/ABLkit/actions/workflows/build-and-test.yaml/badge.svg)](https://github.com/AbductiveLearning/ABLkit/actions/workflows/build-and-test.yaml) [![flake8 Lint](https://github.com/AbductiveLearning/ABLkit/actions/workflows/lint.yaml/badge.svg)](https://github.com/AbductiveLearning/ABLkit/actions/workflows/lint.yaml) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) [![PyPI - Downloads](https://img.shields.io/pypi/dm/ablkit)](https://pypi.org/project/ablkit/)

[📘Documentation](https://ablkit.readthedocs.io/en/latest/index.html) | [📄Paper](https://journal.hep.com.cn/fcs/EN/10.1007/s11704-024-40085-7) | [📚Examples](https://github.com/AbductiveLearning/ABLkit/tree/main/examples) | [💬Reporting Issues](https://github.com/AbductiveLearning/ABLkit/issues/new)
[📘Documentation](https://ablkit.readthedocs.io/en/latest/index.html) | [📄Paper](https://journal.hep.com.cn/fcs/EN/10.1007/s11704-024-40085-7) | [🧪Examples](https://github.com/AbductiveLearning/ABLkit/tree/main/examples) | [💬Reporting Issues](https://github.com/AbductiveLearning/ABLkit/issues/new)

</div>

# ABLkit: A Toolkit for Abductive Learning
# 🧰 ABLkit: A Toolkit for Abductive Learning 📊📐

**ABLkit** is an efficient Python toolkit for [**Abductive Learning (ABL)**](https://www.lamda.nju.edu.cn/publication/chap_ABL.pdf). ABL is a novel paradigm that integrates machine learning and logical reasoning in a unified framework. It is suitable for tasks where both data and (logical) domain knowledge are available.

Expand All @@ -28,7 +28,7 @@ ABLkit encapsulates advanced ABL techniques, providing users with an efficient a
<img src="https://raw.githubusercontent.com/AbductiveLearning/ABLkit/main/docs/_static/img/ABLkit.png" alt="ABLkit" style="width: 80%;"/>
</p>

## Installation
## 🛠️ Installation

### Install from PyPI

Expand Down Expand Up @@ -60,7 +60,7 @@ sudo apt-get install swi-prolog

For Windows and Mac users, please refer to the [SWI-Prolog Install Guide](https://github.com/yuce/pyswip/blob/master/INSTALL.md).

## Quick Start
## Quick Start

We use the MNIST Addition task as a quick start example. In this task, pairs of MNIST handwritten images and their sums are given, alongwith a domain knowledge base which contains information on how to perform addition operations. Our objective is to input a pair of handwritten images and accurately determine their sum.

Expand Down Expand Up @@ -184,16 +184,17 @@ bridge.test(test_data)

To explore detailed tutorials and information, please refer to: [Documentation on Read the Docs](https://ablkit.readthedocs.io/en/latest/index.html).

## Examples
## 🧪 Examples

We provide several examples in `examples/`. Each example is stored in a separate folder containing a README file.

+ [MNIST Addition](https://github.com/AbductiveLearning/ABLkit/tree/main/examples/mnist_add)
+ [Handwritten Formula (HWF)](https://github.com/AbductiveLearning/ABLkit/tree/main/examples/hwf)
+ [Handwritten Equation Decipherment](https://github.com/AbductiveLearning/ABLkit/tree/main/examples/hed)
+ [Zoo](https://github.com/AbductiveLearning/ABLkit/tree/main/examples/zoo)
+ [BDD-OIA](https://github.com/AbductiveLearning/ABLkit/tree/main/examples/bdd_oia)

## References
## 📚 References

For more information about ABL, please refer to: [Zhou, 2019](http://scis.scichina.com/en/2019/076101.pdf) and [Zhou and Huang, 2022](https://www.lamda.nju.edu.cn/publication/chap_ABL.pdf).

Expand All @@ -220,7 +221,7 @@ For more information about ABL, please refer to: [Zhou, 2019](http://scis.scichi
}
```

## Citation
## 📝 Citation

To cite ABLkit, please cite the following paper: [Huang et al., 2024](https://journal.hep.com.cn/fcs/EN/10.1007/s11704-024-40085-7).

Expand All @@ -234,4 +235,54 @@ To cite ABLkit, please cite the following paper: [Huang et al., 2024](https://j
pages = {186354},
year = {2024}
}
```
```

## ✨ Contributors

We would like to thank the following contributors for their efforts on this project: <sub><i>(*: current maintainer)</i></sub>

<table>
<tr>
<td align="center">
<a href="https://github.com/WaTerminator">
<img src="https://avatars.githubusercontent.com/u/58843099?V=4" width="100px;" alt=""/>
<br />
En-Hao Gao
</a>
</td>
<td align="center">
<a href="https://github.com/Tony-HYX">
<img src="https://avatars.githubusercontent.com/u/34394824?V=4" width="100px;" alt=""/>
<br />
Yu-Xuan Huang
</a>
</td>
<td align="center">
<a href="https://github.com/troyyyyy">
<img src="https://avatars.githubusercontent.com/u/49091847?v=4" width="100px;" alt=""/>
<br />
Wen-Chao Hu
</a>*
</td>
<td align="center">
<a href="https://github.com/snqn1597">
<img src="https://avatars.githubusercontent.com/u/98020642?V=4" width="100px;" alt=""/>
<br />
Qi-Jie Li
</a>
</td>
<td align="center">
<a href="https://github.com/Hygebra">
<img src="https://avatars.githubusercontent.com/u/160569872?V=4" width="100px;" alt=""/>
<br />
Yang Hang
</a>*
</td>
</tr>
</table>

We also thank the following users for their helpful suggestions and feedback:

- [Hao-Yuan He](https://github.com/Hao-Yuan-He)
- [Lin-Han Jia](https://github.com/YGZWQZD)
- [Wang-Zhou Dai](https://github.com/haldai)
4 changes: 3 additions & 1 deletion ablkit/bridge/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from .a3bl_bridge import A3BLBridge
from .base_bridge import BaseBridge
from .simple_bridge import SimpleBridge
from .verification_bridge import VerificationBridge

__all__ = ["BaseBridge", "SimpleBridge"]
__all__ = ["BaseBridge", "SimpleBridge", "A3BLBridge", "VerificationBridge"]
Loading
Loading