1
0
Fork 0

Merge branch 'master' into trajectory-generation

master
AlessandroBregoli 3 years ago committed by GitHub
commit bd2e880ca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      .gitattributes
  2. 67
      .github/workflows/Build_Release.yml
  3. 17
      .github/workflows/main.yml
  4. 28
      .github/workflows/python-PyCTBN-package.yml
  5. 2
      .gitignore
  6. 21
      LICENSE
  7. 3
      PyCTBN/PyCTBN/__init__.py
  8. 3
      PyCTBN/PyCTBN/estimators/__init__.py
  9. 3
      PyCTBN/PyCTBN/estimators/fam_score_calculator.py
  10. 3
      PyCTBN/PyCTBN/estimators/parameters_estimator.py
  11. 35
      PyCTBN/PyCTBN/estimators/structure_constraint_based_estimator.py
  12. 19
      PyCTBN/PyCTBN/estimators/structure_estimator.py
  13. 13
      PyCTBN/PyCTBN/estimators/structure_score_based_estimator.py
  14. 3
      PyCTBN/PyCTBN/optimizers/__init__.py
  15. 3
      PyCTBN/PyCTBN/optimizers/constraint_based_optimizer.py
  16. 3
      PyCTBN/PyCTBN/optimizers/hill_climbing_search.py
  17. 3
      PyCTBN/PyCTBN/optimizers/optimizer.py
  18. 5
      PyCTBN/PyCTBN/optimizers/tabu_search.py
  19. 3
      PyCTBN/PyCTBN/structure_graph/__init__.py
  20. 3
      PyCTBN/PyCTBN/structure_graph/conditional_intensity_matrix.py
  21. 3
      PyCTBN/PyCTBN/structure_graph/network_graph.py
  22. 3
      PyCTBN/PyCTBN/structure_graph/sample_path.py
  23. 3
      PyCTBN/PyCTBN/structure_graph/set_of_cims.py
  24. 3
      PyCTBN/PyCTBN/structure_graph/structure.py
  25. 3
      PyCTBN/PyCTBN/structure_graph/trajectory.py
  26. 3
      PyCTBN/PyCTBN/utility/__init__.py
  27. 3
      PyCTBN/PyCTBN/utility/abstract_importer.py
  28. 3
      PyCTBN/PyCTBN/utility/cache.py
  29. 12
      PyCTBN/PyCTBN/utility/json_importer.py
  30. 3
      PyCTBN/PyCTBN/utility/sample_importer.py
  31. 3
      PyCTBN/__init__.py
  32. 39
      PyCTBN/basic_main.py
  33. 20
      PyCTBN/setup.py
  34. 3
      PyCTBN/tests/__init__.py
  35. 3
      PyCTBN/tests/estimators/test_parameters_estimator.py
  36. 5
      PyCTBN/tests/estimators/test_structure_constraint_based_estimator.py
  37. 3
      PyCTBN/tests/estimators/test_structure_estimator.py
  38. 7
      PyCTBN/tests/estimators/test_structure_score_based_estimator.py
  39. 5
      PyCTBN/tests/optimizers/test_hill_climbing_search.py
  40. 4
      PyCTBN/tests/optimizers/test_tabu_search.py
  41. 7
      PyCTBN/tests/structure_graph/test_cim.py
  42. 3
      PyCTBN/tests/structure_graph/test_networkgraph.py
  43. 3
      PyCTBN/tests/structure_graph/test_sample_path.py
  44. 3
      PyCTBN/tests/structure_graph/test_setofcims.py
  45. 3
      PyCTBN/tests/structure_graph/test_structure.py
  46. 3
      PyCTBN/tests/structure_graph/test_trajectory.py
  47. 3
      PyCTBN/tests/utility/test_cache.py
  48. 7
      PyCTBN/tests/utility/test_json_importer.py
  49. 9
      PyCTBN/tests/utility/test_sample_importer.py
  50. 326
      README.rst
  51. 1
      codecov.yml
  52. BIN
      docs-out/_build/doctrees/PyCTBN.PyCTBN.doctree
  53. BIN
      docs-out/_build/doctrees/PyCTBN.PyCTBN.estimators.doctree
  54. BIN
      docs-out/_build/doctrees/PyCTBN.PyCTBN.optimizers.doctree
  55. BIN
      docs-out/_build/doctrees/PyCTBN.PyCTBN.structure_graph.doctree
  56. BIN
      docs-out/_build/doctrees/PyCTBN.PyCTBN.utility.doctree
  57. BIN
      docs-out/_build/doctrees/PyCTBN.doctree
  58. BIN
      docs-out/_build/doctrees/PyCTBN.tests.doctree
  59. BIN
      docs-out/_build/doctrees/PyCTBN.tests.estimators.doctree
  60. BIN
      docs-out/_build/doctrees/PyCTBN.tests.optimizers.doctree
  61. BIN
      docs-out/_build/doctrees/PyCTBN.tests.structure_graph.doctree
  62. BIN
      docs-out/_build/doctrees/PyCTBN.tests.utility.doctree
  63. BIN
      docs-out/_build/doctrees/basic_main.doctree
  64. BIN
      docs-out/_build/doctrees/environment.pickle
  65. BIN
      docs-out/_build/doctrees/examples.doctree
  66. BIN
      docs-out/_build/doctrees/index.doctree
  67. BIN
      docs-out/_build/doctrees/modules.doctree
  68. BIN
      docs-out/_build/doctrees/setup.doctree
  69. 2
      docs-out/_build/html/.buildinfo
  70. 70
      docs-out/_build/html/PyCTBN.PyCTBN.estimators.html
  71. 14
      docs-out/_build/html/PyCTBN.PyCTBN.html
  72. 30
      docs-out/_build/html/PyCTBN.PyCTBN.optimizers.html
  73. 38
      docs-out/_build/html/PyCTBN.PyCTBN.structure_graph.html
  74. 34
      docs-out/_build/html/PyCTBN.PyCTBN.utility.html
  75. 18
      docs-out/_build/html/PyCTBN.html
  76. 30
      docs-out/_build/html/PyCTBN.tests.estimators.html
  77. 14
      docs-out/_build/html/PyCTBN.tests.html
  78. 22
      docs-out/_build/html/PyCTBN.tests.optimizers.html
  79. 38
      docs-out/_build/html/PyCTBN.tests.structure_graph.html
  80. 26
      docs-out/_build/html/PyCTBN.tests.utility.html
  81. 4
      docs-out/_build/html/_sources/examples.rst.txt
  82. 6
      docs-out/_build/html/basic_main.html
  83. 26
      docs-out/_build/html/examples.html
  84. 2
      docs-out/_build/html/genindex.html
  85. 12
      docs-out/_build/html/index.html
  86. 6
      docs-out/_build/html/modules.html
  87. 2
      docs-out/_build/html/py-modindex.html
  88. 2
      docs-out/_build/html/search.html
  89. 2
      docs-out/_build/html/searchindex.js
  90. 6
      docs-out/_build/html/setup.html
  91. BIN
      docs-out/esempio_dataset.png
  92. 4
      docs-out/examples.rst
  93. 88
      docs/PyCTBN.PyCTBN.estimators.html
  94. 14
      docs/PyCTBN.PyCTBN.html
  95. 30
      docs/PyCTBN.PyCTBN.optimizers.html
  96. 107
      docs/PyCTBN.PyCTBN.structure_graph.html
  97. 120
      docs/PyCTBN.PyCTBN.utility.html
  98. 26
      docs/PyCTBN.html
  99. 96
      docs/PyCTBN.tests.estimators.html
  100. 14
      docs/PyCTBN.tests.html
  101. Some files were not shown because too many files have changed in this diff Show More

3
.gitattributes vendored

@ -0,0 +1,3 @@
*.js linguist-vendored
*.html linguist-vendored
*.css linguist-vendored

@ -0,0 +1,67 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
name: Upload Release Asset
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
name: Upload Release Asset
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest PyCTBN/tests/
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install pypa/build
run: |
python -m pip install build
- name: Build project # This would actually build your project, using zip for an example artifact
run: |
python -m build --sdist --wheel --outdir dist/.
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_id: ${{ steps.create_release.outputs.id }}
assets_path: ./dist

@ -4,13 +4,10 @@
name: Sphinx Docs
on:
push:
paths-ignore:
-'docs/**'
-'docs-out/**'
branches: [ master ]
pull_request:
branches: [ master ]
workflow_run:
workflows: ["Python package","Upload Release Asset"]
types:
- completed
jobs:
build:
@ -41,8 +38,8 @@ jobs:
rm -rf ../docs/*
cp -r _build/html/* ../docs/
cd ..
git config --local user.email "f.martini@campus.unimib.it"
git config --local user.name "philipMartini"
git config --local user.email "madlab@unimib.it"
git config --local user.name "madlabunimib"
git add .
git commit -m "Update documentation" -a || true
# The above command will fail if no changes were present, so we ignore
@ -51,7 +48,7 @@ jobs:
uses: ad-m/github-push-action@master
with:
branch: master
github_token: ${{ secrets.PYCTBN_TOK }}
github_token: ${{ secrets.GITHUB_TOKEN }}
# ===============================

@ -5,10 +5,11 @@ name: Python package
on:
push:
paths-ignore:
-'docs/**'
-'docs-out/**'
paths:
- 'PyCTBN/**'
branches: [ master ]
tags-ignore:
- 'v*'
pull_request:
branches: [ master ]
@ -37,6 +38,23 @@ jobs:
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
- name: Generate coverage report
run: |
pytest PyCTBN/tests/
pip install pytest
pip install pytest-cov
pytest PyCTBN/tests/ --cov='./' --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
with:
files: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
verbose: true

2
.gitignore vendored

@ -3,7 +3,6 @@ __pycache__
**/__pycache__
**/data
**/PyCTBN.egg-info
**/dist
**/results_data
**/.scannerwork
**/build
@ -15,3 +14,4 @@ test3.json
result0.png
example.json
test_time.py
.idea

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2021 MADLabUnimib developers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -1,3 +1,6 @@
# License: MIT License
import PyCTBN.PyCTBN.estimators
from PyCTBN.PyCTBN.estimators import *
import PyCTBN.PyCTBN.optimizers

@ -1,3 +1,6 @@
# License: MIT License
from .fam_score_calculator import FamScoreCalculator
from .parameters_estimator import ParametersEstimator
from .structure_estimator import StructureEstimator

@ -1,4 +1,7 @@
# License: MIT License
import itertools
import json
import typing

@ -1,3 +1,6 @@
# License: MIT License
import sys
sys.path.append('../')
import numpy as np

