How to index when state is interval
How to index when state is interval
I found that when the state of a node is interval, this indexing method seems to be invalid, such as F=0 means that the first state. How to do it correctly?
- Attachments
-
- 屏幕截图 2024-08-21 213459.png (48.24 KiB) Viewed 2158 times
-
- 屏幕截图 2024-08-21 213439.png (3.27 KiB) Viewed 2158 times
-
- Site Admin
- Posts: 1438
- Joined: Mon Nov 26, 2007 5:51 pm
Re: How to index when state is interval
When the parent node is discrete and has intervals, the child equation node sees the value drawn uniformly from the interval selected by the posteriors of the parent (they are known when sampling is run, because discrete parent precedes the equation child in network's partial order).
In your example, you refer to parent F by equating it to zero. This will not work, even if the parent's interval incudes zero.
You have three options, see the attachment for a working example.
1. use intervals with identifiers in the discrete node. In such case, equating the parent with its outcome label will work as you'd expect. The child equation in the example is:
The child node id is X, and it has a states defined with both intervals and identifiers. "S2" is the state id.
2. use the And function in the If function, and specify the interval boundaries
The parent's state has the lower bound equal to 30 and the upper bound equal to 80. This will effectively return 100 if the parent is in the specified state, and 200 otherwise
3. when the intervals are used with identifiers, you can also use the Choose function:
The parent in the example has 3 states. Choose will automatically translate parent value into the integer state index, and will return 11, 22 or 33.
In your example, you refer to parent F by equating it to zero. This will not work, even if the parent's interval incudes zero.
You have three options, see the attachment for a working example.
1. use intervals with identifiers in the discrete node. In such case, equating the parent with its outcome label will work as you'd expect. The child equation in the example is:
Code: Select all
A=If(X="S2",100,200)
2. use the And function in the If function, and specify the interval boundaries
Code: Select all
B=If(And(X>=30,X<80),100,200)
3. when the intervals are used with identifiers, you can also use the Choose function:
Code: Select all
C=Choose(X,11,22,33)
- Attachments
-
- how_to_reference_inteval.png (18.19 KiB) Viewed 2152 times
-
- how_to_reference_inteval.xdsl
- (1.9 KiB) Downloaded 96 times
Re: How to index when state is interval
When I use the node ->ChangeType (DSL_CPT) method to convert a continuous node to a discrete node, is it converted to intervals by default? Is there a way to convert it to identifiers and intervals in SMILE?
-
- Site Admin
- Posts: 1438
- Joined: Mon Nov 26, 2007 5:51 pm
Re: How to index when state is interval
The discrete node definition after the DSL_EQUATION to DSL_CPT change will have intervals if the original equation node had discretization intervals specified. Please note that the two discretization intervals will be set in the equation node if
a) equation node has no discretization intervals yet
and
b) discretization intervals are required to complete inference when sampling cannot be used and network needs to be discretized
Two discretization intervals per equation node is of course very raw approximation, and in practice you should always specify the discretization when you expect that your network will have evidence in nodes with parents (this is the condition which requires an automatic switch from sampling to discretization+discrete inference).
a) equation node has no discretization intervals yet
and
b) discretization intervals are required to complete inference when sampling cannot be used and network needs to be discretized
Two discretization intervals per equation node is of course very raw approximation, and in practice you should always specify the discretization when you expect that your network will have evidence in nodes with parents (this is the condition which requires an automatic switch from sampling to discretization+discrete inference).
Re: How to index when state is interval
Thank you for your response! I understand, but I have another question. Is there a method in SMILE/GeNe to view the max cluster size when using the default inference algorithm clustering?
Re: How to index when state is interval
And may I ask if there are any methods to enable parallelism to improve the memory utilization of the computer? Currently, when setting node observation values and setting some nodes as targets, updating beliefs still fails, and the system shows that the model is too complex. However, I have observed that my memory is not fully utilized. Is there any way to solve the situation?
-
- Site Admin
- Posts: 1438
- Joined: Mon Nov 26, 2007 5:51 pm
Re: How to index when state is interval
SMILE can determine if the model is too complex without actually trying to allocate the memory.system shows that the model is too complex. However, I have observed that my memory is not fully utilized. Is there any way to solve the situation?
Regarding parallelism, SMILE does not support it yet. However, your application can use multiple threads with different network objects to perform simultaneous inference.
-
- Site Admin
- Posts: 1438
- Joined: Mon Nov 26, 2007 5:51 pm
Re: How to index when state is interval
We have a private, undocumented C++ only API which gets triangulation statistics, including cluster sizes. Send me a forum private message if you want to get info on how to use it.
Re: How to index when state is interval
I have sent a private message, please check it
-
- Site Admin
- Posts: 1438
- Joined: Mon Nov 26, 2007 5:51 pm
Re: How to index when state is interval
Answered by PM earlier today.
Re: How to index when state is interval
Hello! May I ask if there is a way to print a Junction tree?
-
- Site Admin
- Posts: 1438
- Joined: Mon Nov 26, 2007 5:51 pm
Re: How to index when state is interval
There's no such API in SMILE.