1.0 - 8.00 - LoopyBeliefPropagation Example 2: Unequally Weighted Symptoms/Edges - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Release Date
May 2019
Content Type
Programming Reference
Publication ID
B700-4003-098K
Language
English (United States)

In this example, the probability of hepatitis depends more on some symptoms than others; therefore, the edges table includes edge weights (and the SQL call includes the EdgeWeight argument).

Input

edges: lbp_weighted_edges
id source target edgewt
1 Jaundice Hepatitis 0.2
2 Internal bleeding Hepatitis 0.15
3 Loss of appetite Hepatitis 0.05
4 Fatigue Hepatitis 0.1
5 Fever Hepatitis 0.1
6 Dark urine Hepatitis 0.25
7 Stupor Hepatitis 0.05
8 Nausea/vomiting Hepatitis 0.1

SQL Call

SELECT * FROM LoopyBeliefPropagation (
  ON lbp_weighted_edges AS edges PARTITION BY source
  ON lbp_vertices AS vertices PARTITION BY vertex
  ON lbp_observation AS observation PARTITION BY vertex
  USING
  TargetKey ('target')
  ObservationColumn ('obs')
  EdgeWeight ('edgewt')
  Accumulate ('vertex')
  MaxIterNum (20)
  StopThreshold (1E-10)
) AS dt ORDER BY vertex;

Output

In the output table, 1 means that the symptom is present and 0 means that it is absent. The conditional probability of hepatitis is the sum of the weights of the symptoms that are present (0.25 + 0.1 + 0.05 + 0.15 + 0.2 = 0.75).

vertex prob_true
Dark urine 1
Fatigue 1
Fever 0
Hepatitis 0.75
Internal bleeding 1
Jaundice 1
Loss of appetite 1
Nausea/vomiting 0
Stupor 0