@ -1,4 +1,7 @@
# License: MIT License
import itertools
import json
import typing
@ -94,7 +97,7 @@ class StructureConstraintBasedEstimator(StructureEstimator):
l2 = list(self._nodes[bool_mask2])
indxs2 = self._nodes_indxs[bool_mask2]
vals2 = self._nodes_vals[bool_mask2]
eds2 = list(itertools.product(p_set, test_child))
eds2 = list(itertools.product(p_set, [test_child]))
s2 = Structure(l2, indxs2, vals2, eds2, tot_vars_count)
g2 = NetworkGraph(s2)
g2.fast_init(test_child)
@ -199,8 +202,14 @@ class StructureConstraintBasedEstimator(StructureEstimator):
return optimizer_obj.optimize_structure()
def ctpc_algorithm(self,disable_multiprocessing:bool= False ):
def ctpc_algorithm(self, disable_multiprocessing:bool= False, processes_number:int= None):
"""Compute the CTPC algorithm over the entire net.
:param disable_multiprocessing: true if you desire to disable the multiprocessing operations, default to False
:type disable_multiprocessing: Boolean, optional
:param processes_number: if disable_multiprocessing is false indicates
the maximum number of process; if None it will be automatically set, default to None
:type processes_number: int, optional
"""
ctpc_algo = self.one_iteration_of_CTPC_algorithm
total_vars_numb = self._sample_path.total_variables_count
@ -212,8 +221,6 @@ class StructureConstraintBasedEstimator(StructureEstimator):
'get the number of CPU'
cpu_count = multiprocessing.cpu_count()
'Remove all the edges from the structure'
self._sample_path.structure.clean_structure_edges()
@ -221,10 +228,14 @@ class StructureConstraintBasedEstimator(StructureEstimator):
#with multiprocessing.Pool(processes=cpu_count) as pool:
#with get_context("spawn").Pool(processes=cpu_count) as pool:
if disable_multiprocessing:
print("DISABILITATO")
print("DISABLED")
cpu_count = 1
list_edges_partial = [ctpc_algo(n,total_vars_numb) for n in self._nodes]
else:
if processes_number is not None and cpu_count > processes_number:
cpu_count = processes_number
print(f"CPU COUNT: {cpu_count}")
with concurrent.futures.ProcessPoolExecutor(max_workers=cpu_count) as executor:
list_edges_partial = executor.map(ctpc_algo,
self._nodes,
@ -238,8 +249,18 @@ class StructureConstraintBasedEstimator(StructureEstimator):
return edges
def estimate_structure(self,disable_multiprocessing:bool=False):
return self.ctpc_algorithm(disable_multiprocessing=disable_multiprocessing)
def estimate_structure(self, disable_multiprocessing:bool=False, processes_number:int= None):
"""
Compute the constraint-based algorithm to find the optimal structure
:param disable_multiprocessing: true if you desire to disable the multiprocessing operations, default to False
:type disable_multiprocessing: Boolean, optional
:param processes_number: if disable_multiprocessing is false indicates
the maximum number of process; if None it will be automatically set, default to None
:type processes_number: int, optional
"""
return self.ctpc_algorithm(disable_multiprocessing=disable_multiprocessing,
processes_number=processes_number)

@ -1,4 +1,7 @@
# License: MIT License
import itertools
import json
import typing
@ -143,18 +146,12 @@ class StructureEstimator(object):
def save_plot_estimated_structure_graph(self, file_path: str) -> None:
"""Plot the estimated structure in a graphical model style, use .png extension.
Spurious edges are colored in red if a prior structure is present.
:param file_path: path to save the file to
:type: string
"""
graph_to_draw = nx.DiGraph()
spurious_edges = self.spurious_edges()
non_spurious_edges = list(set(self._complete_graph.edges) - set(spurious_edges))
edges_colors = ['red' if edge in spurious_edges else 'black' for edge in self._complete_graph.edges]
graph_to_draw.add_edges_from(spurious_edges)
graph_to_draw.add_edges_from(non_spurious_edges)
pos = nx.spring_layout(graph_to_draw, k=0.5*1/np.sqrt(len(graph_to_draw.nodes())), iterations=50,scale=10)
pos = nx.spring_layout(self._complete_graph, k=0.5*1/np.sqrt(len(self._complete_graph.nodes)),
iterations=50,scale=10)
options = {
"node_size": 2000,
"node_color": "white",
@ -164,12 +161,12 @@ class StructureEstimator(object):
"font_size":13,
'connectionstyle': 'arc3, rad = 0.1',
"arrowsize": 15,
"arrowstyle": '<|-',
#"arrowstyle": '<|-',
"width": 1,
"edge_color":edges_colors,
#"edge_color":edges_colors,
}
nx.draw(graph_to_draw, pos, **options)
nx.draw(self._complete_graph, pos, **options)
ax = plt.gca()
ax.margins(0.20)
plt.axis("off")

@ -1,4 +1,7 @@
# License: MIT License
import itertools
import json
import typing
@ -54,7 +57,7 @@ class StructureScoreBasedEstimator(StructureEstimator):
def estimate_structure(self, max_parents:int = None, iterations_number:int= 40,
patience:int = None, tabu_length:int = None, tabu_rules_duration:int = None,
optimizer: str = 'tabu',disable_multiprocessing:bool= False ):
optimizer: str = 'tabu', disable_multiprocessing:bool= False, processes_number:int= None):
"""
Compute the score-based algorithm to find the optimal structure
@ -72,6 +75,9 @@ class StructureScoreBasedEstimator(StructureEstimator):
:type optimizer: string, optional
:param disable_multiprocessing: true if you desire to disable the multiprocessing operations, default to False
:type disable_multiprocessing: Boolean, optional
:param processes_number: if disable_multiprocessing is false indicates
the maximum number of process; if None it will be automatically set, default to None
:type processes_number: int, optional
"""
'Save the true edges structure in tuples'
true_edges = copy.deepcopy(self._sample_path.structure.edges)
@ -94,10 +100,11 @@ class StructureScoreBasedEstimator(StructureEstimator):
'get the number of CPU'
cpu_count = multiprocessing.cpu_count()
print(f"CPU COUNT: {cpu_count}")
if disable_multiprocessing:
cpu_count = 1
elif processes_number is not None and cpu_count > processes_number:
cpu_count = processes_number
@ -106,6 +113,8 @@ class StructureScoreBasedEstimator(StructureEstimator):
#with get_context("spawn").Pool(processes=cpu_count) as pool:
#with multiprocessing.Pool(processes=cpu_count) as pool:
print(f"CPU COUNT: {cpu_count}")
'Estimate the best parents for each node'
if disable_multiprocessing:
list_edges_partial = [estimate_parents(n,max_parents,iterations_number,patience,tabu_length,tabu_rules_duration,optimizer) for n in self._nodes]

@ -1,3 +1,6 @@
# License: MIT License
from .optimizer import Optimizer
from .tabu_search import TabuSearch
from .hill_climbing_search import HillClimbing

@ -1,4 +1,7 @@
# License: MIT License
import itertools
import json
import typing

@ -1,4 +1,7 @@
# License: MIT License
import itertools
import json
import typing

@ -1,4 +1,7 @@
# License: MIT License
import itertools
import json
import typing

@ -1,4 +1,7 @@
# License: MIT License
import itertools
import json
import typing
@ -184,5 +187,5 @@ class TabuSearch(Optimizer):
if self.patience is not None and patince_count > self.patience:
break
print(f"finito variabile: {self.node_id}")
print(f"Finished variable : {self.node_id}")
return graph.edges

@ -1,3 +1,6 @@
# License: MIT License
from .conditional_intensity_matrix import ConditionalIntensityMatrix
from .network_graph import NetworkGraph
from .sample_path import SamplePath

@ -1,3 +1,6 @@
# License: MIT License
import numpy as np

@ -1,4 +1,7 @@
# License: MIT License
import typing
import networkx as nx

@ -1,4 +1,7 @@
# License: MIT License
import numpy as np
import pandas as pd

@ -1,4 +1,7 @@
# License: MIT License
import typing

@ -1,4 +1,7 @@
# License: MIT License
import typing as ty
import numpy as np

@ -1,4 +1,7 @@
# License: MIT License
import typing
import numpy as np

@ -1,3 +1,6 @@
# License: MIT License
from .abstract_importer import AbstractImporter
from .cache import Cache
from .json_importer import JsonImporter

@ -1,4 +1,7 @@
# License: MIT License
import typing
from abc import ABC, abstractmethod

@ -1,4 +1,7 @@
# License: MIT License
import typing
from ..structure_graph.set_of_cims import SetOfCims

@ -1,3 +1,6 @@
# License: MIT License
import json
import typing
@ -50,10 +53,10 @@ class JsonImporter(AbstractImporter):
super(JsonImporter, self).__init__(file_path)
self._raw_data = self.read_json_file()
def import_data(self, indx: int) -> None:
def import_data(self, indx: int = 0) -> None:
"""Implements the abstract method of :class:`AbstractImporter`.
:param indx: the index of the outer JsonArray to extract the data from
:param indx: the index of the outer JsonArray to extract the data from, default to 0
:type indx: int
"""
self._array_indx = indx
@ -105,7 +108,12 @@ class JsonImporter(AbstractImporter):
"""
with open(self._file_path) as f:
data = json.load(f)
if (isinstance(data,list)):
return data
else:
return [data]
def one_level_normalizing(self, raw_data: typing.List, indx: int, key: str) -> pd.DataFrame:
"""Extracts the one-level nested data in the list ``raw_data`` at the index ``indx`` at the key ``key``.

@ -1,3 +1,6 @@
# License: MIT License
import json
import typing

@ -1,2 +1,5 @@
# License: MIT License
import PyCTBN.PyCTBN
from PyCTBN.PyCTBN import *

@ -1,39 +0,0 @@
import glob
import os
import sys
sys.path.append("./PyCTBN/")
import structure_graph.network_graph as ng
import structure_graph.sample_path as sp
import structure_graph.set_of_cims as sofc
import estimators.parameters_estimator as pe
import utility.json_importer as ji
def main():
read_files = glob.glob(os.path.join('./data', "*.json")) #Take all json files in this dir
#import data
importer = ji.JsonImporter(read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name')
#Create a SamplePath Obj
s1 = sp.SamplePath(importer)
#Build The trajectries and the structural infos
s1.build_trajectories()
s1.build_structure()
#From The Structure Object build the Graph
g = ng.NetworkGraph(s1.structure)
#Select a node you want to estimate the parameters
node = g.nodes[1]
#Init the graph specifically for THIS node
g.fast_init(node)
#Use SamplePath and Grpah to create a ParametersEstimator Object
p1 = pe.ParametersEstimator(s1, g)
#Init the peEst specifically for THIS node
p1.fast_init(node)
#Compute the parameters
sofc1 = p1.compute_parameters_for_node(node)
#The est CIMS are inside the resultant SetOfCIms Obj
print(sofc1.actual_cims)
if __name__ == "__main__":
main()

@ -1,20 +0,0 @@
from setuptools import setup, find_packages
setup(name='PyCTBN',
version='1.0',
url='https://github.com/philipMartini/PyCTBN',
license='MIT',
author=['Alessandro Bregoli', 'Filippo Martini','Luca Moretti'],
author_email=['a.bregoli1@campus.unimib.it', 'f.martini@campus.unimib.it','lucamoretti96@gmail.com'],
description='A Continuous Time Bayesian Networks Library',
packages=find_packages('.', exclude=['tests']),
#packages=['PyCTBN.PyCTBN'],
install_requires=[
'numpy', 'pandas', 'networkx', 'scipy', 'matplotlib', 'tqdm'],
dependency_links=['https://github.com/numpy/numpy', 'https://github.com/pandas-dev/pandas',
'https://github.com/networkx/networkx', 'https://github.com/scipy/scipy',
'https://github.com/tqdm/tqdm'],
#long_description=open('../README.md').read(),
zip_safe=False,
python_requires='>=3.6')

@ -1 +1,4 @@
# License: MIT License

@ -1,4 +1,7 @@
# License: MIT License
import unittest
import numpy as np
import glob

@ -1,4 +1,7 @@
# License: MIT License
import glob
import math
import os
@ -54,7 +57,7 @@ class TestStructureConstraintBasedEstimator(unittest.TestCase):
true_edges = set(map(tuple, true_edges))
se1 = StructureConstraintBasedEstimator(self.s1,0.1,0.1)
edges = se1.estimate_structure(True)
edges = se1.estimate_structure(processes_number=2)
self.assertFalse(se1.spurious_edges())
self.assertEqual(edges, true_edges)

@ -1,4 +1,7 @@
# License: MIT License
import glob
import math
import os

@ -1,4 +1,7 @@
# License: MIT License
import glob
import math
import os
@ -111,7 +114,8 @@ class TestStructureScoreBasedEstimator(unittest.TestCase):
tabu_length = 15,
tabu_rules_duration = 15,
optimizer = 'hill',
disable_multiprocessing=False
disable_multiprocessing=False,
processes_number=2
)
@ -240,6 +244,7 @@ class TestStructureScoreBasedEstimator(unittest.TestCase):
self.assertGreaterEqual(recall,0.75)
if __name__ == '__main__':
unittest.main()

@ -1,4 +1,7 @@
# License: MIT License
import glob
import math
import os
@ -56,7 +59,7 @@ class TestHillClimbingSearch(unittest.TestCase):
raw_data = json.load(f)
trajectory_list_raw= raw_data["samples"]
# Convert to DataFrame
trajectory_list = [pd.DataFrame(sample) for sample in trajectory_list_raw]
variables= raw_data["variables"]

@ -1,3 +1,6 @@
# License: MIT License
import sys
sys.path.append("../../PyCTBN/")
import glob
@ -76,6 +79,7 @@ class TestTabuSearch(unittest.TestCase):
with open("./PyCTBN/test_data/networks_and_trajectories_ternary_data_01_6_1.json") as f:
raw_data = json.load(f)
# read the samples
trajectory_list_raw= raw_data["samples"]
trajectory_list = [pd.DataFrame(sample) for sample in trajectory_list_raw]

