From 33a7a45c209e5b316aeb8e921fb5eb4e06c94b61 Mon Sep 17 00:00:00 2001 From: Nitin Chaudhary <42841579+ntsingh122@users.noreply.github.com> Date: Wed, 27 Jan 2021 08:19:23 +0530 Subject: [PATCH] Update juplab7.ipynb updated the code for the newer version of pgmpy library. --- 7/juplab7.ipynb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/7/juplab7.ipynb b/7/juplab7.ipynb index a05ba0a..bb0027b 100644 --- a/7/juplab7.ipynb +++ b/7/juplab7.ipynb @@ -153,13 +153,14 @@ } ], "source": [ + "import sys" "import numpy as np\n", "import pandas as pd\n", "from pgmpy.models import BayesianModel\n", "from pgmpy.estimators import MaximumLikelihoodEstimator, BayesianEstimator\n", "\n", "mydata=pd.read_csv(\"heart_disease_data.csv\")\n", - "np.set_printoptions(threshold=np.nan)\n", + "np.set_printoptions(threshold=sys.maxsize)\n", "names = ['age', 'sex', 'cp', 'trestbps', 'chol', 'fbs', 'restecg', 'thalach', 'exang', 'oldpeak', 'slope', 'ca', 'thal', 'heartdisease']\n", "heartDisease = pd.read_csv( \"heart_disease_data.csv\")\n", "display(heartDisease.head())\n", @@ -211,11 +212,11 @@ "from pgmpy.inference import VariableElimination\n", "HeartDisease_infer = VariableElimination(model)\n", "q = HeartDisease_infer.query(variables=['heartdisease'], evidence={'age': 32})\n", - "print(q['heartdisease'])\n", + "print(q)\n", "q = HeartDisease_infer.query(variables=['heartdisease'], evidence={'chol': 100})\n", - "print(q['heartdisease'])\n", + "print(q)\n", "q = HeartDisease_infer.query(variables=['heartdisease'], evidence={'trestbps': 10})\n", - "print(q['heartdisease'])" + "print(q)" ] }, {