A Functor Bayes net can be converted to a Markov Logic Network using moralization. In graphical terms, moralization connects co-parents and omits edge directions. In logical terms, clauses become conjunctions. To obtain more compact Markov Logic Networks and better results, we recommend using context-sensitive moralization, which first compresses the conditional probability tables using decision trees before converting to MLN formulas. The standard method for converting conditional probabilities to Markov random field parameters is to use the logarithms of the conditional probabilities as weights in a log-linear model. Our research indicates that log-conditional probabilities provide acceptable but not optimal performance because of the balancing problem. Basically, formulas with many groundings carry exponentially more weight unless the associated weights are scaled. We have investigated different ways of addressing this issue, therefore different parameter learning options are provided.

The main file is packaged into a jar file. The input taken in by the package is a name of a database that already exists in an MYSQL and the output is an MLN structure with weights for the given dataset.

System Requirements

  • The system runs under Unix.
  • You need Java version 1.6 or greater.
  • An installation of MySQL. The command "mysql" should work from the command line.

Database requirements:

  1. The database is expected to consist of entity and relationship tables (ER model). The primary key of the entities should should end with "_id".
  2. Foreign key constraints should be set for relationship tables. The foreign keys should cascade on delete.

In order to use the package, please follow these steps.

  1. Download the package from [here]
  2. The package contains MBN_learning.jar, MBN_dt_learning.jar and a config.xml file.
  3. Change directory into the directory where you extract the package. You now have two options.
    1. The basic conversion method using standard moralization and log-conditional probabilities: run "java -jar MBN_learning.jar foo log" in a linux terminal command where foo is the name of a schema already in your MYSQL. By default, this adds unit clauses for each predicate. Within the Tetrad GUI, this routine can be called by clicking on dbEstimator, Export, Parameter Learning Output (MBN).
    2. Recommended: Context-sensitive moralization using decision trees and unit clauses: run "java -jar MBN_dt_learning.jar foo dtlsn" in a linux terminal command where foo is the name of a schema already in your MYSQL. By default, this adds unit clauses for each predicate. Within the Tetrad GUI, this routine can be called by clicking on dbEstimator, Export, Decision Tree with Weight.
    There are other options for investigating different combinations of decision tree learning (on/off) with parameter conversion. If you want to investigate these, please see the Developer's Manual.
Interpretation of Weights:
  1. For unit clauses, the weight is the log-probability of the literal in the database. E.g., the weight of Intelligence(S,3) would be the logarithm of the percentage of students with intelligence level 3.
  2. For other conditional clauses, the weight is the log-difference between the Bayes net conditional frequency and the database unconditional frequency. E.g, given that the Bayes net contains a parameter P(int(S,3)|rank(S,1)) = 60%, and P(int(S,3)) = 20% in the database, the weight of clause int(S,3), rank(S,1) would be log(60%) - log(20%).
Put in terms of clauses, this means that the weight measures how much the condition in the body (parent values) changes the probability of the head (child value). So a weight of 0 means that the body makes no difference to the conditional probability. A positive weight means that the body increases the probability of the head, a negative weight means a decrease in probability. We have an ILP 2012 paper coming out on the log-difference method, will post when the final version is done.

Examples

Examples of MLN files [here].

We go through the steps above with a database server called kripke and a database schema called University hosted on Kripke.

  1. Modify the config.xml file to replace the line jdbc:mysql://kripke/ such "kripke" is replaced by your database server name.
  2. Change directory into the directory where you extract the package and run "java -jar MBN_learning.jar University log" in a linux terminal command where University is the name of a schema already in your MYSQL database.

Wish List

  1. Output rules in datalog format + conditional probabilities.