Coder Social home page Coder Social logo

rdflime-util's Introduction

rdflime-util

A collection of scripts and notebooks to replicate the results that have been reported in the corresponding thesis:
RDF-LIME: Locally Faithful Model-Agnostic Explanations for Machine Learning on Knowledge Graph Embeddings

In case you just want to use the RDF-LIME extension of the LIME library, please refer to rdflime-core.

Replicating the results

Prerequisites

Ideally, start from a clean Linux system with Python 3.8 installed, e.g. using a fresh Python 3 docker image in the VS Code devcontainer environment.

1. Download this repository:

git clone https://github.com/rgrenz/rdflime-util

2. Basics To install and initiate Poetry, a python package manger, execute the following script:

./rdflime-util/scripts/0_PythonEnvironment.sh

3. Fuseki We would like to generate knowledge graph embeddings from a DBpedia data dump. To achieve this, we first need to download the respective DBpedia triples and host them in Apache Jena Fuseki. Additionally, we will get the datasets for our entities of interest (e.g. movies).

# To download and setup Fuseki (one-time script)
./rdflime-util/scripts/1a_InstallFusekiServer.sh

# Every time you would then like to start Fuseki
./rdflime-util/scripts/1b_RunFusekiServer.sh

# You should then be able to access the Fuseki UI at http://localhost:3030

Embedding Generation

Now that Jena Fuseki is up and running, we can generate our graph embeddings using PyRDF2Vec. Depending on your editor, it could be useful to have a notebook extension installed. Make sure to choose the virtualenv that has been created by Poetry.

1. Data Preprocessing:

# (Optional) To have a first look into our datasets, you can play around in the following notebook:
./rdflime-util/notebooks/0_MovieDatasetExploration.ipynb

# Preprocessing - to correct some minor dataset errors, please run the cells in:
./rdflime-util/notebooks/1_DBpediaFixes.ipynb

2. Embedding Generation:

# Follow the steps outlined in:
./rdflime-util/notebooks/2_EmbeddingGeneration.ipynb

# Now we have built and evaluated RDF2Vec knowledge graph embeddings for our entities of interest.
# Additionally, the classifier under test has been trained already.
# Next step: Explanations!

3. Explanation:

# Follow the steps outlined in:
./rdflime-util/notebooks/3_RDFLIME.ipynb

4. Explanation Evaluation:

# Follow the steps outlined in:
./rdflime-util/notebooks/4_LimeEval.ipynb

4. Survey Evaluation:

# Follow the steps outlined in:
./rdflime-util/notebooks/5_SurveyEval.ipynb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.