From e62be8f201984d8731039bf48fbd3686fec47331 Mon Sep 17 00:00:00 2001 From: meliurwen Date: Thu, 16 Feb 2023 17:31:53 +0100 Subject: [PATCH] Added ability to pass the filepath as argument --- .gitignore | 3 +-- benchmark.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 6df8c65..1d0e276 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ venv/ .venv/ -data/ -res/ +*.json *.dat diff --git a/benchmark.py b/benchmark.py index be8132e..e8b36b3 100755 --- a/benchmark.py +++ b/benchmark.py @@ -3,19 +3,20 @@ import glob import os import time +import argparse from pathlib import Path from pyctbn.legacy import JsonImporter from pyctbn.legacy import SamplePath from pyctbn.legacy import StructureConstraintBasedEstimator -def structure_constraint_based_estimation_example(): +def structure_constraint_based_estimation_example(network_file_path): Path("./data").mkdir(parents=True, exist_ok=True) # read_files = glob.glob(os.path.join("./data/", "*.json")) # importer = JsonImporter( - file_path=read_files[0], + file_path=network_file_path, samples_label='samples', structure_label='dyn.str', variables_label='variables', @@ -56,4 +57,8 @@ def structure_constraint_based_estimation_example(): # (remember to specify the path AND the .png extension) #se1.save_plot_estimated_structure_graph("./res/result0.png") -structure_constraint_based_estimation_example() +parser = argparse.ArgumentParser() +parser.add_argument('filename', help="path of the network in json format") +args = parser.parse_args() + +structure_constraint_based_estimation_example(args.filename)