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:
- The database is expected to consist of entity and relationship tables (ER model). The primary key of the entities should should end with "_id".
- Foreign key constraints should be set for relationship tables. The foreign keys should cascade on delete.
- Download the package from [here]
- The package contains MBN_learning.jar, MBN_dt_learning.jar and a config.xml file.
- Change directory into the directory where you extract the package. You now have two options.
- 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).
- 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.
- 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.
- 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%).
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.- Modify the config.xml file to replace the line
jdbc:mysql://kripke/ such "kripke" is replaced by your database server name. - 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
- Output rules in datalog format + conditional probabilities.