Giter VIP home page Giter VIP logo

magicpopper's Introduction

learning programs with magic values - experiments

This folder contains the experimental code and data for the paper: Learning programs with magic values

Requirements

  • pyswip (You must install pyswip from the master branch!)

    • use the command: pip install git+https://github.com/yuce/pyswip@master#egg=pyswip
  • SWI-Prolog (8.4.2 or above)

  • Clingo (5.5.0 or above)

Usage

This experimental framework is based on https://github.com/logic-and-learning-lab/ilp-experiments.

Experimental data and experimental results used in the paper are in the folder ilp-experiments/results/{task-name}.

To reproduce the experimental results (train and test), you can run python ilpexp.py {experiment-name}. You can change the number of cores (default 1) in this file, and the systems tested and their settings in ilp-experiments/ilpexp/experiment.py. Experiment names are in this file.

To modify experimental data, you can change the experimental data generator files in ilp-experiments/ilpexp/problem/{task-name}.

To use MagicPopper with your own data, import your data in a new folder in ./magicpopper/examples and run:

python ./magicpopper/popper.py ./magicpopper/examples/{your-folder-name}

MagicPopper

MagicPopper is an inductive logic programming (ILP) system. MagicPopper learns programs with magic values. MagicPopper is based on Popper.

If you use MagicPopper, please cite the paper:

Céline Hocquette and Andrew Cropper. Learning programs with magic values

MagicPopper

As Popper, MagicPopper requires three files as input:

  • an examples file
  • a background knowledge (BK) file
  • a bias file

More details about how to set up these files are provided in Popper's documentation.

By comparison with Popper, the bias file for MagicPopper may additionnally contain magic value declarations. These specify which arguments of which predicates may be bound to constant symbols.

There are three different settings:

Setting 1: you can specify pairs of predicates / arguments, such as:

magic_value(cell,2).
magic_value(dist,2).

This allows the second argument of the predicate cell and dist to be bound to constant symbols. For instance, this allows the following hypothesis in the hypothesis space:

f(A) :- cell(A,B,w,C), cell(A,D,b,C), dist(B,D,1).

Setting 2: you can specify types of variables, such as:

magic_value(color).
magic_value(integer).

This allows any variable of type color or of type integer to be bound to constant symbols. For instance, this allows the following hypothesis in the hypothesis space:

f(A) :- cell(A,B,w,C), cell(A,D,b,C), dist(B,D,1).

Setting 3: you can specify that any variable may be bound to a constant symbol by adding the following to the bias file:

magic_value_all.

This bias is the weaker.

In any scenario, MagicPopper runs an automated search and identifies a subset of the variables specified as magic values. Therefore, Setting 3 (allowing any variable to be a magic value) is more expensive. It is preferable to use Settings 1 or 2 if it is known which arguments / types could be magic values.

By default, the maximum number of magic values in a clause is 4. You can change this setting by adding the following declaration in the bias file, where 'x' is the desired maximum number of magic values per clause:

max_magic(x).

Alternatively, you can use the command line option --max-magic as follows: python ./magicpopper/popper.py ./magicpopper/examples/{your-folder-name} --max-magic {x}

The bias file declaration has priority over the command line option.

Examples of tasks are provided in ./magicpopper/examples. Tasks which require magic values have a subfolder name which contains 'magic'.

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.