Coder Social home page Coder Social logo

gamahead / lotlib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from piantado/lotlib

0.0 2.0 0.0 6.4 MB

Python tools for Lanugage of Thought (LOT) models Please note that this is still under heavy development and debugging.

License: GNU General Public License v3.0

Python 99.17% R 0.41% Perl 0.42%

lotlib's Introduction

LOTlib

LOTlib is a python library for programming "language of thought" models. With it, you specify a set of primitives and can model learners who search over compositions of the primitives to express complex concepts. The examples provided all describe a grammar and a probablistic Bayesian model over the expressions generated by that grammar, and using sampling in order to determine likely hypotheses, given some observed data. There are several sampling methods provided, including tree-regeneration metropolis-hastings (from the Rational Rules model of Goodman et al. 2010), and variants that include tempering, tempered transitions, and Gibbs sampling. In general, the original algorithm seems to be fastest and most robust. NOTE: The bound-variable part of PCFGs is not heavily tested or debugged (yet).

This library provides basic support for MPI through SimpleMPI (using mpi4py), allowing sampling algorithms to run in parallel on a single computer, or an entire cluster.

The best way to use this library is to read and modify the examples.

RELEASE NOTES

As of December 2013, the code has been substantially updated to allow more powerful lambda abstraction. This has broken backward compatiblitiy (but allows a more intuitive specification of grammars and lambda terms). Updating to the newest version is recommended.

The original vesion of LOTlib was based on scheme code (available upon request -- [email protected]) and was ported to python 2.x in September 2011.

REQUIREMENTS

  • lockfile
  • numpy
  • scipy
  • mpi4py (if using MPI)
  • multiprocessing
  • pyparsing (for SimpleLambdaParser)

INSTALLATION

Put this library somewhere--mine lives in /home/piantado/Desktop/Libraries/LOTlib/

Set the PYTHONPATH environment variable to point to LOTlib/:

export PYTHONPATH=$PYTHONPATH:/home/piantado/Desktop/Libraries/LOTlib

You can put this into your .bashrc file to make it loaded automatically when you open a terminal. On ubuntu and most linux, this is:

echo 'export PYTHONPATH=$PYTHONPATH:/home/piantado/Desktop/Libraries/LOTlib' >> ~/.bashrc

And you should be ready to use the library via:

import LOTlib

in python 2.x.

EXAMPLES

A good starting place is the FOL folder, which contains a simple example to generate first-order logical expressions. These have simple boolean functions as well as lambda expressions.

The best reference for learning how to create/modify grammars is FunctionNodeDemo in Examples. It contains all of the syntax for various parts of grammars.

More examples are provided in the "Examples" folder. These include simple symbolic regression, the recursive number learning model, a quantifier learning model. The "tests" folder may also be useful, as this runs some simple models to check for, e.g., correct sampling and inference. The Number demo has syntax for a number of different sampling and inference schemes included in LOTlib.

lotlib's People

Contributors

piantado avatar ov3y avatar gamahead avatar

Watchers

James Cloos avatar  avatar

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.