0% found this document useful (0 votes)
40 views

Simple Vehicle Identification Mtheory: A Unbbayes-Mebn Tutorial

The document provides step-by-step instructions for creating a simple vehicle identification Bayesian network (BN) using the UnBBayes modeling tool. It describes how to create a new BN model called SimpleVehicleID_MTheory, add three fragments called Region_MFrag, Vehicle_MFrag and Reference_MFrag, define object types and states, and add nodes to represent variables like region type and vehicle type within each fragment. The instructions define the structure of the BN model through a series of defined steps.

Uploaded by

Abdou Soft
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Simple Vehicle Identification Mtheory: A Unbbayes-Mebn Tutorial

The document provides step-by-step instructions for creating a simple vehicle identification Bayesian network (BN) using the UnBBayes modeling tool. It describes how to create a new BN model called SimpleVehicleID_MTheory, add three fragments called Region_MFrag, Vehicle_MFrag and Reference_MFrag, define object types and states, and add nodes to represent variables like region type and vehicle type within each fragment. The instructions define the structure of the BN model through a series of defined steps.

Uploaded by

Abdou Soft
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Simple Vehicle Identification MTheory:

A UNBBayes-MEBN Tutorial
1. Start UnBBayes
a. Double-click the unbbayes.jar file. 2a.
(On Windows you can also run
unbbayes.bat; on Linux you can run
unbayes.sh)
2. Create new MTheory
a. Click “New MEBN” button on toolbar just below main menu bar.
3. Make 3 new MFrags
a. Click “New MFrag” button at left of MFrag editing pane.
b. In the MFrag name field, highlight “DMFrag1” and type “Region_MFrag.” Hit
“Enter.”

3a.



c. Click “New MFrag” button at left of MFrag editing pane.
d. In the MFrag name field, highlight “DMFrag2” and type “Vehicle_MFrag.” Hit
“Enter.”
e. Click “New MFrag” button at left of MFrag editing pane.
f. In the MFrag name field, highlight “DMFrag3” and type “Reference_MFrag.”
Hit “Enter.”
g. You now have three blank MFrags as shown below.

Ó 2019 Kathryn Blackmond Laskey - 1 - February, 2019


h. Note that you can resize windows by dragging the window borders as shown
below.

3h.

4. Rename your MTheory.


a. Click “Edit MTheory” button at left of MFrag editing pane as shown below.
b. Highlight the text “MEBN” in the MTheory name field and change to
“SimpleVehicleID_MTheory. Hit “Enter.”

4b.

4a.

Ó 2019 Kathryn Blackmond Laskey - 2 - February, 2019


5. Save your empty MTheory.
5a.
a. Click on “Save Net” button on toolbar
just below main menu bar.
b. Type “SimpleVehicleID.ubf” in the file
name box and push “Save” button.
6. Define object types.
a. Click “Show entities of the MTheory” button above the MTheory tree.
b. Highlight “ObjectEntity” as the parent entity type.
c. Click “+” to add a new entity type. (You may want to expand the size of the
Entity pane by dragging the window border as described in 3h.)
d. Change the name “EX2” in the name field to “Region” and hit “enter.”

6b.

6c.
6d.


e. Highlight ObjectEntity and Click “+” again.
f. Change the name “EX3” in the name field to “Vehicle.”
g. Save your MTheory again. You may want to keep partial models at different
stages. To do this, you can use the “File > Save as…” menu item, click on the
file, and then edit the name to “SimpleVehicleID_v2.ubf” to indicate the
version number.
7. Define IsA context node in the Region MFrag.
a. Click “Edit the MTheory” button (see 4a.)
b. Double-click “Region_MFrag” in the MTheory tree. Make sure “Region_MFrag”
appears above the editing pane.
c. Click the “Insert Ordinary Variable” button at left of editing pane.
d. Move cursor to top of the MFrag palette and click to drop an IsA node into the
MFrag.
e. Select “Region” from the drop-down list of types.
f. Change the name “OX1” to “rgn” in the ordinary variable name field.
g. Right-click on the IsA node and select “Resize to fit text” or resize by dragging
the node border. Your MFrag should now look like the figure below.

Ó 2019 Kathryn Blackmond Laskey - 3 - February, 2019


7f. 7e.

7c.


8. Define resident node in Region MFrag.
a. Click the “Insert Resident Node” button at left of editing pane.
b. Move cursor onto palette below the IsA node and click to drop a new resident
node onto the palette.
c. Highlight the name “RX1” in the name field at the top of the editing pane and
change to “RegionType. Hit “Enter.” Resize the new resident node as in 7g.
d. In the Resident Node pane, click the “Edit Arguments” button shown as “()” to
select the ordinary variable for this resident node. You may need to resize
the top-left pane as described in 3h.
e. Double-click on “rgn (Region)” to insert the ordinary variable. Resize the
resident node as in 7g.

8c.

8d.

8e. 8a.

8f.

Ó 2019 Kathryn Blackmond Laskey - 4 - February, 2019


