Code Monkey home page Code Monkey logo

mln_generator's Introduction

MLN_Generator

Code for converting a learned First-Order Bayesian Network to a Markov Logic Network.

Input:

  • A relational database
  • A learned Bayesian network (using FactorBase).

Output:

A .mln file containing

  • Markov Logic Network formulas.
  • Weights for the formulas.

How to Use

  1. First import data into your database and run FactorBase.
  2. Set up a configuration file as for running FactorBase. If you use MLNExporter after Factorbase, you can just keep the same configuration file.
  3. Convert the learned BN into MLN by running java -jar MLNExporter.jar .

Our conversion method follows the moralization method of Domingos and Richardson; see also the Alchemy FAQ.

Notes and Limitations

Currently we add unit clauses as recommended by Domingos and Richardson at the bottom of the file. (e.g. RA(Student, Prof)). We do not output weights for the unit clauses.

  • If you want an MLN structure with weights assigned to each formula, delete the unit clauses.
  • If you want an MLN structure without weights, leave the unit clauses, and delete the weights.

mln_generator's People

Contributors

oschulte avatar vidhijain avatar

Watchers

James Cloos avatar Jeffery (Zeyu) Zhao avatar  avatar  avatar

mln_generator's Issues

Add weights for unit clauses

And convert weights to mutual information. Check our experimental results to verify that this works better than the simple moralization.

improve write-up

  • how to set up configuration file
  • where do I find the output file
  • anything else helpful to user

What are the prerequisites to run MLN_Generator?

I ran the MLN_Generator for tutorial_Mondial dataset and obtained the following

Start Writing MLN...
Writing Header...
Writing Rules..
com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'tutorial_Mondial_BN.NumAttributes' doesn't exist
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
	at com.mysql.jdbc.Util.getInstance(Util.java:386)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1053)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4096)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4028)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2490)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2651)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2728)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2678)
	at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:894)
	at com.mysql.jdbc.StatementImpl.execute(StatementImpl.java:732)
	at MLNExporter.Exporter.bodyBuilder(Exporter.java:272)
	at MLNExporter.Exporter.strBuilder(Exporter.java:422)
	at MLNExporter.Exporter.main(Exporter.java:53)
Finished Writing MLN...

The existence of <dbName>_BN database is not sufficient. A user must ensure that <dbName>_BN database must contain table NumAttributes before one runs the MLN_Generator.

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.