UnBBayes is a probabilistic network framework written in Java. It has both a GUI and an API with inference, sampling, learning and evaluation. It supports BN, ID, MSBN, OOBN, HBN, MEBN/PR-OWL, structure, parameter and incremental learning.
This presentation talks about UnBBayes version 4.0.0, which is the first version that supports plugins. In it we present the major concepts behind this Plugin Framework, features and benefits, applications, some sample plugins, specification, extension points, and availability.
This presentation was given by Shou Matsumoto from the University of Brasilia in Brazil via web conference to PhD students at George Mason University in the US on the Friday seminar called Krypton (http://krypton.c4i.gmu.edu/).
1. UnBBayes – Plugin
Feature Overview
~ Usage and development of plugins for UnBBayes ~
1 02/07/2010
Contact: Shou Matsumoto (cardialfly@[yahoo|gmail].com)
2. Contents
Concepts
Features & Benefits
Applications
Sample Plugins (you may skip this section)
Specification
Extension Points’ Spec. (you may skip this section)
Availability
2
Project page: http://sourceforge.net/projects/unbbayes/
3. What is UnBBayes?
UnBBayes is a probabilistic network
framework written in Java. It has both a
Concepts
GUI and an API with inference,
sampling, learning and evaluation. It
supports BN, ID, MSBN, OOBN, HBN,
MEBN/PR-OWL, structure, parameter
and incremental learning.
3 Source: <http://sourceforge.net/projects/unbbayes/>
4. What is a plugin?
A plugin consists of a computer program that
interacts with a host application to provide a
certain, usually very specific, function "on
Concepts
demand“ [wikipedia].
An UnBBayes’ plugin can be a folder, a ZIP or
a JAR file located in “plugins” folder.
Content of an ordinal UnBBayes’ plugin:
– Plugin descriptor (XML file)
– Classes (a program)
– Resources (e.g. icons, message files...)
4 A plugin descriptor is the main and minimal content of a plugin
5. General Benefits of Plugins
Features & Benefits
To enable third-party developers to create
capabilities to extend an application
To support features yet unforeseen
To reduce the size of each application
To separate source code from an application
because of incompatible software licenses.
Modularization/Componentization of the
software
– Interfaces are modeled as extension points.
5 Modularization/componentization = organized system
6. General Features
Features & Benefits
Plugin dependency
Plugin’s version control
Plugins for Plugins
Hotplug
Flexible I/O handler
6
7. Plugin dependency
We can develop new plugins reusing a pre-
Features & Benefits
existing one.
– A plugin may have some dependency to a pre-
existing one.
Pros:
– Fast development
– Less redundancy – smaller programs
Contras.
– Dependency hell
• If my plugin depends on “A” and “A” depends on “B” and
so on, my plugin will not work until the user obtains all
the dependencies.
7 A dependency is declared in plugin descriptor (XML)
8. Plugin’s version control
Features & Benefits
The application can manage several
different versions of a plugin.
– E.g. version 1.0.0, version 5.2.1...
Usually, the newest version is loaded by
the application.
– Except if a given plugin claims dependency
to a unique version.
8 There is no need to overwrite files in order to overwrite features anymore.
9. Plugins for Plugins
Features & Benefits
...This application, under the academic
world, shall have a new birth of freedom
-- and that government of the plugin, by
the plugin, for the plugin, shall not perish
from the earth.
– If a plugin has an extension point, we can
add a plugin for it.
– In another words, we can have plugins
adding functionalities to another plugin.
9 An extension point is declared in plugin descriptor (XML)
10. Hotplug
Features & Benefits
Usually, there is no need to restart the
application in order to enable a plugin.
– Obviously, there are some exceptions.
UnBBayes has a menu item to “reload”
plugins at runtime.
10
11. Flexible I/O handler
If more than one module plugin can handle a file,
Features & Benefits
ask for the user.
If more than one I/O plugin can handle a file, ask
for the user.
11 File handling is flexible
12. Applications
Development of a full new functionality
– Projects / Modules
Applications
– New formalisms
Development of a new file format.
Modeling new node types and/or CPD
Usage of new Inference Algorithms
Localization
– E.g. Spanish, Japanese
12
13. Summary of
extension points
New Split button for new modules
Modules
I/O
New Nodes
and CPD
Inference
13 Localization Algorithm
14. Datamining Module -
UnBMiner
Sample Plugins
14 A tool with 10 functionalities for massive data handling
15. Metaphor – Medical,
Human Identification
Sample Plugins
15 A tool that offers an easy interface for finding entries and analisis. Expert Systems.
16. Sampling - Likelihood
Weighting, Monte Carlo, Gibbs
Sample Plugins
16 Generation of sample data sets from a given network.
17. Inference Algorithms –
Likelihood Weighting, Gibbs
Sample Plugins
17 We can select another algorithm to compile a network under the core
18. OOBN Module’s Japanese
Localization
Sample Plugins
18 It is possible to add resource files as plugin
19. I/O – DNE, XMLBIF, NET
Sample Plugins
19 Save or load different network file formats
20. Conditional Probability
Distribution Using Scripts
Sample Plugins
20 It is possible to edit a Conditional Probability Distribution using scripts
21. Specification
UnBBayes uses Java Plugin Framework (JPF)
for plugin support.
Specification
– JPF is a open-source, LGPL licenced plug-in
mechanism adapted from Eclipse's plug-in
mechanism.
The “core” of UnBBayes is the BN module.
– All other modules/functionalities are being
refactored as plugins.
The core has its plugin descriptor to declare
extension points (unbbayes.core).
21 Everything is configured using plugin descriptors (XML)
22. Folder Structure
Place the
plugins here
Specification
These are
default plugins
that come
with the core
22
23. Modules
Extension Points’ Spec.
UnBBayes' modules are basically swing
internal frames.
<extension-point id="Module">
<!--class extends unbbayes.util.extension.UnBBayesModule-->
<parameter-def id="class"/>
<!--builder implements unbbayes.util.extension.UnBBayesModuleBuilder-->
<parameter-def id="builder" multiplicity="none-or-one" />
<parameter-def id="name"/>
<parameter-def id="description" multiplicity="none-or-one" />
<parameter-def id="icon" multiplicity="none-or-one" />
<!--category creates new menu items on demmand-->
<parameter-def id="category" multiplicity="none-or-one" />
</extension-point>
23 These XML definitions follow the JPF specification.
25. Inference Algorithm
Extension Points’ Spec.
This is basically a panel (for options)
– This panel holds an implementation of
unbbayes.util.extension.bn.inference.IInferenceAlgorithm,
which runs a specific inference algorithm.
<extension-point id="InferenceAlgorithm">
<!--class extends
unbbayes.util.extension.bn.inference.InferenceAlgorithmOptionPanel-->
<parameter-def id="class"/>
</extension-point>
25 Inference Algorithms are usually started when we "compile" a BN
27. I/O
This is just a combination of
Extension Points’ Spec.
unbbayes.io.BaseIO and a name
– The name is displayed when a conflict occurs
<extension-point id="PNIO">
<parameter-def id="class"/>
<parameter-def id="name"/>
</extension-point>
27 A single plugin.xml may specify several extension points - a plugin may expect several plugins
28. Sample I/O - DNE
Extension Points’ Spec.
<?xml version="1.0" ?>
<!DOCTYPE plugin PUBLIC "-//JPF//Java Plug-in Manifest 1.0"
"http://jpf.sourceforge.net/plugin_1_0.dtd">
<plugin id="unbbayes.io.DneIO" version="1.0.0">
<requires>
<import plugin-id="unbbayes.util.extension.core"/>
</requires>
<extension plugin-id="unbbayes.util.extension.core" point-id="PNIO"
id="DneIO">
<parameter id="class" value="unbbayes.io.DneIO" />
<parameter id="name" value="DNE" />
</extension>
</plugin>
28 This is how DNE's plugin descriptor (plugin.xml) looks like
29. Resources - Localization
Extension Points’ Spec.
This is basically a
java.util.ListResourceBundle
– Naming: <ClassName>_<LocaleID>
• Resources_es.class (Spanish)
• Resources_pt.class (Portuguese)
• Resources_ja.class (Japanese)
<extension-point id="ResourceBundle">
<parameter-def id="class"/>
</extension-point>
29 This extension point is a bridge between JPF mechanism and ResourceBundle mechanism
31. New Types of Nodes
This is a Node and a set of additional information
Extension Points’ Spec.
to display it within GUI.
<extension-point id="PluginNode">
<!--class implements unbbayes.prs.extension.IPluginNode-->
<parameter-def id="class"/>
<!--shapeClass implements unbbayes.draw.extension.IPluginUShape-->
<parameter-def id="shapeClass"/>
<parameter-def id="name"/>
<!--panelBuilder implements unbbayes.gui.table.extension.IProbabilityFunctionPanelBuilder-->
<parameter-def id="panelBuilder"/>
<parameter-def id="description" multiplicity="none-or-one" />
<parameter-def id="icon" multiplicity="none-or-one" />
<parameter-def id="cursor" multiplicity="none-or-one" />
</extension-point>
31 Inference algorithms or I/O must be implemented separately to compile/save these nodes
32. Sample Nodes
<?xml version="1.0" ?>
Extension Points’ Spec.
<!DOCTYPE plugin PUBLIC "-//JPF//Java Plug-in Manifest 1.0" "http://jpf.sourceforge.net/plugin_1_0.dtd">
<plugin id="unbbayes.prs.extension.impl.ProbabilisticNodePluginStub" version="1.0.0">
<requires> <import plugin-id="unbbayes.util.extension.core"/> </requires>
<runtime>
<library id="ProbabilisticNodePluginStub" path="classes/" type="code">
<export prefix="*" />
</library>
<library type="resources" path="icons/" id="ProbabilisticNodePluginStub_icons" />
</runtime>
<extension plugin-id="unbbayes.util.extension.core" point-id="PluginNode" id="ProbabilisticNodePluginStub">
<parameter id="class" value="unbbayes.prs.extension.impl.ProbabilisticNodePluginStub" />
<parameter id="shapeClass" value="unbbayes.draw.extension.impl.DefaultPluginUShape" />
<parameter id="name" value="Boolean Node For Plugin Test" />
<parameter id="panelBuilder" value= "unbbayes.gui.table.extension.StubPanelBuilder" />
<parameter id="description" value="This is a stub in order to test plugins" />
<parameter id="icon" value="icon_stub.gif" />
<parameter id="cursor" value="cursor_stub.gif" />
</extension>
</plugin>
32 This is a sample stub.
33. Probability Distribution
Editor
Extension Points’ Spec.
Identical to “New Node Type” plugin
– Difference: these are for nodes already
incorporated into UnBBayes’ core
• E.g. unbbayes.prs.bn.ProbabilisticNode
<extension-point id="ProbabilityFunctionPanel">
<parameter-def id="class"/> <!--Node‘s class-->
<parameter-def id="name"/>
<parameter-def id="panelBuilder"/> <!--Panel to edit node-->
<parameter-def id="description" multiplicity="none-or-one" />
<parameter-def id="icon" multiplicity="none-or-one" />
</extension-point>
33 See the specs of "New Node Type" plugin for details
34. Sample Probability
Distribution Editor
<?xml version="1.0" ?>
Extension Points’ Spec.
<!DOCTYPE plugin PUBLIC "-//JPF//Java Plug-in Manifest 1.0" "http://jpf.sourceforge.net/plugin_1_0.dtd">
<plugin id="edu.gmu.seor.prognos.unbbayesplugin.cps" version="1.0.0">
<requires> <import plugin-id="unbbayes.util.extension.core"/> </requires>
<runtime>
<library id="cps" path="classes/" type="code">
<export prefix="*" />
</library>
<library type="resources" path="icons/" id="cps_icons" />
</runtime>
<extension plugin-id="unbbayes.util.extension.core" point-id="ProbabilityFunctionPanel"
id="cps_ProbabilisticNode">
<parameter id="class" value="unbbayes.prs.bn.ProbabilisticNode" />
<parameter id="name" value="Script edition" />
<parameter id="panelBuilder" value=
"edu.gmu.seor.prognos.unbbayesplugin.cps.gui.extension.CPSPanelBuilder" />
<parameter id="description" value="Edit conditional probability function using scripts" />
<parameter id="icon" value="new_script.png" />
</extension>
</plugin>
34 This is the plugin descriptor (plugin.xml) for CPS plugin
35. Availability
Currently, these extension points and
sample plugins are only available in the
Availability
sourceforge’s SVN (trunk).
– By now, there are no releases supporting
plugins yet.
SVN repository URL:
– https://unbbayes.svn.sourceforge.net/svnroot
/unbbayes/trunk/UnBBayes
35 A release version for UnBBayes w/ plugin support is yet to come
36. Finally
What plugins can do for you
Plugins can enable third-party developers to
extend UnBBayes
– Develop features yet unforeseen
• New formalisms
• Customization
– Flexible software license
• Separate sources of incompatible licenses.
– Fast development
• Plugin dependency control
Plugins reduce the size of UnBBayes
– Distribution is easier and application is light
36 Although this is already an open source project, plugins makes it easier to customize