Skip to content

Commit

Permalink
Merge pull request #333 from dice-group/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Demirrr authored Dec 10, 2023
2 parents 8df7294 + 697d990 commit dde54ad
Show file tree
Hide file tree
Showing 31 changed files with 1,758 additions and 971 deletions.
112 changes: 56 additions & 56 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
name: Build docs

on:
push:
branches:
- master
- develop
pull_request:

jobs:
docs:
runs-on: ubuntu-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v3
- name: Install tox
id: install-tox
run: |
pip install tox
echo "tox_version=$(pip list | grep tox | tr -d ' ')" >> $GITHUB_OUTPUT
- name: prepare required software
run: |
# epstopdf & dot & noto-fonts
sudo apt update && sudo apt install texlive-font-utils graphviz fonts-noto
- uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ steps.install-tox.outputs.tox_version }}-docs-${{ hashFiles('environment.yml', 'tox.ini') }}
path: .tox
- name: Build docs with tox
run: |
tox -o -e docs
- name: Build latex docs with tox
run: |
tox -o -e docs -- latex
- name: Compile LaTeX document
uses: docker://texlive/texlive:latest
with:
args: make -C docs/_build/latex
- run: |
cp docs/_build/latex/ontolearn.pdf docs/_build/html/
- name: Deploy to netlify
uses: nwtgck/[email protected]
with:
publish-dir: 'docs/_build/html'
production-branch: develop
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions ${{ github.sha }}"
alias: ${{ github.head_ref }}
enable-pull-request-comment: false
enable-commit-comment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 5
#name: Build docs
#
#on:
# push:
# branches:
# - master
# - develop
# pull_request:
#
#jobs:
# docs:
# runs-on: ubuntu-latest
# strategy:
# max-parallel: 5
#
# steps:
# - uses: actions/checkout@v3
# - name: Install tox
# id: install-tox
# run: |
# pip install tox
# echo "tox_version=$(pip list | grep tox | tr -d ' ')" >> $GITHUB_OUTPUT
# - name: prepare required software
# run: |
# # epstopdf & dot & noto-fonts
# sudo apt update && sudo apt install texlive-font-utils graphviz fonts-noto
# - uses: actions/cache@v3
# with:
# key: ${{ runner.os }}-${{ steps.install-tox.outputs.tox_version }}-docs-${{ hashFiles('environment.yml', 'tox.ini') }}
# path: .tox
# - name: Build docs with tox
# run: |
# tox -o -e docs
# - name: Build latex docs with tox
# run: |
# tox -o -e docs -- latex
# - name: Compile LaTeX document
# uses: docker://texlive/texlive:latest
# with:
# args: make -C docs/_build/latex
# - run: |
# cp docs/_build/latex/ontolearn.pdf docs/_build/html/
# - name: Deploy to netlify
# uses: nwtgck/[email protected]
# with:
# publish-dir: 'docs/_build/html'
# production-branch: develop
# github-token: ${{ secrets.GITHUB_TOKEN }}
# deploy-message: "Deploy from GitHub Actions ${{ github.sha }}"
# alias: ${{ github.head_ref }}
# enable-pull-request-comment: false
# enable-commit-comment: false
# env:
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
# timeout-minutes: 5
18 changes: 11 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,26 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9"]
python-version: ["3.9.18"]
max-parallel: 5
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Set up Conda
uses: conda-incubator/setup-miniconda@v2
with:
environment-file: environment.yml
# - name: Set up Conda
# uses: conda-incubator/setup-miniconda@v2
# with:
# environment-file: environment.yml
# conda run -n test pytest -p no:warnings -x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Test with pytest
run: |
wget https://files.dice-research.org/projects/Ontolearn/KGs.zip
unzip KGs.zip
conda run -n test pytest -p no:warnings -x
pytest -p no:warnings -x
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,4 @@ embeddings.zip
KGs.zip
/Fuseki/
/KGs/
/NCESData/
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ pip install ontolearn
```
or
```shell
git clone https://github.com/dice-group/Ontolearn.git && conda create --name onto python=3.8.18 && conda activate onto
pip3 install -e . && python -c "import ontolearn"
git clone https://github.com/dice-group/Ontolearn.git
conda create --name onto python=3.9.18 && conda activate onto && pip3 install -e . && python -c "import ontolearn"
wget https://files.dice-research.org/projects/Ontolearn/KGs.zip -O ./KGs.zip && unzip KGs.zip
```
```shell
Expand Down
20 changes: 5 additions & 15 deletions deploy_cl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from argparse import ArgumentParser
import random
import os

