|
|
|
@ -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 the json files in ./data path> |
|
|
|
|
read_files = glob.glob(os.path.join("./data/", "*.json")) |
|
|
|
|
# <initialize a JsonImporter object for the first file> |
|
|
|
|
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) |
|
|
|
|