f. If you accidentally drop an extra node onto the diagram, you can remove it
with the shredder button to the left of the editing pane.
9. Define states for the resident node.
a. Click on the “Edit States” button in 9a.
the top-left pane. The name of the
pane will change from
“Arguments” to “Resident node.”
b. Type “OffRoad” into the name
field and push Enter or the “+”
button. A new state will appear in
the states pane. 9b.
c. Type “OnRoad” into the name
field and push Enter or the “+”
button. A new state will appear in
the states pane as shown to the
right.
d. Save your MTheory again with a new version number.
10. Define nodes and states for the Reference MFrag.
a. Click “Edit the MTheory” button (see 4a.)
b. Double-click “Reference_MFrag” in the MTheory tree. Make sure
“Reference_MFrag” appears above the editing pane.
c. Click the “Insert Ordinary Variable” button at left of editing pane. (See 7c.)
d. Move cursor to top of the MFrag palette and click to drop an IsA node into the
MFrag.
e. Select “Vehicle” from the drop-down list of types.
f. Change the name “OX1” to “veh” in the ordinary variable name field.
g. Click the “Insert Resident Node” button at left of the editing pane. (See 8a.)
h. Move the cursor onto the palette below the IsA node and click to drop a new
resident node onto the palette.
i. Highlight the name “RX2” in the name field at the top of the editing pane and
change to “Location. Hit “Enter.”
Use Edit Arguments “()” to add the
veh ordinary variable as an
10k.
argument (See 8d.)
j. Click on the “Edit States” button in
the top-left pane.
k. Click “Insert object entity states”
button to indicate that the
Location(veh) random variable has
entity instances for its states. 10m. 10l.
l. Select “Region” from the drop-down
menu of entity types.
m. Click “+” to indicate that the
Location(veh) random variable has Region instances as its states.
n. Resize both nodes in the MFrag as described in 7g.

Ó 2019 Kathryn Blackmond Laskey - 5 - February, 2019





11e. 11d.

11. Define nodes and states for the Vehicle MFrag.


a. Click “Edit the MTheory” button (see 4a.) and double-click “Vehicle_MFrag” in
the MTheory tree.
b. Add two IsA nodes: IsA(veh, Vehicle) and IsA(rgn, Region) as described in
Steps 7 and 10 above.
c. Insert a resident node VehicleType(veh) as described in Step 8 above. Give it
category states Tracked and Wheeled as described in Step 9 above.
d. Click “Insert input node” at the left of the editing pane. Click on the editing
pane to drop a new blank input node into the MFrag.
e. Find “RegionType” in the Resident List and double-click to point the new
input node to the RegionType random variable in the Region MFrag.

11f.

11g.

Ó 2019 Kathryn Blackmond Laskey - 6 - February, 2019


f. Click the RegionType input node and select “rgn” from the drop-down list of
arguments. Resize the RegionType input node.
g. Select the arc tool from left of the MFrag pane and draw an arc from
RegionType to VehicleType.

11i.

11h.


h. Add the reference context node. Click “Insert context node” to the left of the
editing pane and insert a blank context node onto the editing pane. This
reference node will represent the knowledge that the link between the
RegionType of a region and VehicleType of a vehicle applies when the vehicle
is located in the region.
i. Click “formula” in the Context Node pane at the upper left of the window.
j. Click the “=” button above the formula area. The expression (op_1=op_2) will
appear inside the context node.
k. Highlight “op_1” in the formula area. Click the “Add ordinary variable” button
below the formula area.

11h.

Ó 2019 Kathryn Blackmond Laskey - 7 - February, 2019


l. Double-click “rgn” in the list of ordinary variables that appears below the
row of buttons. Notice that “op_1” changes to “rgn” in the context node.
m. Highlight “op_2” in the formula area. Click the “Add node” button.
n. Double-click “Location” in the list of nodes that appears below the row of
buttons. Notice that “op_2” changes to Location() in the context node.
o. Double-click “Location” in the formula area to produce a drop-down list of
arguments in the area below the row of buttons.
p. Choose “veh” from the list of arguments. Now the context node
rgn=Location(veh) is complete.
q. Save your MTheory. You now have the structural part of your probabilistic
ontology! Our next step is to define the probabilities.

11o.


12. Define local distribution for RegionType random variable.
a. Click “Edit the MTheory” button and double-click “RegionType” random variable
in the MTheory tree. (If you do not see the random variable, you can expand the
Region MFrag to show its random variables by clicking on the triangle to the left
of the MFrag name. Or you can double-click the MFrag and then select the
RegionType random variable in the editing pane.)
b. With the RegionType node selected, click the distribution button “#” in the
Resident Node area. A box will pop up for the distribution.
c. Click the “default” button. A formula will appear in the blank node window.
d. Change the word “formula” after each of the states to 0.75 for OnRoad and 0.25
for OffRoad. Be careful not to erase the comma after the probability for the first
state.
e. Click “Compile.” You should see a message that the table compiled successfully.
Click “Save,” and then click “Exit.” (Make sure you click “Save” or your edits will be
lost.)

Ó 2019 Kathryn Blackmond Laskey - 8 - February, 2019


