|
<< Click to Display Table of Contents >> Navigation: Using SMILE Wrappers > Discrete nodes and numeric domains > Outcome point values |
To define a discrete distribution over numeric node outcomes, use Network.set_node_point_values. The example below assumes that the node has three outcomes:
Python
net.set_point_values(nodeHandle, [ 3.14, -2.78, 77 ])
Java
net.setPointValues(nodeHandle, new double[] { 3.14, -2.78, 77 });
C#
net.SetPointValues(nodeHandle, new double[] { 3.14, -2.78, 77 });
R
net$setPointValues(nodeHandle, c({ 3.14, -2.78, 77 }))
Each numeric value is associated with an existing node outcome. There is no requirement that the point values be ordered, and outcome identifiers are preserved. Nodes with point values always require outcome identifiers.
Outcome-modifying methods such as Network.add_outcome, Network.insert_outcome, or Network.delete_outcome work normally on nodes with point values. Any newly created outcomes will have their point values initialized to zero. Point values can only be reassigned in bulk, by calling Network.set_point_values again.
After successful inference, the value of a discrete node contains the marginal probability distribution over its outcomes. For nodes with point values, the mean and standard deviation of the distribution can be calculated on demand. These can be retrieved using Network.get_node_mean and Network.get_node_std_dev once is_value_valid returns true.
Point values do not make a discrete node equivalent to a continuous node. Continuous evidence cannot be applied to nodes with point values: calling Network.set_cont_evidence will fail, even if the evidence value exactly matches one of the defined point values.
To remove point values from a node, call Network.remove_point_values. To check whether a node currently has point values defined, call Network.has_point_values.
The methods for working with point values are:
Python
has_point_values(node: int | str) -> bool
set_point_values(node: int | str, point_values: List[float]) -> None
get_point_values(node: int | str) -> List[float]
remove_point_values(node: int | str) -> None
Java
boolean hasPointValues(int nodeHandle);
boolean hasPointValues(String nodeId);
void setPointValues(int nodeHandle, double[] pointValues);
void setPointValues(String nodeId, double[] pointValues);
double[] getPointValues(int nodehandle);
double[] getPointValues(String nodeId);
void removePointValues(int nodeHandle);
void removePointValues(String nodeId);
C#
bool HasPointValues(int nodeHandle);
bool HasPointValues(string nodeId);
void SetPointValues(int nodeHandle, double[] pointValues);
void SetPointValues(string nodeId, double[] pointValues);
double[] GetPointValues(int nodeHandle);
double[] GetPointValues(string nodeId);
void RemovePointValues(int nodeHandle);
void RemovePointValues(string nodeId);
R
hasPointValues <- hasPointValues(nodeIdOrHandle)
setPointValues(nodeIdOrHandle, pointValues)
values <- getPointValues(nodeIdOrHandle)
removePointValues(nodeIdOrHandle)