<< Click to Display Table of Contents >> Navigation: Using SMILE Wrappers > Inference > Target nodes |
To run inference efficiently, simply mark the nodes you are interested in as targets using Network.set_target. Target nodes are always updated by the inference algorithm, while other nodes may or may not be updated, depending on the algorithm. If no target nodes are explicitly specified, SMILE treats all nodes as targets and updates every node in the network. For small and medium-sized models, explicitly setting targets is usually unnecessary. The library automatically applies relevance reasoning, which takes both the target nodes and the evidence in the network into account, reducing the computational effort required to update only the relevant nodes.
Network.update_beliefs may throw an exception with error code -42 if the temporary data structures required exceed available memory. Marking only the necessary nodes as targets helps reduce memory usage and avoids this problem.
The following methods of the Network class allow you to set, query, or clear target nodes:
Python
set_target(node: int | str, target: bool) -> None
is_target(node: int | str) -> bool
clear_all_targets() -> None
Java
void setTarget(int nodeHandle, boolean target);
void setTarget(String nodeId, boolean target);
boolean isTarget(int nodeHandle);
boolean isTarget(String nodeId);
void clearAllTargets();
C#
void SetTarget(int nodeHandle, bool target);
void SetTarget(string nodeId, bool target);
bool IsTarget(int nodeHandle);
bool IsTarget(string nodeId);
void ClearAllTargets();
R
setTarget(nodeIdOrHandle, target)
isTarget <- isTarget(nodeIdOrHandle)
clearAllTargets()