UnBBayes Plugin Framework
Upcoming SlideShare
Loading in...5

UnBBayes Plugin Framework



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, ...

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/).



Total Views
Views on SlideShare
Embed Views



4 Embeds 955

http://unbbayes.sourceforge.net 946
http://www.slideshare.net 5
http://www.linkedin.com 3
http://translate.googleusercontent.com 1



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

UnBBayes Plugin Framework UnBBayes Plugin Framework Presentation Transcript

  • UnBBayes – Plugin Feature Overview ~ Usage and development of plugins for UnBBayes ~ 1 02/07/2010 Contact: Shou Matsumoto (cardialfly@[yahoo|gmail].com)
  • 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/
  • 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/>
  • 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
  • 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
  • General Features Features & Benefits Plugin dependency Plugin’s version control Plugins for Plugins Hotplug Flexible I/O handler 6
  • 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)
  • 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.
  • 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)
  • 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
  • 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
  • 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
  • Summary of extension points New Split button for new modules Modules I/O New Nodes and CPD Inference 13 Localization Algorithm
  • Datamining Module - UnBMiner Sample Plugins 14 A tool with 10 functionalities for massive data handling
  • Metaphor – Medical, Human Identification Sample Plugins 15 A tool that offers an easy interface for finding entries and analisis. Expert Systems.
  • Sampling - Likelihood Weighting, Monte Carlo, Gibbs Sample Plugins 16 Generation of sample data sets from a given network.
  • Inference Algorithms – Likelihood Weighting, Gibbs Sample Plugins 17 We can select another algorithm to compile a network under the core
  • OOBN Module’s Japanese Localization Sample Plugins 18 It is possible to add resource files as plugin
  • I/O – DNE, XMLBIF, NET Sample Plugins 19 Save or load different network file formats
  • Conditional Probability Distribution Using Scripts Sample Plugins 20 It is possible to edit a Conditional Probability Distribution using scripts
  • 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)
  • Folder Structure Place the plugins here Specification These are default plugins that come with the core 22
  • 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.
  • Sample Module - UnBMiner <?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.datamining" version="0.0.1"> <requires> <import plugin-id="unbbayes.util.extension.core"/> </requires> <runtime> <library id="unbminer" path="classes/" type="code"> <export prefix="*" /> </library> <library type="resources" path="icons/" id="icons" /> </runtime> <extension plugin-id="unbbayes.util.extension.core" point-id="Module" id="unbminer"> <parameter id="class" value="unbbayes.datamining.gui.extension.UnBMinerJPFModule" /> <parameter id="name" value="Data Mining Project" /> <parameter id="builder" value="unbbayes.datamining.gui.extension.UnBMinerJPFModule" /> <parameter id="description" value="UnBBayes Dataminer - UnBMiner" /> <parameter id="icon" value="mining.png" /> <parameter id="category" value="tool" /> </extension> </plugin> 24 This is how UnBMiner's plugin descriptor (plugin.xml) looks like
  • 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
  • Sample Algorithm - Gibbs <?xml version="1.0" ?> <!DOCTYPE plugin PUBLIC "-//JPF//Java Plug-in Manifest 1.0" Extension Points’ Spec. "http://jpf.sourceforge.net/plugin_1_0.dtd"> <plugin id="unbbayes.simulation.sampling.GibbsSampling" version="1.0.0"> <requires><import plugin-id="unbbayes.util.extension.core"/><import plugin- id="unbbayes.simulation.montecarlo.sampling"/></requires> <runtime> <library id="gibbs" path="classes/" type="code"><export prefix="*" /></library> <library type="resources" path="icons/" id="icons" /> </runtime> <extension plugin-id="unbbayes.util.extension.core" point-id="Module" id="gibbsSampling"> <parameter id="class" value="unbbayes.gui.GibbsSamplingModule" /> <parameter id="name" value="Gibbs Sampling" /> <parameter id="builder" value="unbbayes.gui.GibbsSamplingModule" /> <parameter id="description" value="Sampling using Gibbs" /> <parameter id="icon" value="sampling.png" /> <parameter id="category" value="sampling" /> </extension> <extension plugin-id="unbbayes.util.extension.core" point-id="InferenceAlgorithm" id="gibbsAlgorithm"> <parameter id="class" value="unbbayes.gui.option.GibbsSamplingOptionPanel" /> </extension> </plugin> 26 A single plugin.xml may implement several extension points
  • 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
  • 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
  • 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
  • Sample Localization <?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.oobn.resources.ja" version="1.0.0"> <requires><import plugin-id="unbbayes.util.extension.core"/></requires> <runtime> <library id="oobnResource_ja" path="classes/" type="code"><export prefix="*" /></library> </runtime> <extension plugin-id="unbbayes.util.extension.core" point-id="ResourceBundle" id="oobn_gui_ja"> <parameter id="class" value="unbbayes.gui.oobn.resources.OOBNGuiResource_ja" /> </extension> <extension plugin-id="unbbayes.util.extension.core" point-id="ResourceBundle" id="oobn_controller_ja"> <parameter id="class" value="unbbayes.controller.oobn.resources.OOBNControllerResources_ja" /> </extension> <extension plugin-id="unbbayes.util.extension.core" point-id="ResourceBundle" id="oobn_io_ja"> <parameter id="class" value="unbbayes.io.oobn.resources.OOBNIOResources_ja" /> </extension> <extension plugin-id="unbbayes.util.extension.core" point-id="ResourceBundle" id="oobn_prs_ja"> <parameter id="class" value="unbbayes.prs.oobn.resources.Resources_ja" /> </extension> </plugin> 30 Unfortunatelly, most of classes load resources statically, so hotplug is only partial.
  • 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
  • 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.
  • 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
  • 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
  • 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
  • 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