1.0 - 8.00 - LoopyBeliefPropagation Example 1: Equally 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 on all symptoms equally; therefore, the edges table does not include edge weights.

Input

vertices: lbp_vertices
id vertex
1 Jaundice
2 Internal bleeding
3 Loss of appetite
4 Fatigue
5 Fever
6 Dark urine
7 Stupor
8 Nausea/vomiting
9 Hepatitis
edges: lbp_edges
id source target
1 Jaundice Hepatitis
2 Internal bleeding Hepatitis
3 Loss of appetite Hepatitis
4 Fatigue Hepatitis
5 Fever Hepatitis
6 Dark urine Hepatitis
7 Stupor Hepatitis
8 Nausea/vomiting Hepatitis

In the observation table, 't' means that the symptom is present and 'f' means that it is absent.

observation: lbp_observation
id vertex obs
1 Jaundice t
2 Internal bleeding t
3 Loss of appetite t
4 Fatigue t
5 Fever f
6 Dark urine t
7 Stupor f
8 Nausea/vomiting f

SQL Call

SELECT * FROM LoopyBeliefPropagation (
  ON lbp_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')
  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. Five of the eight symptoms are present, so the conditional probability of hepatitis is 5/8 (0.625).

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