@ -1,4 +1,7 @@
# License: MIT License
import unittest
import numpy as np
@ -34,10 +37,10 @@ class TestConditionalIntensityMatrix(unittest.TestCase):
c2[i, j] = (c2[i, j] + 1) / (self.state_res_times[i] + 1)
c1.compute_cim_coefficients()
for i in range(0, len(c1.state_residence_times)):
self.assertTrue(np.isclose(np.sum(c1.cim[i]), 0.0, 1e01, 1e-01))
self.assertTrue(np.isclose(np.sum(c1.cim[i]), 0.0, 1e01,1e01))
for i in range(0, len(self.state_res_times)):
for j in range(0, len(self.state_res_times)):
self.assertTrue(np.isclose(c1.cim[i, j], c2[i, j], 1e01, 1e-01))
self.assertTrue(np.isclose(c1.cim[i, j], c2[i, j], 1e01))
def test_repr(self):
c1 = ConditionalIntensityMatrix(state_residence_times = self.state_res_times,

@ -1,4 +1,7 @@
# License: MIT License
import unittest
import glob
import os

@ -1,4 +1,7 @@
# License: MIT License
import unittest
import glob
import os

@ -1,4 +1,7 @@
# License: MIT License
import unittest
import numpy as np
import itertools

@ -1,4 +1,7 @@
# License: MIT License
import unittest
import numpy as np
from ...PyCTBN.structure_graph.structure import Structure

@ -1,4 +1,7 @@
# License: MIT License
import unittest
import numpy as np
import glob

@ -1,4 +1,7 @@
# License: MIT License
import unittest
import numpy as np

@ -1,4 +1,7 @@
# License: MIT License
import unittest
import os
import glob
@ -39,7 +42,7 @@ class TestJsonImporter(unittest.TestCase):
path = os.getcwd()
path = path + '/data.json'
j1 = JsonImporter(path, '', '', '', '', '')
self.assertTrue(self.ordered(data_set) == self.ordered(j1._raw_data))
self.assertTrue(self.ordered([data_set]) == self.ordered(j1._raw_data))
os.remove('data.json')
def test_read_json_file_not_found(self):
@ -155,7 +158,7 @@ class TestJsonImporter(unittest.TestCase):
self.assertEqual(j1.file_path, "./PyCTBN/test_data/networks_and_trajectories_binary_data_01_3.json")
def test_import_data(self):
j1 = JsonImporter("./PyCTBN/test_data/networks_and_trajectories_binary_data_01_3.json", 'samples', 'dyn.str', 'variables', 'Time', 'Name')
j1 = JsonImporter("./PyCTBN/test_data/networks_and_trajectories_binary_data_02_10_1.json", 'samples', 'dyn.str', 'variables', 'Time', 'Name')
j1.import_data(0)
self.assertEqual(list(j1.variables[j1._variables_key]),
list(j1.concatenated_samples.columns.values[1:len(j1.variables[j1._variables_key]) + 1]))

@ -1,13 +1,19 @@
# License: MIT License
import unittest
import os
import glob
import json
import numpy as np
import pandas as pd
from ...PyCTBN.utility.sample_importer import SampleImporter
from ...PyCTBN.structure_graph.sample_path import SamplePath
import json
@ -18,6 +24,7 @@ class TestSampleImporter(unittest.TestCase):
with open("./PyCTBN/test_data/networks_and_trajectories_binary_data_01_3.json") as f:
raw_data = json.load(f)
#read the samples
trajectory_list_raw= raw_data[0]["samples"]
cls.trajectory_list = [pd.DataFrame(sample) for sample in trajectory_list_raw]

@ -1,27 +1,64 @@
PyCTBN
======
.. image:: https://codecov.io/gh/madlabunimib/PyCTBN/branch/master/graph/badge.svg
:target: https://codecov.io/gh/madlabunimib/PyCTBN
A Continuous Time Bayesian Networks Library
Installation/Usage
*******************
Download the release in .tar.gz or .whl format and simply use pip install to install it::
$ pip install PyCTBN-1.0.tar.gz
The library has been tested on Linux and Windows with Python 3.8 and it relies on the following Python modules:
- numpy
- pandas
- networkx
- scipy
- matplotlib
- tqdm
**Pip installation**
Download the latest release in .tar.gz or .whl format and simply use pip install to install it:
$ pip install PyCTBN-2.2.tar.gz
Documentation
*************
Please refer to https://philipmartini.github.io/PyCTBN/ for the full project documentation.
Please refer to https://madlabunimib.github.io/PyCTBN/ for the full project documentation.
Implementing your own data importer
***********************************
| This example demonstrates the implementation of a simple data importer the extends the class AbstractImporter
| to import data in csv format. The net in exam has three ternary nodes and no prior net structure.
| Suppose the trajectories that have to be inported have this structure:
.. image:: docs-out/esempio_dataset.png
:width: 600
:alt: An example trajectory to be imported.
| In the read_csv_file method the data are imported in memory, put in a list and assigned to the _df_samples_list class
| member, so that it contains all the trajectories to be processed.
| In the import_variables method the dataframe containing the nodes labels and the cardinalities of the nodes
| is assigned to the _df_variables class member.
| The class member _sorter has to contain the nodes labels in the same order of the trajectory columns,
| just override the build_sorter method to do that.
| If your datasets names have particular id, you can keep it using the dataset_id method to assign the id to a new class member.
| Finally the import_data method call all the previously implemented methods and calls the compute_row_delta_in_all_samples_frames
| to process all the trajectories in _df_samples_list.
| For more information about the class memebers and methods of AbstractImporter please refer to the documentation.
.. code-block:: python
"""This example demonstrates the implementation of a simple data importer the extends the class abstract importer to import data in csv format.
The net in exam has three ternary nodes and no prior net structure.
"""
import pandas as pd
import typing
from PyCTBN import AbstractImporter
from PyCTBN import SamplePath
class CSVImporter(AbstractImporter):
@ -53,73 +90,256 @@ Implementing your own data importer
def dataset_id(self) -> object:
pass
Parameters Estimation Example
*****************************
def main():
# create the importer object
csvimp = CSVImporter('/dataset_example.csv')
# call the wrapping method that wil import and process the data
csvimp.import_data()
# pass the AbstractImporter object to the SamplePath constructor
s1 = SamplePath(csvimp)
# SamplePath will contain the Trajecotry object...
s1.build_trajectories()
#...and the Structure object with all the process data
s1.build_structure()
Structure Estimation Examples
##############################
| In this section some examples will be shown in order to provide some useful information about the usage of the library
Constraint based estimation
****************************
| This example shows how to estimate the structure given a series of trajectories using a constraint based approach.
| The first three instructions import all the necessary data (trajectories, nodes cardinalities, nodes labels),
| and are contextual to the dataset that is been used, in the code comments are marked as optional <>.
| If your data has a different structure or format you should implement your own importer
| (see Implementing your own importer example).
| The other instructions are not optional and should follow the same order.
| A SamplePath object is been created, passing an AbstractImporter object that contains the correct class members
| filled with the data that are necessary to estimate the structure.
| Next the build_trajectories and build_structure methods are called to instantiate the objects that will contain
| the processed trajectories and all the net information.
| Then an estimator object is created, in this case a constraint based estimator,
| it necessary to pass a SamplePath object where build_trajectories and build_structure methods have already been called.
| If you have prior knowledge about the net structure pass it to the constructor with the known_edges parameter.
| The other three parameters are contextual to the StructureConstraintBasedEstimator, see the documentation for more details.
| To estimate the structure simply call the estimate_structure method.
| You can obtain the estimated structure as a boolean adjacency matrix with the method adjacency_matrix,
| or save it as a json file that contains all the nodes labels, and obviously the estimated edges.
| You can also save a graphical model representation of the estimated structure
| with the save_plot_estimated_structure_graph.
.. code-block:: python
import glob
import os
from PyCTBN import JsonImporter
from PyCTBN import SamplePath
from PyCTBN import NetworkGraph
from PyCTBN import ParametersEstimator
from PyCTBN import StructureConstraintBasedEstimator
def main():
read_files = glob.glob(os.path.join('./data', "*.json")) #Take all json files in this dir
#import data
importer = JsonImporter(read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name')
def structure_constraint_based_estimation_example():
# <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], samples_label='samples',
structure_label='dyn.str', variables_label='variables',
time_key='Time', variables_key='Name')
# <import the data at index 0 of the outer json array>
importer.import_data(0)
#Create a SamplePath Obj passing an already filled AbstractImporter object
s1 = SamplePath(importer)
#Build The trajectries and the structural infos
# construct a SamplePath Object passing a filled AbstractImporter object
s1 = SamplePath(importer=importer)
# build the trajectories
s1.build_trajectories()
# build the information about the net
s1.build_structure()
print(s1.structure.edges)
print(s1.structure.nodes_values)
#From The Structure Object build the Graph
g = NetworkGraph(s1.structure)
#Select a node you want to estimate the parameters
node = g.nodes[2]
print("Node", node)
#Init the _graph specifically for THIS node
g.fast_init(node)
#Use SamplePath and Grpah to create a ParametersEstimator Object
p1 = ParametersEstimator(s1.trajectories, g)
#Init the peEst specifically for THIS node
p1.fast_init(node)
#Compute the parameters
sofc1 = p1.compute_parameters_for_node(node)
#The est CIMS are inside the resultant SetOfCIms Obj
print(sofc1.actual_cims)
Structure Estimation Example
****************************
# construct a StructureEstimator object passing a correctly build SamplePath object
# and the independence tests significance, if you have prior knowledge about
# the net structure create a list of tuples
# that contains them and pass it as known_edges parameter
se1 = StructureConstraintBasedEstimator(sample_path=s1, exp_test_alfa=0.1, chi_test_alfa=0.1,
known_edges=[], thumb_threshold=25)
# call the algorithm to estimate the structure
se1.estimate_structure()
# obtain the adjacency matrix of the estimated structure
print(se1.adjacency_matrix())
# save the estimated structure to a json file
# (remember to specify the path AND the .json extension)....
se1.save_results('./results0.json')
# ...or save it also in a graphical model fashion
# (remember to specify the path AND the .png extension)
se1.save_plot_estimated_structure_graph('./result0.png')
Score based estimation with Hill Climbing
*****************************************
| This example shows how to estimate the structure given a series of trajectories using a score based approach
| and the Hill Climbing algorithm as optimization strategy.
| The structure of the code is the same as the previus example, but an explanation of the Structure score based estimator
| will be provided.
| Then an estimator object is created, in this case a score based estimator,
| it necessary to pass a SamplePath object where build_trajectories and build_structure methods have already been called.
| If you have prior knowledge about the net structure pass it to the constructor with the known_edges parameter.
| The other parameters are contextual to the StructureScoreBasedEstimator, see the documentation for more details.
| To estimate the structure simply call the estimate_structure method passing the desidered parameters, such as the
| optimization strategy, or simply use the default configuration.
| In this case an Hill Climbing approch is choosen.
.. code-block:: python
import glob
import os
from PyCTBN import JsonImporter
from PyCTBN import SamplePath
from PyCTBN import StructureEstimator
from PyCTBN import StructureScoreBasedEstimator
def structure_estimation_example():
# read the json files in ./data path
def structure_constraint_based_estimation_example():
# <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(read_files[0], 'samples', 'dyn.str', 'variables', 'Time', 'Name')
# import the data at index 0 of the outer json array
# <initialize a JsonImporter object for the first file>
importer = JsonImporter(file_path=read_files[0], samples_label='samples',
structure_label='dyn.str', variables_label='variables',
time_key='Time', variables_key='Name')
# <import the data at index 0 of the outer json array>
importer.import_data(0)
# construct a SamplePath Object passing a filled AbstractImporter
s1 = SamplePath(importer)
# construct a SamplePath Object passing a filled AbstractImporter object
s1 = SamplePath(importer=importer)
# build the trajectories
s1.build_trajectories()
# build the information about the net
s1.build_structure()
# construct a StructureEstimator object passing a correctly build SamplePath object
# and hyperparameters tau and alpha, if you have prior knowledge about
# the net structure create a list of tuples
# that contains them and pass it as known_edges parameter
se1 = StructureScoreBasedEstimator(sample_path=s1, tau_xu = 0.1, alpha_xu = 1,
known_edges=[])
# call the algorithm to estimate the structure
# and pass all the desidered parameters, in this case an Hill Climbing approach
# will be selected as optimization strategy.
se1.estimate_structure(
max_parents = None,
iterations_number = 40,
patience = None,
optimizer = 'hill'
)
# obtain the adjacency matrix of the estimated structure
print(se1.adjacency_matrix())
# save the estimated structure to a json file
# (remember to specify the path AND the .json extension)....
se1.save_results('./results0.json')
# ...or save it also in a graphical model fashion
# (remember to specify the path AND the .png extension)
se1.save_plot_estimated_structure_graph('./result0.png')
Score based estimation with Tabu Search and Data Augmentation
**************************************************************
| This example shows how to estimate the structure given a series of trajectories using a score based approach
| and the Tabu Search algorithm as optimization strategy and how to use a data augmentation strategy to increase the
| number of data available.
| The structure of the code is the same as the previus example, but an explanation of the data augmentation technique
| will be provided.
| In this case a SampleImporter is used to import the data instead of a JsonImporter.
| Using a SampleImporter requires the user to read the data and put it into different lists or DataFrames before to
| inizialize the SampleImporter instance.
| Then it is possible to increase the amount of data by using one of the external libraries who provide data augmentation
| approaches, in this example sklearn is used.
| Then all the information can be passed to the SampleImporter constructor and the import_data method can be used to provide
| the preprossing operations of the PyCTBN library.
| Then an estimator object is created, in this case a score based estimator,
| it necessary to pass a SamplePath object where build_trajectories and build_structure methods have already been called.
| If you have prior knowledge about the net structure pass it to the constructor with the known_edges parameter.
| The other parameters are contextual to the StructureScoreBasedEstimator, see the documentation for more details.
| To estimate the structure simply call the estimate_structure method passing the desidered parameters, such as the
| optimization strategy, or simply use the default configuration.
| In this case an Hill Climbing approch is choosen.
.. code-block:: python
import glob
import os
from sklearn.utils import resample
from PyCTBN import SampleImporter
from PyCTBN import SamplePath
from PyCTBN import StructureScoreBasedEstimator
def structure_constraint_based_estimation_example():
# <read the json files in ./data path>
read_files = glob.glob(os.path.join('./data', "*.json"))
# read the first file in the directory (or pass the file path)
with open(file_path=read_files[0]) as f:
raw_data = json.load(f)
# read the variables information
variables= pd.DataFrame(raw_data[0]["variables"])
# read the prior information if they are given
prior_net_structure = pd.DataFrame(raw_data[0]["dyn.str"])
#read the samples
trajectory_list_raw= raw_data[0]["samples"]
#convert them in DataFrame
trajectory_list = [pd.DataFrame(sample) for sample in trajectory_list_raw]
# use an external library in order to provide the data augmentation operations, in this case
# sklearn.utils is used
augmented_trajectory_list = resample (trajectory_list, replace = True, n_samples = 300 )
# <initialize a SampleImporter object using the data read before>
importer = SampleImporter(
trajectory_list = augmented_trajectory_list,
variables=variables,
prior_net_structure=prior_net_structure
)
# <import the data>
importer.import_data()
# construct a SamplePath Object passing a filled AbstractImporter object
s1 = SamplePath(importer=importer)
# build the trajectories
s1.build_trajectories()
# build the real structure
# build the information about the net
s1.build_structure()
# construct a StructureEstimator object
se1 = StructureEstimator(s1, 0.1, 0.1)
# call the ctpc algorithm
se1.ctpc_algorithm()
# the adjacency matrix of the estimated structure
# construct a StructureEstimator object passing a correctly build SamplePath object
# and hyperparameters tau and alpha, if you have prior knowledge about
# the net structure create a list of tuples
# that contains them and pass it as known_edges parameter
se1 = StructureScoreBasedEstimator(sample_path=s1, tau_xu = 0.1, alpha_xu = 1,
known_edges=[])
# call the algorithm to estimate the structure
# and pass all the desidered parameters, in this case a Tabu Search approach
# will be selected as optimization strategy. It is possible to select the tabu list length and
# the tabu rules duration, and the other parameters as in the previus example.
se1.estimate_structure(
max_parents = None,
iterations_number = 100,
patience = 20,
optimizer = 'tabu',
tabu_length = 10,
tabu_rules_duration = 10
)
# obtain the adjacency matrix of the estimated structure
print(se1.adjacency_matrix())
# save results to a json file
se1.save_results()
# save the estimated structure to a json file
# (remember to specify the path AND the .json extension)....
se1.save_results('./results0.json')
# ...or save it also in a graphical model fashion
# (remember to specify the path AND the .png extension)
se1.save_plot_estimated_structure_graph('./result0.png')

@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: b22e9cd1b245962cc8b033cb6fcce1d2
config: 481da5f157a263da657ebbabcd85e902
tags: 645f666f9bcd5a90fca523b33c5a78b7

@ -61,7 +61,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -115,12 +115,12 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-pyctbn-estimators-package">
<section id="pyctbn-pyctbn-estimators-package">
<h1>PyCTBN.PyCTBN.estimators package<a class="headerlink" href="#pyctbn-pyctbn-estimators-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.estimators.fam_score_calculator">
</section>
<section id="module-PyCTBN.PyCTBN.estimators.fam_score_calculator">
<span id="pyctbn-pyctbn-estimators-fam-score-calculator-module"></span><h2>PyCTBN.PyCTBN.estimators.fam_score_calculator module<a class="headerlink" href="#module-PyCTBN.PyCTBN.estimators.fam_score_calculator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.estimators.fam_score_calculator.FamScoreCalculator">
@ -300,8 +300,8 @@ and a specif parents’s assignment</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.estimators.parameters_estimator">
</section>
<section id="module-PyCTBN.PyCTBN.estimators.parameters_estimator">
<span id="pyctbn-pyctbn-estimators-parameters-estimator-module"></span><h2>PyCTBN.PyCTBN.estimators.parameters_estimator module<a class="headerlink" href="#module-PyCTBN.PyCTBN.estimators.parameters_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.estimators.parameters_estimator.ParametersEstimator">
@ -385,8 +385,8 @@ in the graph <code class="docutils literal notranslate"><span class="pre">_net_g
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator">
</section>
<section id="module-PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator">
<span id="pyctbn-pyctbn-estimators-structure-constraint-based-estimator-module"></span><h2>PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator module<a class="headerlink" href="#module-PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator">
@ -467,22 +467,34 @@ Generates all the necessary structures and datas to perform the tests.</p>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator.ctpc_algorithm">
<code class="sig-name descname">ctpc_algorithm</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">disable_multiprocessing</span><span class="p">:</span> <span class="n">bool</span> <span class="o">=</span> <span class="default_value">False</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator.ctpc_algorithm" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">ctpc_algorithm</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">disable_multiprocessing</span><span class="p">:</span> <span class="n">bool</span> <span class="o">=</span> <span class="default_value">False</span></em>, <em class="sig-param"><span class="n">processes_number</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator.ctpc_algorithm" title="Permalink to this definition"></a></dt>
<dd><p>Compute the CTPC algorithm over the entire net.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>disable_multiprocessing</strong> (<em>Boolean</em><em>, </em><em>optional</em>) – true if you desire to disable the multiprocessing operations, default to False</p></li>
<li><p><strong>processes_number</strong> – if disable_multiprocessing is false indicates</p></li>
</ul>
</dd>
</dl>
<p>the maximum number of process; if None it will be automatically set, default to None
:type processes_number: int, optional</p>
</dd></dl>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator.estimate_structure">
<code class="sig-name descname">estimate_structure</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">disable_multiprocessing</span><span class="p">:</span> <span class="n">bool</span> <span class="o">=</span> <span class="default_value">False</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator.estimate_structure" title="Permalink to this definition"></a></dt>
<dd><p>Abstract method to estimate the structure</p>
<code class="sig-name descname">estimate_structure</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">disable_multiprocessing</span><span class="p">:</span> <span class="n">bool</span> <span class="o">=</span> <span class="default_value">False</span></em>, <em class="sig-param"><span class="n">processes_number</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator.estimate_structure" title="Permalink to this definition"></a></dt>
<dd><p>Compute the constraint-based algorithm to find the optimal structure</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>List of estimated edges</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>Typing.List</p>
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>disable_multiprocessing</strong> (<em>Boolean</em><em>, </em><em>optional</em>) – true if you desire to disable the multiprocessing operations, default to False</p></li>
<li><p><strong>processes_number</strong> – if disable_multiprocessing is false indicates</p></li>
</ul>
</dd>
</dl>
<p>the maximum number of process; if None it will be automatically set, default to None
:type processes_number: int, optional</p>
</dd></dl>
<dl class="py method">
@ -521,8 +533,8 @@ it is performed also the chi_test.</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.estimators.structure_estimator">
</section>
<section id="module-PyCTBN.PyCTBN.estimators.structure_estimator">
<span id="pyctbn-pyctbn-estimators-structure-estimator-module"></span><h2>PyCTBN.PyCTBN.estimators.structure_estimator module<a class="headerlink" href="#module-PyCTBN.PyCTBN.estimators.structure_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.estimators.structure_estimator.StructureEstimator">
@ -636,8 +648,7 @@ that do not contains a the node identified by <code class="docutils literal notr
<dl class="py method">
<dt id="PyCTBN.PyCTBN.estimators.structure_estimator.StructureEstimator.save_plot_estimated_structure_graph">
<code class="sig-name descname">save_plot_estimated_structure_graph</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">file_path</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_estimator.StructureEstimator.save_plot_estimated_structure_graph" title="Permalink to this definition"></a></dt>
<dd><p>Plot the estimated structure in a graphical model style, use .png extension.
Spurious edges are colored in red if a prior structure is present.</p>
<dd><p>Plot the estimated structure in a graphical model style, use .png extension.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>file_path</strong> – path to save the file to</p>
@ -678,8 +689,8 @@ Spurious edges are colored in red if a prior structure is present.</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.estimators.structure_score_based_estimator">
</section>
<section id="module-PyCTBN.PyCTBN.estimators.structure_score_based_estimator">
<span id="pyctbn-pyctbn-estimators-structure-score-based-estimator-module"></span><h2>PyCTBN.PyCTBN.estimators.structure_score_based_estimator module<a class="headerlink" href="#module-PyCTBN.PyCTBN.estimators.structure_score_based_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.estimators.structure_score_based_estimator.StructureScoreBasedEstimator">
@ -724,7 +735,7 @@ using a score based approach and differt kinds of optimization algorithms.</p>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.estimators.structure_score_based_estimator.StructureScoreBasedEstimator.estimate_structure">
<code class="sig-name descname">estimate_structure</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">max_parents</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">iterations_number</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">40</span></em>, <em class="sig-param"><span class="n">patience</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">tabu_length</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">tabu_rules_duration</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">optimizer</span><span class="p">:</span> <span class="n">str</span> <span class="o">=</span> <span class="default_value">'tabu'</span></em>, <em class="sig-param"><span class="n">disable_multiprocessing</span><span class="p">:</span> <span class="n">bool</span> <span class="o">=</span> <span class="default_value">False</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_score_based_estimator.StructureScoreBasedEstimator.estimate_structure" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">estimate_structure</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">max_parents</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">iterations_number</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">40</span></em>, <em class="sig-param"><span class="n">patience</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">tabu_length</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">tabu_rules_duration</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">optimizer</span><span class="p">:</span> <span class="n">str</span> <span class="o">=</span> <span class="default_value">'tabu'</span></em>, <em class="sig-param"><span class="n">disable_multiprocessing</span><span class="p">:</span> <span class="n">bool</span> <span class="o">=</span> <span class="default_value">False</span></em>, <em class="sig-param"><span class="n">processes_number</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_score_based_estimator.StructureScoreBasedEstimator.estimate_structure" title="Permalink to this definition"></a></dt>
<dd><p>Compute the score-based algorithm to find the optimal structure</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
@ -736,9 +747,12 @@ using a score based approach and differt kinds of optimization algorithms.</p>
<li><p><strong>tabu_rules_duration</strong> (<em>int</em><em>, </em><em>optional</em>) – number of iterations in which each rule keeps its value, default to None</p></li>
<li><p><strong>optimizer</strong> (<em>string</em><em>, </em><em>optional</em>) – name of the optimizer algorithm. Possible values: ‘hill’ (Hill climbing),’tabu’ (tabu search), defualt to ‘tabu’</p></li>
<li><p><strong>disable_multiprocessing</strong> (<em>Boolean</em><em>, </em><em>optional</em>) – true if you desire to disable the multiprocessing operations, default to False</p></li>
<li><p><strong>processes_number</strong> – if disable_multiprocessing is false indicates</p></li>
</ul>
</dd>
</dl>
<p>the maximum number of process; if None it will be automatically set, default to None
:type processes_number: int, optional</p>
</dd></dl>
<dl class="py method">
@ -763,11 +777,11 @@ using a score based approach and differt kinds of optimization algorithms.</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.estimators">
</section>
<section id="module-PyCTBN.PyCTBN.estimators">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.PyCTBN.estimators" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -60,7 +60,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#subpackages">Subpackages</a></li>
@ -114,9 +114,9 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-pyctbn-package">
<section id="pyctbn-pyctbn-package">
<h1>PyCTBN.PyCTBN package<a class="headerlink" href="#pyctbn-pyctbn-package" title="Permalink to this headline"></a></h1>
<div class="section" id="subpackages">
<section id="subpackages">
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline"></a></h2>
<div class="toctree-wrapper compound">
<ul>
@ -161,11 +161,11 @@
</li>
</ul>
</div>
</div>
<div class="section" id="module-PyCTBN.PyCTBN">
</section>
<section id="module-PyCTBN.PyCTBN">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.PyCTBN" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -61,7 +61,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -115,12 +115,12 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-pyctbn-optimizers-package">
<section id="pyctbn-pyctbn-optimizers-package">
<h1>PyCTBN.PyCTBN.optimizers package<a class="headerlink" href="#pyctbn-pyctbn-optimizers-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.optimizers.constraint_based_optimizer">
</section>
<section id="module-PyCTBN.PyCTBN.optimizers.constraint_based_optimizer">
<span id="pyctbn-pyctbn-optimizers-constraint-based-optimizer-module"></span><h2>PyCTBN.PyCTBN.optimizers.constraint_based_optimizer module<a class="headerlink" href="#module-PyCTBN.PyCTBN.optimizers.constraint_based_optimizer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.optimizers.constraint_based_optimizer.ConstraintBasedOptimizer">
@ -152,8 +152,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.optimizers.hill_climbing_search">
</section>
<section id="module-PyCTBN.PyCTBN.optimizers.hill_climbing_search">
<span id="pyctbn-pyctbn-optimizers-hill-climbing-search-module"></span><h2>PyCTBN.PyCTBN.optimizers.hill_climbing_search module<a class="headerlink" href="#module-PyCTBN.PyCTBN.optimizers.hill_climbing_search" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.optimizers.hill_climbing_search.HillClimbing">
@ -187,8 +187,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.optimizers.optimizer">
</section>
<section id="module-PyCTBN.PyCTBN.optimizers.optimizer">
<span id="pyctbn-pyctbn-optimizers-optimizer-module"></span><h2>PyCTBN.PyCTBN.optimizers.optimizer module<a class="headerlink" href="#module-PyCTBN.PyCTBN.optimizers.optimizer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.optimizers.optimizer.Optimizer">
@ -219,8 +219,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.optimizers.tabu_search">
</section>
<section id="module-PyCTBN.PyCTBN.optimizers.tabu_search">
<span id="pyctbn-pyctbn-optimizers-tabu-search-module"></span><h2>PyCTBN.PyCTBN.optimizers.tabu_search module<a class="headerlink" href="#module-PyCTBN.PyCTBN.optimizers.tabu_search" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.optimizers.tabu_search.TabuSearch">
@ -256,11 +256,11 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.optimizers">
</section>
<section id="module-PyCTBN.PyCTBN.optimizers">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.PyCTBN.optimizers" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -61,7 +61,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -115,12 +115,12 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-pyctbn-structure-graph-package">
<section id="pyctbn-pyctbn-structure-graph-package">
<h1>PyCTBN.PyCTBN.structure_graph package<a class="headerlink" href="#pyctbn-pyctbn-structure-graph-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix">
</section>
<section id="module-PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix">
<span id="pyctbn-pyctbn-structure-graph-conditional-intensity-matrix-module"></span><h2>PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix module<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix.ConditionalIntensityMatrix">
@ -163,8 +163,8 @@ The class member <code class="docutils literal notranslate"><span class="pre">_c
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph.network_graph">
</section>
<section id="module-PyCTBN.PyCTBN.structure_graph.network_graph">
<span id="pyctbn-pyctbn-structure-graph-network-graph-module"></span><h2>PyCTBN.PyCTBN.structure_graph.network_graph module<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph.network_graph" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph">
@ -456,8 +456,8 @@ Initialize all the filtering/indexing structures.</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph.sample_path">
</section>
<section id="module-PyCTBN.PyCTBN.structure_graph.sample_path">
<span id="pyctbn-pyctbn-structure-graph-sample-path-module"></span><h2>PyCTBN.PyCTBN.structure_graph.sample_path module<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph.sample_path" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.structure_graph.sample_path.SamplePath">
@ -520,8 +520,8 @@ Clears all the unused dataframes in <code class="docutils literal notranslate"><
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph.set_of_cims">
</section>
<section id="module-PyCTBN.PyCTBN.structure_graph.set_of_cims">
<span id="pyctbn-pyctbn-structure-graph-set-of-cims-module"></span><h2>PyCTBN.PyCTBN.structure_graph.set_of_cims module<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph.set_of_cims" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims">
@ -606,8 +606,8 @@ Compute the cim coefficients.The class member <code class="docutils literal notr
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph.structure">
</section>
<section id="module-PyCTBN.PyCTBN.structure_graph.structure">
<span id="pyctbn-pyctbn-structure-graph-structure-module"></span><h2>PyCTBN.PyCTBN.structure_graph.structure module<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph.structure" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.structure_graph.structure.Structure">
@ -735,8 +735,8 @@ The class member <code class="docutils literal notranslate"><span class="pre">_t
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph.trajectory">
</section>
<section id="module-PyCTBN.PyCTBN.structure_graph.trajectory">
<span id="pyctbn-pyctbn-structure-graph-trajectory-module"></span><h2>PyCTBN.PyCTBN.structure_graph.trajectory module<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph.trajectory" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.structure_graph.trajectory.Trajectory">
@ -780,11 +780,11 @@ The class member <code class="docutils literal notranslate"><span class="pre">_t
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph">
</section>
<section id="module-PyCTBN.PyCTBN.structure_graph">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -61,7 +61,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -115,12 +115,12 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-pyctbn-utility-package">
<section id="pyctbn-pyctbn-utility-package">
<h1>PyCTBN.PyCTBN.utility package<a class="headerlink" href="#pyctbn-pyctbn-utility-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.utility.abstract_importer">
</section>
<section id="module-PyCTBN.PyCTBN.utility.abstract_importer">
<span id="pyctbn-pyctbn-utility-abstract-importer-module"></span><h2>PyCTBN.PyCTBN.utility.abstract_importer module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.abstract_importer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter">
@ -281,8 +281,8 @@ dataset</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.utility.cache">
</section>
<section id="module-PyCTBN.PyCTBN.utility.cache">
<span id="pyctbn-pyctbn-utility-cache-module"></span><h2>PyCTBN.PyCTBN.utility.cache module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.cache" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.utility.cache.Cache">
@ -340,8 +340,8 @@ None otherwise.</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.utility.json_importer">
</section>
<section id="module-PyCTBN.PyCTBN.utility.json_importer">
<span id="pyctbn-pyctbn-utility-json-importer-module"></span><h2>PyCTBN.PyCTBN.utility.json_importer module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.json_importer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.utility.json_importer.JsonImporter">
@ -391,11 +391,11 @@ dataset</p>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.json_importer.JsonImporter.import_data">
<code class="sig-name descname">import_data</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">indx</span><span class="p">:</span> <span class="n">int</span></em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#PyCTBN.PyCTBN.utility.json_importer.JsonImporter.import_data" title="Permalink to this definition"></a></dt>
<code class="sig-name descname">import_data</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">indx</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">0</span></em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#PyCTBN.PyCTBN.utility.json_importer.JsonImporter.import_data" title="Permalink to this definition"></a></dt>
<dd><p>Implements the abstract method of <code class="xref py py-class docutils literal notranslate"><span class="pre">AbstractImporter</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>indx</strong> (<em>int</em>) – the index of the outer JsonArray to extract the data from</p>
<dd class="field-odd"><p><strong>indx</strong> (<em>int</em>) – the index of the outer JsonArray to extract the data from, default to 0</p>
</dd>
</dl>
</dd></dl>
@ -531,8 +531,8 @@ as keys for the set of CIMS of a particular node.</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.utility.sample_importer">
</section>
<section id="module-PyCTBN.PyCTBN.utility.sample_importer">
<span id="pyctbn-pyctbn-utility-sample-importer-module"></span><h2>PyCTBN.PyCTBN.utility.sample_importer module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.sample_importer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.utility.sample_importer.SampleImporter">
@ -575,11 +575,11 @@ dataset</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.utility">
</section>
<section id="module-PyCTBN.PyCTBN.utility">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -58,7 +58,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -112,9 +112,9 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-package">
<section id="pyctbn-package">
<h1>PyCTBN package<a class="headerlink" href="#pyctbn-package" title="Permalink to this headline"></a></h1>
<div class="section" id="subpackages">
<section id="subpackages">
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline"></a></h2>
<div class="toctree-wrapper compound">
<ul>
@ -166,14 +166,14 @@
</li>
</ul>
</div>
</div>
<div class="section" id="submodules">
</section>
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN">
</section>
<section id="module-PyCTBN">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -58,7 +58,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -112,12 +112,12 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-tests-estimators-package">
<section id="pyctbn-tests-estimators-package">
<h1>PyCTBN.tests.estimators package<a class="headerlink" href="#pyctbn-tests-estimators-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.tests.estimators.test_parameters_estimator">
</section>
<section id="module-PyCTBN.tests.estimators.test_parameters_estimator">
<span id="pyctbn-tests-estimators-test-parameters-estimator-module"></span><h2>PyCTBN.tests.estimators.test_parameters_estimator module<a class="headerlink" href="#module-PyCTBN.tests.estimators.test_parameters_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.estimators.test_parameters_estimator.TestParametersEstimatior">
@ -156,8 +156,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.estimators.test_structure_constraint_based_estimator">
</section>
<section id="module-PyCTBN.tests.estimators.test_structure_constraint_based_estimator">
<span id="pyctbn-tests-estimators-test-structure-constraint-based-estimator-module"></span><h2>PyCTBN.tests.estimators.test_structure_constraint_based_estimator module<a class="headerlink" href="#module-PyCTBN.tests.estimators.test_structure_constraint_based_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.estimators.test_structure_constraint_based_estimator.TestStructureConstraintBasedEstimator">
@ -186,8 +186,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.estimators.test_structure_estimator">
</section>
<section id="module-PyCTBN.tests.estimators.test_structure_estimator">
<span id="pyctbn-tests-estimators-test-structure-estimator-module"></span><h2>PyCTBN.tests.estimators.test_structure_estimator module<a class="headerlink" href="#module-PyCTBN.tests.estimators.test_structure_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.estimators.test_structure_estimator.TestStructureEstimator">
@ -241,8 +241,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.estimators.test_structure_score_based_estimator">
</section>
<section id="module-PyCTBN.tests.estimators.test_structure_score_based_estimator">
<span id="pyctbn-tests-estimators-test-structure-score-based-estimator-module"></span><h2>PyCTBN.tests.estimators.test_structure_score_based_estimator module<a class="headerlink" href="#module-PyCTBN.tests.estimators.test_structure_score_based_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.estimators.test_structure_score_based_estimator.TestStructureScoreBasedEstimator">
@ -276,11 +276,11 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.estimators">
</section>
<section id="module-PyCTBN.tests.estimators">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.tests.estimators" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -58,7 +58,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -112,9 +112,9 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-tests-package">
<section id="pyctbn-tests-package">
<h1>PyCTBN.tests package<a class="headerlink" href="#pyctbn-tests-package" title="Permalink to this headline"></a></h1>
<div class="section" id="subpackages">
<section id="subpackages">
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline"></a></h2>
<div class="toctree-wrapper compound">
<ul>
@ -155,11 +155,11 @@
</li>
</ul>
</div>
</div>
<div class="section" id="module-PyCTBN.tests">
</section>
<section id="module-PyCTBN.tests">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.tests" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -58,7 +58,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -112,12 +112,12 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-tests-optimizers-package">
<section id="pyctbn-tests-optimizers-package">
<h1>PyCTBN.tests.optimizers package<a class="headerlink" href="#pyctbn-tests-optimizers-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.tests.optimizers.test_hill_climbing_search">
</section>
<section id="module-PyCTBN.tests.optimizers.test_hill_climbing_search">
<span id="pyctbn-tests-optimizers-test-hill-climbing-search-module"></span><h2>PyCTBN.tests.optimizers.test_hill_climbing_search module<a class="headerlink" href="#module-PyCTBN.tests.optimizers.test_hill_climbing_search" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.optimizers.test_hill_climbing_search.TestHillClimbingSearch">
@ -141,8 +141,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.optimizers.test_tabu_search">
</section>
<section id="module-PyCTBN.tests.optimizers.test_tabu_search">
<span id="pyctbn-tests-optimizers-test-tabu-search-module"></span><h2>PyCTBN.tests.optimizers.test_tabu_search module<a class="headerlink" href="#module-PyCTBN.tests.optimizers.test_tabu_search" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.optimizers.test_tabu_search.TestTabuSearch">
@ -166,11 +166,11 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.optimizers">
</section>
<section id="module-PyCTBN.tests.optimizers">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.tests.optimizers" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -58,7 +58,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -112,12 +112,12 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-tests-structure-graph-package">
<section id="pyctbn-tests-structure-graph-package">
<h1>PyCTBN.tests.structure_graph package<a class="headerlink" href="#pyctbn-tests-structure-graph-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.tests.structure_graph.test_cim">
</section>
<section id="module-PyCTBN.tests.structure_graph.test_cim">
<span id="pyctbn-tests-structure-graph-test-cim-module"></span><h2>PyCTBN.tests.structure_graph.test_cim module<a class="headerlink" href="#module-PyCTBN.tests.structure_graph.test_cim" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.structure_graph.test_cim.TestConditionalIntensityMatrix">
@ -146,8 +146,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.structure_graph.test_networkgraph">
</section>
<section id="module-PyCTBN.tests.structure_graph.test_networkgraph">
<span id="pyctbn-tests-structure-graph-test-networkgraph-module"></span><h2>PyCTBN.tests.structure_graph.test_networkgraph module<a class="headerlink" href="#module-PyCTBN.tests.structure_graph.test_networkgraph" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.structure_graph.test_networkgraph.TestNetworkGraph">
@ -251,8 +251,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.structure_graph.test_sample_path">
</section>
<section id="module-PyCTBN.tests.structure_graph.test_sample_path">
<span id="pyctbn-tests-structure-graph-test-sample-path-module"></span><h2>PyCTBN.tests.structure_graph.test_sample_path module<a class="headerlink" href="#module-PyCTBN.tests.structure_graph.test_sample_path" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.structure_graph.test_sample_path.TestSamplePath">
@ -311,8 +311,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.structure_graph.test_setofcims">
</section>
<section id="module-PyCTBN.tests.structure_graph.test_setofcims">
<span id="pyctbn-tests-structure-graph-test-setofcims-module"></span><h2>PyCTBN.tests.structure_graph.test_setofcims module<a class="headerlink" href="#module-PyCTBN.tests.structure_graph.test_setofcims" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.structure_graph.test_setofcims.TestSetOfCims">
@ -368,8 +368,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.structure_graph.test_structure">
</section>
<section id="module-PyCTBN.tests.structure_graph.test_structure">
<span id="pyctbn-tests-structure-graph-test-structure-module"></span><h2>PyCTBN.tests.structure_graph.test_structure module<a class="headerlink" href="#module-PyCTBN.tests.structure_graph.test_structure" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.structure_graph.test_structure.TestStructure">
@ -423,8 +423,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.structure_graph.test_trajectory">
</section>
<section id="module-PyCTBN.tests.structure_graph.test_trajectory">
<span id="pyctbn-tests-structure-graph-test-trajectory-module"></span><h2>PyCTBN.tests.structure_graph.test_trajectory module<a class="headerlink" href="#module-PyCTBN.tests.structure_graph.test_trajectory" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.structure_graph.test_trajectory.TestTrajectory">
@ -443,11 +443,11 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.structure_graph">
</section>
<section id="module-PyCTBN.tests.structure_graph">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.tests.structure_graph" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -58,7 +58,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -112,12 +112,12 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-tests-utility-package">
<section id="pyctbn-tests-utility-package">
<h1>PyCTBN.tests.utility package<a class="headerlink" href="#pyctbn-tests-utility-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.tests.utility.test_cache">
</section>
<section id="module-PyCTBN.tests.utility.test_cache">
<span id="pyctbn-tests-utility-test-cache-module"></span><h2>PyCTBN.tests.utility.test_cache module<a class="headerlink" href="#module-PyCTBN.tests.utility.test_cache" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.utility.test_cache.TestCache">
@ -145,8 +145,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.utility.test_json_importer">
</section>
<section id="module-PyCTBN.tests.utility.test_json_importer">
<span id="pyctbn-tests-utility-test-json-importer-module"></span><h2>PyCTBN.tests.utility.test_json_importer module<a class="headerlink" href="#module-PyCTBN.tests.utility.test_json_importer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.utility.test_json_importer.TestJsonImporter">
@ -255,8 +255,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.utility.test_sample_importer">
</section>
<section id="module-PyCTBN.tests.utility.test_sample_importer">
<span id="pyctbn-tests-utility-test-sample-importer-module"></span><h2>PyCTBN.tests.utility.test_sample_importer module<a class="headerlink" href="#module-PyCTBN.tests.utility.test_sample_importer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.utility.test_sample_importer.TestSampleImporter">
@ -285,11 +285,11 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.tests.utility">
</section>
<section id="module-PyCTBN.tests.utility">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.tests.utility" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -3,9 +3,9 @@ Examples
Installation/Usage
******************
Download the release in .tar.gz or .whl format and simply use pip install to install it::
Download the latest release in .tar.gz or .whl format and simply use pip install to install it::
$pip install PyCTBN-1.0.tar.gz
$pip install PyCTBN-2.2.tar.gz
Implementing your own data importer

@ -58,7 +58,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -112,9 +112,9 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="basic-main-module">
<section id="basic-main-module">
<h1>basic_main module<a class="headerlink" href="#basic-main-module" title="Permalink to this headline"></a></h1>
</div>
</section>
</div>

@ -59,7 +59,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -113,16 +113,16 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="examples">
<section id="examples">
<h1>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h1>
<div class="section" id="installation-usage">
<section id="installation-usage">
<h2>Installation/Usage<a class="headerlink" href="#installation-usage" title="Permalink to this headline"></a></h2>
<p>Download the release in .tar.gz or .whl format and simply use pip install to install it:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$pip install PyCTBN-1.0.tar.gz
<p>Download the latest release in .tar.gz or .whl format and simply use pip install to install it:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$pip install PyCTBN-2.2.tar.gz
</pre></div>
</div>
</div>
<div class="section" id="implementing-your-own-data-importer">
</section>
<section id="implementing-your-own-data-importer">
<h2>Implementing your own data importer<a class="headerlink" href="#implementing-your-own-data-importer" title="Permalink to this headline"></a></h2>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="sd">&quot;&quot;&quot;This example demonstrates the implementation of a simple data importer the extends the class abstract importer to import data in csv format.</span>
<span class="sd">The net in exam has three ternary nodes and no prior net structure.</span>
@ -161,8 +161,8 @@
<span class="k">pass</span>
</pre></div>
</div>
</div>
<div class="section" id="parameters-estimation-example">
</section>
<section id="parameters-estimation-example">
<h2>Parameters Estimation Example<a class="headerlink" href="#parameters-estimation-example" title="Permalink to this headline"></a></h2>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">PyCTBN</span> <span class="kn">import</span> <span class="n">JsonImporter</span>
<span class="kn">from</span> <span class="nn">PyCTBN</span> <span class="kn">import</span> <span class="n">SamplePath</span>
@ -199,8 +199,8 @@
<span class="nb">print</span><span class="p">(</span><span class="n">sofc1</span><span class="o">.</span><span class="n">actual_cims</span><span class="p">)</span>
</pre></div>
</div>
</div>
<div class="section" id="structure-estimation-example">
</section>
<section id="structure-estimation-example">
<h2>Structure Estimation Example<a class="headerlink" href="#structure-estimation-example" title="Permalink to this headline"></a></h2>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">PyCTBN</span> <span class="kn">import</span> <span class="n">JsonImporter</span>
<span class="kn">from</span> <span class="nn">PyCTBN</span> <span class="kn">import</span> <span class="n">SamplePath</span>
@ -230,8 +230,8 @@
<span class="n">se1</span><span class="o">.</span><span class="n">save_results</span><span class="p">()</span>
</pre></div>
</div>
</div>
</div>
</section>
</section>
</div>

@ -58,7 +58,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>

@ -59,7 +59,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -113,10 +113,10 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="welcome-to-pyctbn-s-documentation">
<section id="welcome-to-pyctbn-s-documentation">
<h1>Welcome to PyCTBN’s documentation!<a class="headerlink" href="#welcome-to-pyctbn-s-documentation" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a><ul>
@ -173,15 +173,15 @@
</li>
</ul>
</div>
</div>
<div class="section" id="indices-and-tables">
</section>
<section id="indices-and-tables">
<h1>Indices and tables<a class="headerlink" href="#indices-and-tables" title="Permalink to this headline"></a></h1>
<ul class="simple">
<li><p><a class="reference internal" href="genindex.html"><span class="std std-ref">Index</span></a></p></li>
<li><p><a class="reference internal" href="py-modindex.html"><span class="std std-ref">Module Index</span></a></p></li>
<li><p><a class="reference internal" href="search.html"><span class="std std-ref">Search Page</span></a></p></li>
</ul>
</div>
</section>
</div>

@ -58,7 +58,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -112,7 +112,7 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn">
<section id="pyctbn">
<h1>PyCTBN<a class="headerlink" href="#pyctbn" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
<ul>
@ -171,7 +171,7 @@
</li>
</ul>
</div>
</div>
</section>
</div>

@ -61,7 +61,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>

@ -58,7 +58,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>

File diff suppressed because one or more lines are too long

@ -58,7 +58,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -112,9 +112,9 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="setup-module">
<section id="setup-module">
<h1>setup module<a class="headerlink" href="#setup-module" title="Permalink to this headline"></a></h1>
</div>
</section>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

@ -3,9 +3,9 @@ Examples
Installation/Usage
******************
Download the release in .tar.gz or .whl format and simply use pip install to install it::
Download the latest release in .tar.gz or .whl format and simply use pip install to install it::
$pip install PyCTBN-1.0.tar.gz
$pip install PyCTBN-2.2.tar.gz
Implementing your own data importer

@ -65,7 +65,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -119,12 +119,12 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-pyctbn-estimators-package">
<section id="pyctbn-pyctbn-estimators-package">
<h1>PyCTBN.PyCTBN.estimators package<a class="headerlink" href="#pyctbn-pyctbn-estimators-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.estimators.fam_score_calculator">
</section>
<section id="module-PyCTBN.PyCTBN.estimators.fam_score_calculator">
<span id="pyctbn-pyctbn-estimators-fam-score-calculator-module"></span><h2>PyCTBN.PyCTBN.estimators.fam_score_calculator module<a class="headerlink" href="#module-PyCTBN.PyCTBN.estimators.fam_score_calculator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.estimators.fam_score_calculator.FamScoreCalculator">
@ -304,8 +304,8 @@ and a specif parents’s assignment</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.estimators.parameters_estimator">
</section>
<section id="module-PyCTBN.PyCTBN.estimators.parameters_estimator">
<span id="pyctbn-pyctbn-estimators-parameters-estimator-module"></span><h2>PyCTBN.PyCTBN.estimators.parameters_estimator module<a class="headerlink" href="#module-PyCTBN.PyCTBN.estimators.parameters_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.estimators.parameters_estimator.ParametersEstimator">
@ -389,8 +389,8 @@ in the graph <code class="docutils literal notranslate"><span class="pre">_net_g
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator">
</section>
<section id="module-PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator">
<span id="pyctbn-pyctbn-estimators-structure-constraint-based-estimator-module"></span><h2>PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator module<a class="headerlink" href="#module-PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator">
@ -470,23 +470,39 @@ Generates all the necessary structures and datas to perform the tests.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator.ctpc_algorithm">
<span class="sig-name descname"><span class="pre">ctpc_algorithm</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">disable_multiprocessing</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">bool</span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator.ctpc_algorithm" title="Permalink to this definition"></a></dt>
<dt id="PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator.ctpc_algorithm">
<code class="sig-name descname">ctpc_algorithm</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">disable_multiprocessing</span><span class="p">:</span> <span class="n">bool</span> <span class="o">=</span> <span class="default_value">False</span></em>, <em class="sig-param"><span class="n">processes_number</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator.ctpc_algorithm" title="Permalink to this definition"></a></dt>
<dd><p>Compute the CTPC algorithm over the entire net.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>disable_multiprocessing</strong> (<em>Boolean</em><em>, </em><em>optional</em>) – true if you desire to disable the multiprocessing operations, default to False</p></li>
<li><p><strong>processes_number</strong> – if disable_multiprocessing is false indicates</p></li>
</ul>
</dd>
</dl>
<p>the maximum number of process; if None it will be automatically set, default to None
:type processes_number: int, optional</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator.estimate_structure">
<span class="sig-name descname"><span class="pre">estimate_structure</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">disable_multiprocessing</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">bool</span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator.estimate_structure" title="Permalink to this definition"></a></dt>
<dd><p>Abstract method to estimate the structure</p>
<dt id="PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator.estimate_structure">
<code class="sig-name descname">estimate_structure</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">disable_multiprocessing</span><span class="p">:</span> <span class="n">bool</span> <span class="o">=</span> <span class="default_value">False</span></em>, <em class="sig-param"><span class="n">processes_number</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_constraint_based_estimator.StructureConstraintBasedEstimator.estimate_structure" title="Permalink to this definition"></a></dt>
<dd><p>Compute the constraint-based algorithm to find the optimal structure</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p>List of estimated edges</p>
</dd>
<dt class="field-even">Return type</dt>
<dd class="field-even"><p>Typing.List</p>
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>disable_multiprocessing</strong> (<em>Boolean</em><em>, </em><em>optional</em>) – true if you desire to disable the multiprocessing operations, default to False</p></li>
<li><p><strong>processes_number</strong> – if disable_multiprocessing is false indicates</p></li>
</ul>
</dd>
</dl>
<p>the maximum number of process; if None it will be automatically set, default to None
:type processes_number: int, optional</p>
</dd></dl>
<dl class="py method">
@ -525,8 +541,8 @@ it is performed also the chi_test.</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.estimators.structure_estimator">
</section>
<section id="module-PyCTBN.PyCTBN.estimators.structure_estimator">
<span id="pyctbn-pyctbn-estimators-structure-estimator-module"></span><h2>PyCTBN.PyCTBN.estimators.structure_estimator module<a class="headerlink" href="#module-PyCTBN.PyCTBN.estimators.structure_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.estimators.structure_estimator.StructureEstimator">
@ -638,10 +654,11 @@ that do not contains a the node identified by <code class="docutils literal notr
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.estimators.structure_estimator.StructureEstimator.save_plot_estimated_structure_graph">
<span class="sig-name descname"><span class="pre">save_plot_estimated_structure_graph</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">file_path</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">None</span><a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_estimator.StructureEstimator.save_plot_estimated_structure_graph" title="Permalink to this definition"></a></dt>
<dd><p>Plot the estimated structure in a graphical model style, use .png extension.
Spurious edges are colored in red if a prior structure is present.</p>
<dt id="PyCTBN.PyCTBN.estimators.structure_estimator.StructureEstimator.save_plot_estimated_structure_graph">
<code class="sig-name descname">save_plot_estimated_structure_graph</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">file_path</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_estimator.StructureEstimator.save_plot_estimated_structure_graph" title="Permalink to this definition"></a></dt>
<dd><p>Plot the estimated structure in a graphical model style, use .png extension.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>file_path</strong> – path to save the file to</p>
@ -682,8 +699,8 @@ Spurious edges are colored in red if a prior structure is present.</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.estimators.structure_score_based_estimator">
</section>
<section id="module-PyCTBN.PyCTBN.estimators.structure_score_based_estimator">
<span id="pyctbn-pyctbn-estimators-structure-score-based-estimator-module"></span><h2>PyCTBN.PyCTBN.estimators.structure_score_based_estimator module<a class="headerlink" href="#module-PyCTBN.PyCTBN.estimators.structure_score_based_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.estimators.structure_score_based_estimator.StructureScoreBasedEstimator">
@ -727,8 +744,10 @@ using a score based approach and differt kinds of optimization algorithms.</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.estimators.structure_score_based_estimator.StructureScoreBasedEstimator.estimate_structure">
<span class="sig-name descname"><span class="pre">estimate_structure</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">max_parents</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">iterations_number</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">int</span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">40</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">patience</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tabu_length</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">tabu_rules_duration</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">int</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">optimizer</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">str</span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">'tabu'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">disable_multiprocessing</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">bool</span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">False</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_score_based_estimator.StructureScoreBasedEstimator.estimate_structure" title="Permalink to this definition"></a></dt>
<dt id="PyCTBN.PyCTBN.estimators.structure_score_based_estimator.StructureScoreBasedEstimator.estimate_structure">
<code class="sig-name descname">estimate_structure</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">max_parents</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">iterations_number</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">40</span></em>, <em class="sig-param"><span class="n">patience</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">tabu_length</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">tabu_rules_duration</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">optimizer</span><span class="p">:</span> <span class="n">str</span> <span class="o">=</span> <span class="default_value">'tabu'</span></em>, <em class="sig-param"><span class="n">disable_multiprocessing</span><span class="p">:</span> <span class="n">bool</span> <span class="o">=</span> <span class="default_value">False</span></em>, <em class="sig-param"><span class="n">processes_number</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.estimators.structure_score_based_estimator.StructureScoreBasedEstimator.estimate_structure" title="Permalink to this definition"></a></dt>
<dd><p>Compute the score-based algorithm to find the optimal structure</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
@ -740,9 +759,12 @@ using a score based approach and differt kinds of optimization algorithms.</p>
<li><p><strong>tabu_rules_duration</strong> (<em>int</em><em>, </em><em>optional</em>) – number of iterations in which each rule keeps its value, default to None</p></li>
<li><p><strong>optimizer</strong> (<em>string</em><em>, </em><em>optional</em>) – name of the optimizer algorithm. Possible values: ‘hill’ (Hill climbing),’tabu’ (tabu search), defualt to ‘tabu’</p></li>
<li><p><strong>disable_multiprocessing</strong> (<em>Boolean</em><em>, </em><em>optional</em>) – true if you desire to disable the multiprocessing operations, default to False</p></li>
<li><p><strong>processes_number</strong> – if disable_multiprocessing is false indicates</p></li>
</ul>
</dd>
</dl>
<p>the maximum number of process; if None it will be automatically set, default to None
:type processes_number: int, optional</p>
</dd></dl>
<dl class="py method">
@ -767,11 +789,11 @@ using a score based approach and differt kinds of optimization algorithms.</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.estimators">
</section>
<section id="module-PyCTBN.PyCTBN.estimators">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.PyCTBN.estimators" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -64,7 +64,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#subpackages">Subpackages</a></li>
@ -118,9 +118,9 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-pyctbn-package">
<section id="pyctbn-pyctbn-package">
<h1>PyCTBN.PyCTBN package<a class="headerlink" href="#pyctbn-pyctbn-package" title="Permalink to this headline"></a></h1>
<div class="section" id="subpackages">
<section id="subpackages">
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline"></a></h2>
<div class="toctree-wrapper compound">
<ul>
@ -169,11 +169,11 @@
</li>
</ul>
</div>
</div>
<div class="section" id="module-PyCTBN.PyCTBN">
</section>
<section id="module-PyCTBN.PyCTBN">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.PyCTBN" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -65,7 +65,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -119,12 +119,12 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-pyctbn-optimizers-package">
<section id="pyctbn-pyctbn-optimizers-package">
<h1>PyCTBN.PyCTBN.optimizers package<a class="headerlink" href="#pyctbn-pyctbn-optimizers-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.optimizers.constraint_based_optimizer">
</section>
<section id="module-PyCTBN.PyCTBN.optimizers.constraint_based_optimizer">
<span id="pyctbn-pyctbn-optimizers-constraint-based-optimizer-module"></span><h2>PyCTBN.PyCTBN.optimizers.constraint_based_optimizer module<a class="headerlink" href="#module-PyCTBN.PyCTBN.optimizers.constraint_based_optimizer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.optimizers.constraint_based_optimizer.ConstraintBasedOptimizer">
@ -156,8 +156,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.optimizers.hill_climbing_search">
</section>
<section id="module-PyCTBN.PyCTBN.optimizers.hill_climbing_search">
<span id="pyctbn-pyctbn-optimizers-hill-climbing-search-module"></span><h2>PyCTBN.PyCTBN.optimizers.hill_climbing_search module<a class="headerlink" href="#module-PyCTBN.PyCTBN.optimizers.hill_climbing_search" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.optimizers.hill_climbing_search.HillClimbing">
@ -191,8 +191,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.optimizers.optimizer">
</section>
<section id="module-PyCTBN.PyCTBN.optimizers.optimizer">
<span id="pyctbn-pyctbn-optimizers-optimizer-module"></span><h2>PyCTBN.PyCTBN.optimizers.optimizer module<a class="headerlink" href="#module-PyCTBN.PyCTBN.optimizers.optimizer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.optimizers.optimizer.Optimizer">
@ -223,8 +223,8 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.optimizers.tabu_search">
</section>
<section id="module-PyCTBN.PyCTBN.optimizers.tabu_search">
<span id="pyctbn-pyctbn-optimizers-tabu-search-module"></span><h2>PyCTBN.PyCTBN.optimizers.tabu_search module<a class="headerlink" href="#module-PyCTBN.PyCTBN.optimizers.tabu_search" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.optimizers.tabu_search.TabuSearch">
@ -260,11 +260,11 @@
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.optimizers">
</section>
<section id="module-PyCTBN.PyCTBN.optimizers">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.PyCTBN.optimizers" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -65,7 +65,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -119,12 +119,12 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-pyctbn-structure-graph-package">
<section id="pyctbn-pyctbn-structure-graph-package">
<h1>PyCTBN.PyCTBN.structure_graph package<a class="headerlink" href="#pyctbn-pyctbn-structure-graph-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix">
</section>
<section id="module-PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix">
<span id="pyctbn-pyctbn-structure-graph-conditional-intensity-matrix-module"></span><h2>PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix module<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix.ConditionalIntensityMatrix">
@ -244,8 +244,8 @@ This method must obviously be executed after the graph has been generated.</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph.network_graph">
</section>
<section id="module-PyCTBN.PyCTBN.structure_graph.network_graph">
<span id="pyctbn-pyctbn-structure-graph-network-graph-module"></span><h2>PyCTBN.PyCTBN.structure_graph.network_graph module<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph.network_graph" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph">
@ -537,8 +537,8 @@ Initialize all the filtering/indexing structures.</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph.sample_path">
</section>
<section id="module-PyCTBN.PyCTBN.structure_graph.sample_path">
<span id="pyctbn-pyctbn-structure-graph-sample-path-module"></span><h2>PyCTBN.PyCTBN.structure_graph.sample_path module<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph.sample_path" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.structure_graph.sample_path.SamplePath">
@ -601,8 +601,8 @@ Clears all the unused dataframes in <code class="docutils literal notranslate"><
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph.set_of_cims">
</section>
<section id="module-PyCTBN.PyCTBN.structure_graph.set_of_cims">
<span id="pyctbn-pyctbn-structure-graph-set-of-cims-module"></span><h2>PyCTBN.PyCTBN.structure_graph.set_of_cims module<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph.set_of_cims" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims">
@ -687,8 +687,8 @@ Compute the cim coefficients.The class member <code class="docutils literal notr
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph.structure">
</section>
<section id="module-PyCTBN.PyCTBN.structure_graph.structure">
<span id="pyctbn-pyctbn-structure-graph-structure-module"></span><h2>PyCTBN.PyCTBN.structure_graph.structure module<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph.structure" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.structure_graph.structure.Structure">
@ -816,8 +816,8 @@ The class member <code class="docutils literal notranslate"><span class="pre">_t
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph.trajectory">
</section>
<section id="module-PyCTBN.PyCTBN.structure_graph.trajectory">
<span id="pyctbn-pyctbn-structure-graph-trajectory-module"></span><h2>PyCTBN.PyCTBN.structure_graph.trajectory module<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph.trajectory" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.structure_graph.trajectory.Trajectory">
@ -861,82 +861,13 @@ The class member <code class="docutils literal notranslate"><span class="pre">_t
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph.trajectory_generator">
<span id="pyctbn-pyctbn-structure-graph-trajectory-generator-module"></span><h2>PyCTBN.PyCTBN.structure_graph.trajectory_generator module<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph.trajectory_generator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.structure_graph.trajectory_generator.TrajectoryGenerator">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">PyCTBN.PyCTBN.structure_graph.trajectory_generator.</span></span><span class="sig-name descname"><span class="pre">TrajectoryGenerator</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">importer</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><a class="reference internal" href="PyCTBN.PyCTBN.utility.html#PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter" title="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter"><span class="pre">PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter</span></a><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">variables</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">pandas.core.frame.DataFrame</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dyn_str</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">pandas.core.frame.DataFrame</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dyn_cims</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">dict</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.structure_graph.trajectory_generator.TrajectoryGenerator" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
<p>Provides the methods to generate a trajectory basing on the network defined
in the importer.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>_importer</strong> (<a class="reference internal" href="PyCTBN.PyCTBN.utility.html#PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter" title="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter"><em>AbstractImporter</em></a>) – the Importer object which contains the imported and processed data</p></li>
<li><p><strong>_vnames</strong> (<em>List</em>) – List of the variables labels that belong to the network</p></li>
<li><p><strong>_parents</strong> (<em>Dict</em>) – It contains, for each variable label (the key), the list of related parents labels</p></li>
<li><p><strong>_cims</strong> (<em>Dict</em>) – It contains, for each variable label (the key), the SetOfCims object related to it</p></li>
<li><p><strong>_generated_trajectory</strong> (<em>pandas.DataFrame</em>) – Result of the execution of CTBN_Sample, contains the output trajectory</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.structure_graph.trajectory_generator.TrajectoryGenerator.CTBN_Sample">
<span class="sig-name descname"><span class="pre">CTBN_Sample</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">t_end</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">1</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_tr</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">-</span> <span class="pre">1</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.structure_graph.trajectory_generator.TrajectoryGenerator.CTBN_Sample" title="Permalink to this definition"></a></dt>
<dd><dl class="simple">
<dt>This method implements the generation of a trajectory, basing on the network structure and</dt><dd><p>on the coefficients defined in the CIMs.
The variables are initialized with value 0, and the method takes care of adding the
conventional last row made up of -1.</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>t_end</strong> (<em>float</em>) – If defined, the sampling ends when end time is reached</p></li>
<li><p><strong>max_tr</strong> (<em>int</em>) – Parameter taken in consideration in case that t_end isn’t defined. It specifies the number of transitions to execute</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.structure_graph.trajectory_generator.TrajectoryGenerator.multi_trajectory">
<span class="sig-name descname"><span class="pre">multi_trajectory</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">t_ends</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">list</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_trs</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">list</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.structure_graph.trajectory_generator.TrajectoryGenerator.multi_trajectory" title="Permalink to this definition"></a></dt>
<dd><p>Generate n trajectories in parallel, where n is the number of items in
t_ends, if defined, or the number of items in max_trs otherwise</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>t_ends</strong> (<em>list</em>) – List of t_end values for the trajectories that will be generated</p></li>
<li><p><strong>max_trs</strong> (<em>list</em>) – List of max_tr values for the trajectories that will be generated</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.structure_graph.trajectory_generator.TrajectoryGenerator.worker">
<span class="sig-name descname"><span class="pre">worker</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">t_end</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">max_tr</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">trajectories</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.structure_graph.trajectory_generator.TrajectoryGenerator.worker" title="Permalink to this definition"></a></dt>
<dd><p>Single process that will be executed in parallel in order to generate one trajectory.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>t_end</strong> (<em>float</em>) – If defined, the sampling ends when end time is reached</p></li>
<li><p><strong>max_tr</strong> (<em>int</em>) – Parameter taken in consideration in case that t_end isn’t defined. It specifies the number of transitions to execute</p></li>
<li><p><strong>trajectories</strong> (<em>list</em>) – Shared list that contains to which the generated trajectory is added</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</dd></dl>
</section>
<section id="module-PyCTBN.PyCTBN.structure_graph">
</div>
<div class="section" id="module-PyCTBN.PyCTBN.structure_graph">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.PyCTBN.structure_graph" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -65,7 +65,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -119,58 +119,14 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-pyctbn-utility-package">
<section id="pyctbn-pyctbn-utility-package">
<h1>PyCTBN.PyCTBN.utility package<a class="headerlink" href="#pyctbn-pyctbn-utility-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.utility.abstract_exporter">
<span id="pyctbn-pyctbn-utility-abstract-exporter-module"></span><h2>PyCTBN.PyCTBN.utility.abstract_exporter module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.abstract_exporter" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">PyCTBN.PyCTBN.utility.abstract_exporter.</span></span><span class="sig-name descname"><span class="pre">AbstractExporter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">variables</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">pandas.core.frame.DataFrame</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dyn_str</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">pandas.core.frame.DataFrame</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dyn_cims</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">dict</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">abc.ABC</span></code></p>
<p>Abstract class that exposes the methods to save in json format a network information
along with one or more trajectories generated basing on it</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>_variables</strong> (<em>pandas.DataFrame</em>) – Dataframe containing the nodes labels and cardinalities</p></li>
<li><p><strong>_dyn_str</strong> (<em>pandas.DataFrame</em>) – Dataframe containing the structure of the network (edges)</p></li>
<li><p><strong>_dyn_cims</strong> (<em>dict</em>) – It contains, for every variable (label is the key), the SetOfCims object related to it</p></li>
<li><p><strong>_trajectories</strong> (<em>List</em>) – List of trajectories, that can be added subsequently</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter.add_trajectory">
<span class="sig-name descname"><span class="pre">add_trajectory</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">trajectory</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">list</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter.add_trajectory" title="Permalink to this definition"></a></dt>
<dd><p>Add a new trajectory to the current list</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>trajectory</strong> (<em>pandas.DataFrame</em>) – The trajectory to add</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter.out_file">
<em class="property"><span class="pre">abstract</span> </em><span class="sig-name descname"><span class="pre">out_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter.out_file" title="Permalink to this definition"></a></dt>
<dd><dl class="simple">
<dt>Create a file in current directory and write on it the previously added data </dt><dd><p>(variables, dyn_str, dyn_cims and trajectories)</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>filename</strong> (<em>string</em>) – Name of the output file (it must include json extension)</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</section>
<section id="module-PyCTBN.PyCTBN.utility.abstract_importer">
</div>
<div class="section" id="module-PyCTBN.PyCTBN.utility.abstract_importer">
<span id="pyctbn-pyctbn-utility-abstract-importer-module"></span><h2>PyCTBN.PyCTBN.utility.abstract_importer module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.abstract_importer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter">
@ -331,8 +287,8 @@ dataset</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.utility.cache">
</section>
<section id="module-PyCTBN.PyCTBN.utility.cache">
<span id="pyctbn-pyctbn-utility-cache-module"></span><h2>PyCTBN.PyCTBN.utility.cache module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.cache" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.utility.cache.Cache">
@ -390,48 +346,10 @@ None otherwise.</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.utility.json_exporter">
<span id="pyctbn-pyctbn-utility-json-exporter-module"></span><h2>PyCTBN.PyCTBN.utility.json_exporter module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.json_exporter" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.utility.json_exporter.JsonExporter">
<em class="property"><span class="pre">class</span> </em><span class="sig-prename descclassname"><span class="pre">PyCTBN.PyCTBN.utility.json_exporter.</span></span><span class="sig-name descname"><span class="pre">JsonExporter</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">variables</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">pandas.core.frame.DataFrame</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dyn_str</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">pandas.core.frame.DataFrame</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">dyn_cims</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Optional</span><span class="p"><span class="pre">[</span></span><span class="pre">dict</span><span class="p"><span class="pre">]</span></span></span> <span class="o"><span class="pre">=</span></span> <span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.json_exporter.JsonExporter" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter" title="PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter"><code class="xref py py-class docutils literal notranslate"><span class="pre">PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter</span></code></a></p>
<p>Provides the methods to save in json format a network information
along with one or more trajectories generated basing on it</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>_variables</strong> (<em>pandas.DataFrame</em>) – Dataframe containing the nodes labels and cardinalities</p></li>
<li><p><strong>_dyn_str</strong> (<em>pandas.DataFrame</em>) – Dataframe containing the structure of the network (edges)</p></li>
<li><p><strong>_dyn_cims</strong> (<em>dict</em>) – It contains, for every variable (label is the key), the SetOfCims object related to it</p></li>
<li><p><strong>_trajectories</strong> (<em>List</em>) – List of trajectories, that can be added subsequently</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.utility.json_exporter.JsonExporter.cims_to_json">
<span class="sig-name descname"><span class="pre">cims_to_json</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; <span class="pre">dict</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.json_exporter.JsonExporter.cims_to_json" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.utility.json_exporter.JsonExporter.out_file">
<span class="sig-name descname"><span class="pre">out_file</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">filename</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.json_exporter.JsonExporter.out_file" title="Permalink to this definition"></a></dt>
<dd><dl class="simple">
<dt>Create a file in current directory and write on it the previously added data </dt><dd><p>(variables, dyn_str, dyn_cims and trajectories)</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>filename</strong> (<em>string</em>) – Name of the output file (it must include json extension)</p>
</dd>
</dl>
</dd></dl>
</section>
<section id="module-PyCTBN.PyCTBN.utility.json_importer">
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.utility.json_importer">
<span id="pyctbn-pyctbn-utility-json-importer-module"></span><h2>PyCTBN.PyCTBN.utility.json_importer module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.json_importer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.utility.json_importer.JsonImporter">
@ -480,12 +398,14 @@ dataset</p>
</dd></dl>
<dl class="py method">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.utility.json_importer.JsonImporter.import_data">
<span class="sig-name descname"><span class="pre">import_data</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">indx</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">int</span></span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">None</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.json_importer.JsonImporter.import_data" title="Permalink to this definition"></a></dt>
<dt id="PyCTBN.PyCTBN.utility.json_importer.JsonImporter.import_data">
<code class="sig-name descname">import_data</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">indx</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">0</span></em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#PyCTBN.PyCTBN.utility.json_importer.JsonImporter.import_data" title="Permalink to this definition"></a></dt>
<dd><p>Implements the abstract method of <code class="xref py py-class docutils literal notranslate"><span class="pre">AbstractImporter</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>indx</strong> (<em>int</em>) – the index of the outer JsonArray to extract the data from</p>
<dd class="field-odd"><p><strong>indx</strong> (<em>int</em>) – the index of the outer JsonArray to extract the data from, default to 0</p>
</dd>
</dl>
</dd></dl>
@ -621,8 +541,8 @@ as keys for the set of CIMS of a particular node.</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.utility.sample_importer">
</section>
<section id="module-PyCTBN.PyCTBN.utility.sample_importer">
<span id="pyctbn-pyctbn-utility-sample-importer-module"></span><h2>PyCTBN.PyCTBN.utility.sample_importer module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.sample_importer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.PyCTBN.utility.sample_importer.SampleImporter">
@ -665,11 +585,11 @@ dataset</p>
</dd></dl>
</div>
<div class="section" id="module-PyCTBN.PyCTBN.utility">
</section>
<section id="module-PyCTBN.PyCTBN.utility">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

26
docs/PyCTBN.html vendored

@ -62,7 +62,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -116,9 +116,9 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-package">
<section id="pyctbn-package">
<h1>PyCTBN package<a class="headerlink" href="#pyctbn-package" title="Permalink to this headline"></a></h1>
<div class="section" id="subpackages">
<section id="subpackages">
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline"></a></h2>
<div class="toctree-wrapper compound">
<ul>
@ -218,20 +218,16 @@
</li>
</ul>
</div>
</div>
<div class="section" id="submodules">
</section>
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="pyctbn-basic-main-module">
<h2>PyCTBN.basic_main module<a class="headerlink" href="#pyctbn-basic-main-module" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="pyctbn-setup-module">
<h2>PyCTBN.setup module<a class="headerlink" href="#pyctbn-setup-module" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN">
</section>
<section id="module-PyCTBN">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -62,7 +62,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -116,12 +116,12 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-tests-estimators-package">
<section id="pyctbn-tests-estimators-package">
<h1>PyCTBN.tests.estimators package<a class="headerlink" href="#pyctbn-tests-estimators-package" title="Permalink to this headline"></a></h1>
<div class="section" id="submodules">
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.tests.estimators.test_parameters_estimator">
</section>
<section id="module-PyCTBN.tests.estimators.test_parameters_estimator">
<span id="pyctbn-tests-estimators-test-parameters-estimator-module"></span><h2>PyCTBN.tests.estimators.test_parameters_estimator module<a class="headerlink" href="#module-PyCTBN.tests.estimators.test_parameters_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.tests.estimators.test_parameters_estimator.TestParametersEstimatior">
@ -160,11 +160,40 @@
</dd></dl>
</div>
<div class="section" id="pyctbn-tests-estimators-test-structure-constraint-based-estimator-module">
<h2>PyCTBN.tests.estimators.test_structure_constraint_based_estimator module<a class="headerlink" href="#pyctbn-tests-estimators-test-structure-constraint-based-estimator-module" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.tests.estimators.test_structure_estimator">
</section>
<section id="module-PyCTBN.tests.estimators.test_structure_constraint_based_estimator">
<span id="pyctbn-tests-estimators-test-structure-constraint-based-estimator-module"></span><h2>PyCTBN.tests.estimators.test_structure_constraint_based_estimator module<a class="headerlink" href="#module-PyCTBN.tests.estimators.test_structure_constraint_based_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.estimators.test_structure_constraint_based_estimator.TestStructureConstraintBasedEstimator">
<em class="property">class </em><code class="sig-prename descclassname">PyCTBN.tests.estimators.test_structure_constraint_based_estimator.</code><code class="sig-name descname">TestStructureConstraintBasedEstimator</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.tests.estimators.test_structure_constraint_based_estimator.TestStructureConstraintBasedEstimator" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">unittest.case.TestCase</span></code></p>
<dl class="py method">
<dt id="PyCTBN.tests.estimators.test_structure_constraint_based_estimator.TestStructureConstraintBasedEstimator.setUpClass">
<em class="property">classmethod </em><code class="sig-name descname">setUpClass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.tests.estimators.test_structure_constraint_based_estimator.TestStructureConstraintBasedEstimator.setUpClass" title="Permalink to this definition"></a></dt>
<dd><p>Hook method for setting up class fixture before running tests in the class.</p>
</dd></dl>
<dl class="py method">
<dt id="PyCTBN.tests.estimators.test_structure_constraint_based_estimator.TestStructureConstraintBasedEstimator.test_structure_1">
<code class="sig-name descname">test_structure_1</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.tests.estimators.test_structure_constraint_based_estimator.TestStructureConstraintBasedEstimator.test_structure_1" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="PyCTBN.tests.estimators.test_structure_constraint_based_estimator.TestStructureConstraintBasedEstimator.test_structure_2">
<code class="sig-name descname">test_structure_2</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.tests.estimators.test_structure_constraint_based_estimator.TestStructureConstraintBasedEstimator.test_structure_2" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="PyCTBN.tests.estimators.test_structure_constraint_based_estimator.TestStructureConstraintBasedEstimator.test_structure_3">
<code class="sig-name descname">test_structure_3</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.tests.estimators.test_structure_constraint_based_estimator.TestStructureConstraintBasedEstimator.test_structure_3" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</section>
<section id="module-PyCTBN.tests.estimators.test_structure_estimator">
<span id="pyctbn-tests-estimators-test-structure-estimator-module"></span><h2>PyCTBN.tests.estimators.test_structure_estimator module<a class="headerlink" href="#module-PyCTBN.tests.estimators.test_structure_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt class="sig sig-object py" id="PyCTBN.tests.estimators.test_structure_estimator.TestStructureEstimator">
@ -218,14 +247,47 @@
</dd></dl>
</div>
<div class="section" id="pyctbn-tests-estimators-test-structure-score-based-estimator-module">
<h2>PyCTBN.tests.estimators.test_structure_score_based_estimator module<a class="headerlink" href="#pyctbn-tests-estimators-test-structure-score-based-estimator-module" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-PyCTBN.tests.estimators">
</section>
<section id="module-PyCTBN.tests.estimators.test_structure_score_based_estimator">
<span id="pyctbn-tests-estimators-test-structure-score-based-estimator-module"></span><h2>PyCTBN.tests.estimators.test_structure_score_based_estimator module<a class="headerlink" href="#module-PyCTBN.tests.estimators.test_structure_score_based_estimator" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.tests.estimators.test_structure_score_based_estimator.TestStructureScoreBasedEstimator">
<em class="property">class </em><code class="sig-prename descclassname">PyCTBN.tests.estimators.test_structure_score_based_estimator.</code><code class="sig-name descname">TestStructureScoreBasedEstimator</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">methodName</span><span class="o">=</span><span class="default_value">'runTest'</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.tests.estimators.test_structure_score_based_estimator.TestStructureScoreBasedEstimator" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">unittest.case.TestCase</span></code></p>
<dl class="py method">
<dt id="PyCTBN.tests.estimators.test_structure_score_based_estimator.TestStructureScoreBasedEstimator.setUpClass">
<em class="property">classmethod </em><code class="sig-name descname">setUpClass</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.tests.estimators.test_structure_score_based_estimator.TestStructureScoreBasedEstimator.setUpClass" title="Permalink to this definition"></a></dt>
<dd><p>Hook method for setting up class fixture before running tests in the class.</p>
</dd></dl>
<dl class="py method">
<dt id="PyCTBN.tests.estimators.test_structure_score_based_estimator.TestStructureScoreBasedEstimator.test_structure_1">
<code class="sig-name descname">test_structure_1</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.tests.estimators.test_structure_score_based_estimator.TestStructureScoreBasedEstimator.test_structure_1" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="PyCTBN.tests.estimators.test_structure_score_based_estimator.TestStructureScoreBasedEstimator.test_structure_2">
<code class="sig-name descname">test_structure_2</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.tests.estimators.test_structure_score_based_estimator.TestStructureScoreBasedEstimator.test_structure_2" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="PyCTBN.tests.estimators.test_structure_score_based_estimator.TestStructureScoreBasedEstimator.test_structure_3">
<code class="sig-name descname">test_structure_3</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.tests.estimators.test_structure_score_based_estimator.TestStructureScoreBasedEstimator.test_structure_3" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="PyCTBN.tests.estimators.test_structure_score_based_estimator.TestStructureScoreBasedEstimator.test_structure_monoprocesso">
<code class="sig-name descname">test_structure_monoprocesso</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.tests.estimators.test_structure_score_based_estimator.TestStructureScoreBasedEstimator.test_structure_monoprocesso" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</section>
<section id="module-PyCTBN.tests.estimators">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.tests.estimators" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

@ -62,7 +62,7 @@
<p class="caption"><span class="caption-text">Contents:</span></p>
<p><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
@ -116,9 +116,9 @@
<div role="main" class="">
<div id="content" class="hfeed entry-container hentry">
<div class="section" id="pyctbn-tests-package">
<section id="pyctbn-tests-package">
<h1>PyCTBN.tests package<a class="headerlink" href="#pyctbn-tests-package" title="Permalink to this headline"></a></h1>
<div class="section" id="subpackages">
<section id="subpackages">
<h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline"></a></h2>
<div class="toctree-wrapper compound">
<ul>
@ -161,11 +161,11 @@
</li>
</ul>
</div>
</div>
<div class="section" id="module-PyCTBN.tests">
</section>
<section id="module-PyCTBN.tests">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.tests" title="Permalink to this headline"></a></h2>
</div>
</div>
</section>
</section>
</div>

Some files were not shown because too many files have changed in this diff Show More