Set the target state names with jsmile

The engine.
Post Reply
raywonqa
Posts: 4
Joined: Wed Sep 18, 2013 5:04 pm

Set the target state names with jsmile

Post by raywonqa » Thu Jan 30, 2014 9:12 pm

Is it possible to set the target names for the set of states associated with a node of Diagnostic type: Target ?

In the Genie UI, this can be done in the General tab of the Node properties dialog. Specifically, I would like to do the equivalent of setting the Target name format dropdown menu to User Defined, and then changing the name for each state as shown in the Special name column. I would like to perform this sequence of operations in Java using the jsmile library.
See the attached screen-shot of the dialog.

Thanks,
Ray
Attachments
NodeProperties.png
The Node properties dialog
NodeProperties.png (39.49 KiB) Viewed 2988 times

shooltz[BayesFusion]
Site Admin
Posts: 1247
Joined: Mon Nov 26, 2007 5:51 pm

Re: Set the target state names with jsmile

Post by shooltz[BayesFusion] » Thu Jan 30, 2014 10:26 pm

You can use one of the Network.setOutcomeLabel and Network.getOutcomeLabel overloads. These methods operate on the attribute called "Special Name" in GeNIe (when "Target name format" is set to "User Defined").

There's no jSMILE API for controlling the "Target name format" value displayed in GeNIe.

raywonqa
Posts: 4
Joined: Wed Sep 18, 2013 5:04 pm

Re: Set the target state names with jsmile

Post by raywonqa » Thu Jan 30, 2014 11:50 pm

You can use one of the Network.setOutcomeLabel and Network.getOutcomeLabel overloads. These methods operate on the attribute called "Special Name" in GeNIe (when "Target name format" is set to "User Defined").
I tried Network.setOutcomeLabel and it doesn't set the string in the "Special Name" column - it instead sets the string shown in the "State ID" column. I also tried Network.setOutcomeDescription (also unsuccessful).

Any other ideas?

shooltz[BayesFusion]
Site Admin
Posts: 1247
Joined: Mon Nov 26, 2007 5:51 pm

Re: Set the target state names with jsmile

Post by shooltz[BayesFusion] » Mon Feb 03, 2014 2:16 pm

raywonqa wrote:I tried Network.setOutcomeLabel and it doesn't set the string in the "Special Name" column - it instead sets the string shown in the "State ID" column.
You're right, the get/setOutcomeLabel methods do not work with the "Special name". Generally, the per-outcome attributes are a mess due to backward compatibility.
Any other ideas?
At this point access to "special name" from jSMILE would require adding new native methods to the library, unless you can modify the .xdsl with XML processing tools externally.

What platform are you using?

raywonqa
Posts: 4
Joined: Wed Sep 18, 2013 5:04 pm

Re: Set the target state names with jsmile

Post by raywonqa » Mon Feb 03, 2014 6:53 pm

As a point of reference, this was all necessitated because I found that the diagnostic tests recommended by Smile changed based on the alphabetical sort order of the fault names. Two models, both trained with the same learning data, behave differently. The model described by the 1st code code section (below) behaves differently from the model described in the 2nd (and the differences seen below are the only differences between the two .xdsl files).

I'm not a Beyes model expert at all, so I don't know if that's expected behavior or if it's a bug. It took me a while to determine that the sort order of the fault names affects the outcome probabilities and the diagnostic values of the tests. The sample model from which I was working (created using Genie and given to me by a colleague) just happened to have the faults named in such a way that they were were sorted alphabetically (in the diagnostic tree from which the model was created, and thus, in the .xdsl file). The model the Java code produces is created from an external source file, but it has the same structure and uses different names for all the nodes (which are not sorted alphabetically). The same learning data (adjusted for node names) is applied to both models.

Setting the fault name format to "user" and explicitly setting the names yields the desired behavior.
you can modify the .xdsl with XML processing tools externally
That's exactly what I did - hacked together some code to transform the .xdsl file. Specifically, this

Code: Select all

		<genie version="1.0" app="GeNIe 2.0.4843.0" name="Unnamed" faultnameformat="nodestate">
			<node id="Faults">
				<name>Faults</name>
				         .
				         .
				         .
becomes this

Code: Select all

		<genie version="1.0" app="GeNIe 2.0.4843.0" name="Unnamed" faultnameformat="user">
			<node id="Faults">
				<name>Faults</name>
				<state id="n28" faultname="s001_n28" />
				<state id="n120" faultname="s002_n120" />
				<state id="n116" faultname="s003_n116" />
				<state id="n107" faultname="s004_n107" />
				<state id="n104" faultname="s005_n104" />
				<state id="n101" faultname="s006_n101" />
				<state id="n97" faultname="s007_n97" />
				<state id="n91" faultname="s008_n91" />
				<state id="n94" faultname="s009_n94" />
				         .
				         .
				         .
What platform are you using?
Using Java 1.6 64-bit and Windows 7 64-bit. Is that what you mean by platform?

Thanks for the help, btw :)

shooltz[BayesFusion]
Site Admin
Posts: 1247
Joined: Mon Nov 26, 2007 5:51 pm

Re: Set the target state names with jsmile

Post by shooltz[BayesFusion] » Mon Feb 03, 2014 9:29 pm

raywonqa wrote:As a point of reference, this was all necessitated because I found that the diagnostic tests recommended by Smile changed based on the alphabetical sort order of the fault names. Two models, both trained with the same learning data, behave differently. The model described by the 1st code code section (below) behaves differently from the model described in the 2nd (and the differences seen below are the only differences between the two .xdsl files).
The only reason I can think of would be the case of GeNIe's diagnostic window displaying list of faults and encountering identical fault posteriors. In such case the "special name" would be used (if node fault format would be set to "user defined"). Note that the order of faults returned from jSMILE's DiagNetwork.update does not depend on the textual information; when probabilities are tied, the outcome index is used.
Using Java 1.6 64-bit and Windows 7 64-bit. Is that what you mean by platform?
Yes, that's the info. I think we could consider adding the required functionality and creating an early private jSMILE build.

raywonqa
Posts: 4
Joined: Wed Sep 18, 2013 5:04 pm

Re: Set the target state names with jsmile

Post by raywonqa » Mon Feb 03, 2014 10:36 pm

That would be awesome. Let me know if you end up creating an early build with that capability.
Thanks!

Post Reply