HML-UnBBayes Plugin

Back to plugin page



Developer Guide

1) Introduction
2) Installing the HML Core
3) Using the HML Core in Text Mode
4) Limitations for the relational dataset
5) Large size of the relational dataset
6) Structure of HML-UnBBayes Plugin




1) Introduction

This guide goes through supporting development of HML-UnBBayes looking separately at the HML Core and then at the HML-UnBBayes plugin itself. The first part focus on giving an overview of using the HML Core in Text Mode and also addresses limitations of the tool.

Finally, the step-by-step below will guide you through the structure of the HML-UnBBayes plugin, so that developers can understand the plugin and to encourage future work.




2) Installing the HML Core

The HML Core requires three projects in the Git GMU_HMLP: ModelerLib, MEBN-RM, and MEBN_LN. ModelerLib is a JAVA project, which contains a set of libraries to support the projects MEBN-RM and MEBN_LN. The project MEBN-RM performs a mapping between MEBN and a relational model (RM) (e.g., a relational schema in a relational database). The project MEBN_LN contains MEBN learning algorithms. To install these projects, use the Git repository. The project HML(P)_TOOL contains several illustrative examples and a GUI for HML.






3) Using the HML Core in Text Mode

The project HML(P)_TOOL contains an example code, text_mode_continuous_heater_model.java. This code is used to learn a MEBN model from a MySQL database. In the code, we can find a method run(). The following introduces each step of the method.


3.1) Initialize RDB

Basically, HML starts from a relational database. The current version of HML uses MySQL. To access the relational database, the address, ID, and password are required. The method RDB.This().init(database) prepares initial settings for MEBN learning.




3.2) Perform MEBN-RM

After initializing the relational database, a MEBN-RM (Relational Model) mapping is performed. MEBN-RM converts the relational database to a partial MTheory. To see a result from the mapping, a method System.out.println(mTheory.toString("MFrag", "MNode")); can be used.




3.3) Add parents

HML requires a setting for causal relationships between MNodes in the partial MTheory. An MNode can be a childMNode which is a leaf node influenced by parentMNodes. Such an MNode can be expressed by a simple format “MFrag_name.MNode_name”. For example, the MNode HAI_energy in an MFrag heateractuator_item can be represented as “heateractuator_item.HAI_energy”.




3.4) Add contexts

HML requires joining rules for the relational dataset and context information. If there is nothing to join datasets, this step can be skipped.




3.5) Add CLD type

Each MNode can be associated with a particular type of class local distribution (CLD) (e.g., conditional linear Gaussian). A default CLD for a continuous random variable is conditional linear Gaussian. A default CLD for a discrete random variable is Dirichlet distribution.




3.6) Learn MEBN

To learn an MTheory, an MRoot is created. The MRoot is a container which includes a set of MTheories for MEBN learning. Each different MTheory is learned from the relational database.






4) Limitations for the relational dataset

HML is associated with a relational database such as MySQL. The current version of HML has some limitations for the relational dataset. MEBN developers are required to preprocess the relational dataset to ensure that MEBN learning performs well.






5) Large size of the relational dataset

In some case, the relational dataset can be very large (e.g., 100,000 rows in a table). In this case, it may be needed to increase a heap memory size (e.g., -Xms1024m and -Xmx4096m). Also, increasing memory in an operating computer can help.




6) Structure of HML-UnBBayes Plugin

To encourage the reuse of the plugin and also the extension of its capabilities, this section gives an overview of the plugin structure.

The HML-UnBBayes plugin works as an adapter between HML core and UnBBayes. Since both these two applications use MEBN but with different programming structures, the plugin is responsible for translating the concepts from HLM to UnBBayes, to allow the reuse of MEBN.

The class used by HML to deal with the plugin wizard is HMLP_Console. That class is related to the main class used on the plugin, MEBNConverter, which is responsible of adapting MEBN from HML to UnBBayes.

On the image below, we can the see a Class Diagram with the two classes mentioned above and a couple of other classes related to HML (on the left) and UnBBayes (on the right). It is clear that MEBNConverter works as an adapter of MEBNs from these two applications.




Using HML-UnBBayes plugin through the tool’s wizard, when HML process reaches the end, HMLP_Console uses the method convertMEBNAndOpenMEBNeditor. This method calls the appropriate methods of MEBNConverter to adapt the MEBN created from HML and the one to be loaded on UnBBayes’ MEBN GUI.

To illustrate the conversion process, the image below has a Collaboration Diagram, that gives an overview of the methods used by the plugin.