조건부 빌리프 네트워크 테스트하기
이제 프로그램에 환자에 대한 정보를 추가하면 외과 수술에 성공할지에 대한 확률을 볼 수 있다.
환자의 나이는 55세보다 적다. 나이 노드 자체 내에서 관측치를 입력하고 빌리프를 다시 계산할 수 있다.
age.set_observation_value("<55"); belief = BayesNetHelper.getBelief(inferenceGraph, surgical); System.out.println("The probability of surgery being positive and patient is younger than 55 : " + belief);
프로그램을 재실행하면 모델의 예측이 개선된다.
The probability of surgery being positive and patient is younger than 55 : 0.5032
환자가 흡연을 한다면 모델의 결과에 영향을 줄 것이다. 흡연 노드에 또 다른 관측치를 입력하여 다음과 같이 계산할 수 있다.
smoker.set_observation_value(“smokes”); belief = BayesNetHelper.getBelief(inferenceGraph, surgical); System.out.println(“The probability of surgery being positive for a smoker, younger than 55: “ + belief);