12b.

13. Define local distribution for VehicleType random variable.


a. Click “Edit the MTheory” button and double-click “VehicleType” random variable
in the MTheory tree. (If you do not see the random variable, you can expand the
Vehicle MFrag to show its random variables by clicking on the triangle to the left
of the MFrag name. Or you can double-click the MFrag and then select the
VehicleType random variable in the editing pane.)
b. With the VehicleType node selected, click the distribution button “#” in the
Resident Node area. A box will pop up for the distribution.
c. Click the “if any” button. A formula will appear in the blank node window.
d. Change the text “paramSubSet” to “rgn”. (You can type it directly, or you can
double-click “paramSubSet” to select it, click “RegionType” to select it, and then
double-click “rgn” in the Arguments area.)
e. Change the text “booleanFunction” to “RegionType=OffRoad”. (You can type it
directly, or you can select the text “booleanFunction”, click the “=” , select the
text “Node”, double-click “RegionType” in the Nodes area, then select the text
“NodeState” and double-click “OffRoad” in the States area.)
f. Change the word “formula” after each of the states to 1 for Tracked and 0 for
Wheeled. Be careful not to erase the comma after the probability for the first
state. You have told UnBBayes that when RegionType is OffRoad, then
VehicleType must be Tracked.
g. Now place the cursor after the “]” and click the “else” button. Change the word
“formula” after each of the states to 0.1 for Tracked and 0.9 for Wheeled. Be
careful not to erase the comma after
the probability for the first state. You
have told UnBBayes that when
RegionType is OnRoad, the
VehicleType is probably (90%)
Wheeled.
h. Click “Compile.” You should see a
message that the table compiled

Ó 2019 Kathryn Blackmond Laskey - 9 - February, 2019


successfully. Click “Save,” and then click “Exit.” (Make sure you click “Save” or
your edits will be lost.)
i. Now you have a complete probabilistic ontology.
Congratulations! You can observe your whole
MTheory by clicking the “See MTheory” button 14a.
(MTheory symbol with a magnifying glass on the
top menu). You can return to Edit mode by
clicking the clipboard button. Save your model
with a new version number.
14. Now that we have a probabilistic ontology, we are
going to define some instances. We will start with
14b.
one vehicle and one region.
a. Click “Show entity existence editing pane”.
Highlight “Vehicle” in the list of entity types
that appears in the upper left pane.
b. Type “Veh1” in the Name field and click “+”
or hit the Enter key. You have defined an object instance called “Veh1”.
c. Now define a region instance called “Reg1”.
d. Save the MTheory with a new version number.
15. Now we will tell UnBBayes where Object1 is
located.
15a.
a. Click “Show findings editing pane”.
b. Highlight “Location(0)”
c. Click the pencil to bring up the
finding: Location pane.
d. Choose “Veh1” from the drop-down
menu of arguments and click “+” to
add a finding that Veh1 is located in
Reg1.
e. Save the evidence. UnBBayes keeps
findings in a separate file from the
MTheory and entity instances.
Choose “Save Knowledge Base” and
enter the filename
16a.
“SimpleVehicleID.plm”.
16. We are now ready to run a query.
a. Click the “Execute Query” button.
16b.
b. In the popup query window,
highlight “VehicleType” and push
the “Select” button.
c. Select “Veh1” from the drop-
down menu of entity instances.
d. Click the “Execute” button. A
Bayesian network will appear.
17. Add some more entities and evidence.
a. Click the “Return to edit mode” button to return to editing the MTheory.

Ó 2019 Kathryn Blackmond Laskey - 10 - February, 2019


b. Add three more object
instances, named Veh2, Veh3
and Veh4.
c. Add evidence that the new 17a.
objects are located in Reg1
and that Veh2 and Veh3 have
VehicleType equal to Tracked.
d. Run the same query again.
That is, repeat Step 16. Notice
that the situation-specific
Bayesian network has more
nodes than before. Notice also the change in beliefs about the VehicleType of
Veh1 and the RegionType of Reg1. Do these changes seem reasonable to you?
Notice that even though Veh4 is located in Reg1, VehicleType(Veh4) does not
appear in the situation-specific Bayesian network. This is because it is not
needed to compute the result of the query. Try also running a query on
VehicleType(Veh4). What do you see?
e. Save this knowledge base with the filename “SimpleVehicleID_4objects.plm”.


18. Now try adding another node “Speed” to represent the vehicle speed, as shown
below.
a. Add the Speed(veh) node to the Vehicle MFrag as in Step 11 above.
b. Give it states “Slow” and “Fast”.
c. Draw an arc from VehicleType(veh) to Speed(veh).
d. Give it the distribution as shown below.
e. Try different evidence and different queries. Notice that the situation-specific
Bayesian network will include only the nodes necessary to answer your
query. See the examples below with the same MTheory, the same four
objects, and different evidence.

Ó 2019 Kathryn Blackmond Laskey - 11 - February, 2019





Ó 2019 Kathryn Blackmond Laskey - 12 - February, 2019

You might also like