from ontolearn.model_adapter import compute_quality
from ontolearn.ea_algorithms import EASimple
from ontolearn.ea_initialization import EARandomWalkInitialization, RandomInitMethod, EARandomInitialization
from ontolearn.fitness_functions import LinearPressureFitness
Expand Down Expand Up @@ -32,18 +32,6 @@
renderer = DLSyntaxObjectRenderer()


def compute_quality(KB, solution, pos, neg, qulaity_func="F1"):
func = metrics[qulaity_func]().score2
instances = set(KB.individuals(solution))
if isinstance(list(pos)[0], str):
instances = {ind.get_iri().as_str().split("/")[-1] for ind in instances}
tp = len(pos.intersection(instances))
fn = len(pos.difference(instances))
fp = len(neg.intersection(instances))
tn = len(neg.difference(instances))
return func(tp=tp, fn=fn, fp=fp, tn=tn)[-1]


def setup_prerequisites(individuals, pos_ex, neg_ex, random_ex: bool, size_of_ex):

# start_time = time.time()
Expand Down Expand Up @@ -661,9 +649,11 @@ def run(args):

if not os.path.exists("NCESData/") and args.model == "nces":
print("\nWarning! You are trying to deploy NCES without the NCES data!")
print(f"Please download the necessary files first: see ./download_external_resources.sh\n")
print(f"Please download the necessary files first: see "
f"https://ontolearn-docs-dice-group.netlify.app/usage/02_installation#download-external-files\n")
elif not os.path.exists("KGs") and "KGs/" in args.path_knowledge_base:
print("\nWarning! There is no 'KGs' folder!")
print(f"Please download the datasets first: see ./download_external_resources.sh\n")
print(f"Please download the datasets first: "
f"see https://ontolearn-docs-dice-group.netlify.app/usage/02_installation#download-external-files\n")
else:
run(args)
10 changes: 6 additions & 4 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ channels:
- conda-forge
- pytorch
dependencies:
- python=3.8
- python=3.9.18
- matplotlib=3.3.4
- pandas=1.2.3
- pytorch=1.8.0
- rdflib=6.0.2
- scikit-learn=1.0.2
- sortedcontainers=2.4.0
- owlready2=0.40
- flask=1.1.2
- deap=1.3.1
- httpx=0.21.1
Expand All @@ -27,13 +26,15 @@ dependencies:
# docs
- sphinx=4.0.2
- sphinx_rtd_theme=0.5.1
- myst-parser=0.15.2
- myst-parser==0.15.2
# # building
- build=0.6.0
# PIP
- pip=21.0.1
- pip:
- owlapy == 0.1.0
- dicee==0.1.2
- owlready2==0.40
- owlapy==0.1.0
- tokenizers==0.12.1
- transformers==4.19.2
# testing
Expand All @@ -43,3 +44,4 @@ dependencies:
- sphinx-theme==1.0
- sphinxcontrib-plantuml==0.21
- plantuml-local-client==1.2021.10
- jinja2==3.1.2
2 changes: 1 addition & 1 deletion examples/advanced-usage-NCES.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"id": "immune-fluid",
"metadata": {},
"source": [
"From the main directory \"Ontolearn\", run the commands for NCES data in [`./download_external_resources.sh`](../download_external_resources.sh) to download pretrained models and datasets."
"From the main directory \"Ontolearn\", run the commands for NCES data mentioned [here](https://ontolearn-docs-dice-group.netlify.app/usage/02_installation#download-external-files) to download pretrained models and datasets."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/celoe_notebook.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"source": [
"# CELOE Notebook\n",
"This is a jupyter notebook file to execute [CELOE](ontolearn.concept_learner.CELOE) and generate predictive results. We recommend you to see the [concept learners](../docs/usage/06_concept_learners.md) guide before continuing with the execution.\n",
"Also if you have not done it already, from the main directory \"Ontolearn\", run the commands for Datasets in [`./download_external_resources.sh`](../download_external_resources.sh) to download the datasets."
"Also if you have not done it already, from the main directory \"Ontolearn\", run the commands for Datasets mentioned [here](https://ontolearn-docs-dice-group.netlify.app/usage/02_installation#download-external-files) to download the datasets."
]
},
{
Expand Down
Loading

0 comments on commit dde54ad

Please sign in to comment.