From 761d5145e36e6625fc563671bf695e55f5e0859f Mon Sep 17 00:00:00 2001 From: erdogant Date: Mon, 7 Oct 2024 21:41:54 +0200 Subject: [PATCH] update examples discritizer --- bnlearn/examples_discretize.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/bnlearn/examples_discretize.py b/bnlearn/examples_discretize.py index ace50c0..4a238d8 100644 --- a/bnlearn/examples_discretize.py +++ b/bnlearn/examples_discretize.py @@ -2,19 +2,9 @@ import pandas as pd import bnlearn as bn -df = pd.read_csv( - "bnlearn/tests/discretize/data/auto_mpg.csv", - dtype={ - "mpg": "float64", - "cylinders": "int64", - "displacement": "float64", - "horsepower": "float64", - "weight": "float64", - "acceleration": "float64", - "model_year": "int64", - "origin": "int64", - }, -) +#%% +df = bn.import_example('auto_mpg') +del df['origin'] edges = [ ("cylinders", "displacement"), @@ -74,3 +64,5 @@ evidence = {"weight": bn.discretize_value(df_disc["weight"], 3000.0)} print(evidence) print(bn.inference.fit(model_mle, variables=["mpg"], evidence=evidence, verbose=0)) + +# %%