parent
1954487500
commit
de1240e7fd
@ -0,0 +1,70 @@ |
||||
import unittest |
||||
import os |
||||
import glob |
||||
import numpy as np |
||||
import pandas as pd |
||||
import timeit |
||||
|
||||
from ..PyCTBN.sample_path import SamplePath |
||||
from ..PyCTBN.structure_estimator import StructureEstimator |
||||
from ..PyCTBN.json_importer import JsonImporter |
||||
from PyCTBN.tests.original_ctpc_algorithm import OriginalCTPCAlgorithm |
||||
|
||||
|
||||
class PerformanceComparisons(unittest.TestCase): |
||||
|
||||
@classmethod |
||||
def setUpClass(cls): |
||||
cls.read_files = glob.glob(os.path.join('./data', "*.json")) |
||||
cls.datasets_numb = None |
||||
cls.s1 = None |
||||
cls.importer = None |
||||
cls.original_algo = None |
||||
cls.original_times = [] |
||||
cls.optimized_times = [] |
||||
cls.results = [] |
||||
|
||||
def test_time_comparisons(self): |
||||
for file_path in self.read_files: |
||||
self.importer = JsonImporter(file_path, 'samples', 'dyn.str', 'variables', 'Time', 'Name') |
||||
self.original_algo = OriginalCTPCAlgorithm(file_path, 'samples', 'dyn.str', 'variables', |
||||
'Time', 'Name', self.importer._raw_data) |
||||
self.datasets_numb = self.original_algo.datasets_numb() |
||||
print("Testing on file: ", file_path, " with ", self.datasets_numb, " Datasets") |
||||
for indx in range(self.datasets_numb): |
||||
print("Running Test: ", indx) |
||||
self.aux_build_importer(indx) |
||||
self.aux_build_original_algo(indx) |
||||
se1 = StructureEstimator(self.s1, 0.1, 0.1) |
||||
opt_time = timeit.timeit(se1.ctpc_algorithm, number=1) |
||||
original_time = timeit.timeit(self.original_algo.cb_structure_algo, number=1) |
||||
opt_res = se1.adjacency_matrix() |
||||
original_res = self.original_algo.matrix |
||||
self.original_times.append(original_time) |
||||
self.optimized_times.append(opt_time) |
||||
self.results.append((original_res, opt_res)) |
||||
self.assertTrue(np.array_equal(original_res, opt_res)) |
||||
self.save_datas(self.original_times, self.optimized_times) |
||||
self.original_times[:] = [] |
||||
self.optimized_times[:] = [] |
||||
|
||||
def aux_build_importer(self, indx): |
||||
self.importer.import_data(indx) |
||||
self.s1 = SamplePath(self.importer) |
||||
self.s1.build_trajectories() |
||||
self.s1.build_structure() |
||||
|
||||
def aux_build_original_algo(self, indx): |
||||
self.original_algo.import_data(indx) |
||||
self.original_algo.prepare_trajectories(self.original_algo.df_samples_list, self.original_algo.variables) |
||||
|
||||
def save_datas(self, original_list, opt_list): |
||||
df_results = pd.DataFrame({'orginal_execution_time': original_list, 'optimized_execution_time': opt_list}) |
||||
name = self.importer.file_path.rsplit('/', 1)[-1] |
||||
name = name.split('.', 1)[0] |
||||
name = 'execution_times_' + name + '.csv' |
||||
df_results.to_csv(name, index=False) |
||||
|
||||
|
||||
if __name__ == '__main__': |
||||
unittest.main() |
@ -0,0 +1,101 @@ |
||||
PyCTBN package |
||||
============== |
||||
|
||||
Submodules |
||||
---------- |
||||
|
||||
PyCTBN.abstract\_importer module |
||||
-------------------------------- |
||||
|
||||
.. automodule:: PyCTBN.abstract_importer |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.cache module |
||||
------------------- |
||||
|
||||
.. automodule:: PyCTBN.cache |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.conditional\_intensity\_matrix module |
||||
-------------------------------------------- |
||||
|
||||
.. automodule:: PyCTBN.conditional_intensity_matrix |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.json\_importer module |
||||
---------------------------- |
||||
|
||||
.. automodule:: PyCTBN.json_importer |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.network\_graph module |
||||
---------------------------- |
||||
|
||||
.. automodule:: PyCTBN.network_graph |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.parameters\_estimator module |
||||
----------------------------------- |
||||
|
||||
.. automodule:: PyCTBN.parameters_estimator |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.sample\_path module |
||||
-------------------------- |
||||
|
||||
.. automodule:: PyCTBN.sample_path |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.set\_of\_cims module |
||||
--------------------------- |
||||
|
||||
.. automodule:: PyCTBN.set_of_cims |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.structure module |
||||
----------------------- |
||||
|
||||
.. automodule:: PyCTBN.structure |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.structure\_estimator module |
||||
---------------------------------- |
||||
|
||||
.. automodule:: PyCTBN.structure_estimator |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.trajectory module |
||||
------------------------ |
||||
|
||||
.. automodule:: PyCTBN.trajectory |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
Module contents |
||||
--------------- |
||||
|
||||
.. automodule:: PyCTBN |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -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: 0c64bed84aa4ce76aedaca18241d82e7 |
||||
config: 5ff9615d2690725079f899e2857b650e |
||||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,101 @@ |
||||
PyCTBN package |
||||
============== |
||||
|
||||
Submodules |
||||
---------- |
||||
|
||||
PyCTBN.abstract\_importer module |
||||
-------------------------------- |
||||
|
||||
.. automodule:: PyCTBN.abstract_importer |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.cache module |
||||
------------------- |
||||
|
||||
.. automodule:: PyCTBN.cache |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.conditional\_intensity\_matrix module |
||||
-------------------------------------------- |
||||
|
||||
.. automodule:: PyCTBN.conditional_intensity_matrix |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.json\_importer module |
||||
---------------------------- |
||||
|
||||
.. automodule:: PyCTBN.json_importer |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.network\_graph module |
||||
---------------------------- |
||||
|
||||
.. automodule:: PyCTBN.network_graph |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.parameters\_estimator module |
||||
----------------------------------- |
||||
|
||||
.. automodule:: PyCTBN.parameters_estimator |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.sample\_path module |
||||
-------------------------- |
||||
|
||||
.. automodule:: PyCTBN.sample_path |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.set\_of\_cims module |
||||
--------------------------- |
||||
|
||||
.. automodule:: PyCTBN.set_of_cims |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.structure module |
||||
----------------------- |
||||
|
||||
.. automodule:: PyCTBN.structure |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.structure\_estimator module |
||||
---------------------------------- |
||||
|
||||
.. automodule:: PyCTBN.structure_estimator |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
PyCTBN.trajectory module |
||||
------------------------ |
||||
|
||||
.. automodule:: PyCTBN.trajectory |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
Module contents |
||||
--------------- |
||||
|
||||
.. automodule:: PyCTBN |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,123 @@ |
||||
Examples |
||||
============= |
||||
|
||||
Installation/Usage: |
||||
******************* |
||||
|
||||
|
||||
Implementing your own data importer |
||||
*********************************** |
||||
.. 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. |
||||
""" |
||||
|
||||
from .abstract_importer import AbstractImporter |
||||
|
||||
class CSVImporter(AbstractImporter): |
||||
|
||||
def __init__(self, file_path): |
||||
self._df_samples_list = None |
||||
super(CSVImporter, self).__init__(file_path) |
||||
|
||||
def import_data(self): |
||||
self.read_csv_file() |
||||
self._sorter = self.build_sorter(self._df_samples_list[0]) |
||||
self.import_variables() |
||||
self.import_structure() |
||||
self.compute_row_delta_in_all_samples_frames(self._df_samples_list) |
||||
|
||||
def read_csv_file(self): |
||||
df = pd.read_csv(self._file_path) |
||||
df.drop(df.columns[[0]], axis=1, inplace=True) |
||||
self._df_samples_list = [df] |
||||
|
||||
def import_variables(self): |
||||
values_list = [3 for var in self._sorter] |
||||
# initialize dict of lists |
||||
data = {'Name':self._sorter, 'Value':values_list} |
||||
# Create the pandas DataFrame |
||||
self._df_variables = pd.DataFrame(data) |
||||
|
||||
def build_sorter(self, sample_frame: pd.DataFrame) -> typing.List: |
||||
return list(sample_frame.columns)[1:] |
||||
|
||||
def import_structure(self): |
||||
data = {'From':['X','Y','Z'], 'To':['Z','Z','Y']} |
||||
self._df_structure = pd.DataFrame(data) |
||||
|
||||
def dataset_id(self) -> object: |
||||
pass |
||||
|
||||
Parameters Estimation Example |
||||
***************************** |
||||
|
||||
.. code-block:: python |
||||
|
||||
from PyCTBN.PyCTBN.json_importer import JsonImporter |
||||
from PyCTBN.PyCTBN.sample_path import SamplePath |
||||
from PyCTBN.PyCTBN.network_graph import NetworkGraph |
||||
from PyCTBN.PyCTBN.parameters_estimator import ParametersEstimator |
||||
|
||||
|
||||
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') |
||||
importer.import_data(0) |
||||
#Create a SamplePath Obj passing an already filled AbstractImporter object |
||||
s1 = SamplePath(importer) |
||||
#Build The trajectries and the structural infos |
||||
s1.build_trajectories() |
||||
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 |
||||
**************************** |
||||
|
||||
.. code-block:: python |
||||
|
||||
from PyCTBN.PyCTBN.json_importer import JsonImporter |
||||
from PyCTBN.PyCTBN.sample_path import SamplePath |
||||
from PyCTBN.PyCTBN.structure_estimator import StructureEstimator |
||||
|
||||
def structure_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 |
||||
importer.import_data(0) |
||||
# construct a SamplePath Object passing a filled AbstractImporter |
||||
s1 = SamplePath(importer) |
||||
# build the trajectories |
||||
s1.build_trajectories() |
||||
# build the real structure |
||||
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 |
||||
print(se1.adjacency_matrix()) |
||||
# save results to a json file |
||||
se1.save_results() |
||||
|
@ -0,0 +1,7 @@ |
||||
PyCTBN |
||||
====== |
||||
|
||||
.. toctree:: |
||||
:maxdepth: 4 |
||||
|
||||
PyCTBN |
@ -1,7 +0,0 @@ |
||||
abstract\_importer module |
||||
========================= |
||||
|
||||
.. automodule:: abstract_importer |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
cache module |
||||
============ |
||||
|
||||
.. automodule:: cache |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
conditional\_intensity\_matrix module |
||||
===================================== |
||||
|
||||
.. automodule:: conditional_intensity_matrix |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
json\_importer module |
||||
===================== |
||||
|
||||
.. automodule:: json_importer |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,17 +0,0 @@ |
||||
scripts |
||||
======= |
||||
|
||||
.. toctree:: |
||||
:maxdepth: 4 |
||||
|
||||
abstract_importer |
||||
cache |
||||
conditional_intensity_matrix |
||||
json_importer |
||||
network_graph |
||||
parameters_estimator |
||||
sample_path |
||||
set_of_cims |
||||
structure |
||||
structure_estimator |
||||
trajectory |
@ -1,7 +0,0 @@ |
||||
network\_graph module |
||||
===================== |
||||
|
||||
.. automodule:: network_graph |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
parameters\_estimator module |
||||
============================ |
||||
|
||||
.. automodule:: parameters_estimator |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
sample\_path module |
||||
=================== |
||||
|
||||
.. automodule:: sample_path |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
set\_of\_cims module |
||||
==================== |
||||
|
||||
.. automodule:: set_of_cims |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
structure module |
||||
================ |
||||
|
||||
.. automodule:: structure |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
structure\_estimator module |
||||
=========================== |
||||
|
||||
.. automodule:: structure_estimator |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
trajectory module |
||||
================= |
||||
|
||||
.. automodule:: trajectory |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,2 +1,7 @@ |
||||
pre { line-height: 125%; } |
||||
td.linenos pre { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } |
||||
span.linenos { color: #000000; background-color: #f0f0f0; padding-left: 5px; padding-right: 5px; } |
||||
td.linenos pre.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } |
||||
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; } |
||||
.highlight .hll { background-color: #ffffcc } |
||||
.highlight { background: #ffffff; } |
||||
.highlight { background: #ffffff; } |
@ -0,0 +1,315 @@ |
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
||||
<html xml:lang="" lang="" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
|
||||
<title>Examples — PyCTBN 1.0 documentation</title> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'/> |
||||
<link rel="stylesheet" href="_static/css/pdj.css" type="text/css" /> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index" |
||||
href="genindex.html"/> |
||||
<link rel="search" title="Search" href="search.html"/> |
||||
<link rel="top" title="PyCTBN 1.0 documentation" href="index.html"/> |
||||
<link rel="prev" title="PyCTBN package" href="PyCTBN.html"/> |
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
<meta http-equiv="cache-control" content="public" /> |
||||
<meta name="robots" content="follow, all" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<!-- Add jQuery library --> |
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="wy-body-for-nav" role="document"> |
||||
|
||||
<div class="wy-grid-for-nav"> |
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
||||
<div class="wy-side-nav-search"> |
||||
<a href="index.html" class="fa fa-home"> PyCTBN </a> |
||||
<div role="search"> |
||||
<form id ="rtd-search-form" class="wy-form" |
||||
action="search.html" method="get"> |
||||
<input type="text" name="q" placeholder="Search docs" /> |
||||
<input type="hidden" name="check_keywords" value="yes" /> |
||||
<input type="hidden" name="area" value="default" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
||||
|
||||
|
||||
|
||||
<p class="caption"><span class="caption-text">Contents:</span></p> |
||||
<ul class="current"> |
||||
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.html">PyCTBN package</a><ul> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#submodules">Submodules</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.abstract_importer">PyCTBN.abstract_importer module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.cache">PyCTBN.cache module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.conditional_intensity_matrix">PyCTBN.conditional_intensity_matrix module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.json_importer">PyCTBN.json_importer module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.network_graph">PyCTBN.network_graph module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.parameters_estimator">PyCTBN.parameters_estimator module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.sample_path">PyCTBN.sample_path module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.set_of_cims">PyCTBN.set_of_cims module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.structure">PyCTBN.structure module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.structure_estimator">PyCTBN.structure_estimator module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.trajectory">PyCTBN.trajectory module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN">Module contents</a></li> |
||||
</ul> |
||||
</li> |
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Examples</a><ul> |
||||
<li class="toctree-l2"><a class="reference internal" href="#installation-usage">Installation/Usage:</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="#implementing-your-own-data-importer">Implementing your own data importer</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="#parameters-estimation-example">Parameters Estimation Example</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="#structure-estimation-example">Structure Estimation Example</a></li> |
||||
</ul> |
||||
</li> |
||||
</ul> |
||||
|
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</nav> |
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
||||
|
||||
<nav class="wy-nav-top" id="barra-mobile" role="navigation" aria-label="top navigation"> |
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
||||
<a href="#">Porão do Juca</a> |
||||
</nav> |
||||
|
||||
<div class="wy-nav-content"> |
||||
<div class="fundo-claro"> |
||||
</div> |
||||
<div class="fundo-escuro"> |
||||
</div> |
||||
|
||||
<div class="rst-content"> |
||||
<div role="navigation" aria-label="breadcrumbs navigation"> |
||||
|
||||
<!-- <ul class="wy-breadcrumbs"> --> |
||||
<!-- <li><a href="#">Docs</a> »</li> --> |
||||
|
||||
<!-- <li>Features</li> --> |
||||
<!-- <li class="wy-breadcrumbs-aside"> --> |
||||
|
||||
<!-- <a href="_sources/index.txt" rel="nofollow"> View page source</a> --> |
||||
|
||||
<!-- </li> --> |
||||
<!-- </ul> --> |
||||
<!-- <hr/> --> |
||||
</div> |
||||
|
||||
<div role="main" class=""> |
||||
|
||||
<div id="content" class="hfeed entry-container hentry"> |
||||
<div class="section" id="examples"> |
||||
<h1>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h1> |
||||
<div class="section" id="installation-usage"> |
||||
<h2>Installation/Usage:<a class="headerlink" href="#installation-usage" title="Permalink to this headline">¶</a></h2> |
||||
</div> |
||||
<div class="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">"""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.</span> |
||||
<span class="sd">"""</span> |
||||
|
||||
<span class="kn">from</span> <span class="nn">.abstract_importer</span> <span class="kn">import</span> <span class="n">AbstractImporter</span> |
||||
|
||||
<span class="k">class</span> <span class="nc">CSVImporter</span><span class="p">(</span><span class="n">AbstractImporter</span><span class="p">):</span> |
||||
|
||||
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">file_path</span><span class="p">):</span> |
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_df_samples_list</span> <span class="o">=</span> <span class="kc">None</span> |
||||
<span class="nb">super</span><span class="p">(</span><span class="n">CSVImporter</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">file_path</span><span class="p">)</span> |
||||
|
||||
<span class="k">def</span> <span class="nf">import_data</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> |
||||
<span class="bp">self</span><span class="o">.</span><span class="n">read_csv_file</span><span class="p">()</span> |
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_sorter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">build_sorter</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_df_samples_list</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span> |
||||
<span class="bp">self</span><span class="o">.</span><span class="n">import_variables</span><span class="p">()</span> |
||||
<span class="bp">self</span><span class="o">.</span><span class="n">import_structure</span><span class="p">()</span> |
||||
<span class="bp">self</span><span class="o">.</span><span class="n">compute_row_delta_in_all_samples_frames</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_df_samples_list</span><span class="p">)</span> |
||||
|
||||
<span class="k">def</span> <span class="nf">read_csv_file</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> |
||||
<span class="n">df</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">read_csv</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_file_path</span><span class="p">)</span> |
||||
<span class="n">df</span><span class="o">.</span><span class="n">drop</span><span class="p">(</span><span class="n">df</span><span class="o">.</span><span class="n">columns</span><span class="p">[[</span><span class="mi">0</span><span class="p">]],</span> <span class="n">axis</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">inplace</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span> |
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_df_samples_list</span> <span class="o">=</span> <span class="p">[</span><span class="n">df</span><span class="p">]</span> |
||||
|
||||
<span class="k">def</span> <span class="nf">import_variables</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> |
||||
<span class="n">values_list</span> <span class="o">=</span> <span class="p">[</span><span class="mi">3</span> <span class="k">for</span> <span class="n">var</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_sorter</span><span class="p">]</span> |
||||
<span class="c1"># initialize dict of lists</span> |
||||
<span class="n">data</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'Name'</span><span class="p">:</span><span class="bp">self</span><span class="o">.</span><span class="n">_sorter</span><span class="p">,</span> <span class="s1">'Value'</span><span class="p">:</span><span class="n">values_list</span><span class="p">}</span> |
||||
<span class="c1"># Create the pandas DataFrame</span> |
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_df_variables</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> |
||||
|
||||
<span class="k">def</span> <span class="nf">build_sorter</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sample_frame</span><span class="p">:</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">)</span> <span class="o">-></span> <span class="n">typing</span><span class="o">.</span><span class="n">List</span><span class="p">:</span> |
||||
<span class="k">return</span> <span class="nb">list</span><span class="p">(</span><span class="n">sample_frame</span><span class="o">.</span><span class="n">columns</span><span class="p">)[</span><span class="mi">1</span><span class="p">:]</span> |
||||
|
||||
<span class="k">def</span> <span class="nf">import_structure</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> |
||||
<span class="n">data</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'From'</span><span class="p">:[</span><span class="s1">'X'</span><span class="p">,</span><span class="s1">'Y'</span><span class="p">,</span><span class="s1">'Z'</span><span class="p">],</span> <span class="s1">'To'</span><span class="p">:[</span><span class="s1">'Z'</span><span class="p">,</span><span class="s1">'Z'</span><span class="p">,</span><span class="s1">'Y'</span><span class="p">]}</span> |
||||
<span class="bp">self</span><span class="o">.</span><span class="n">_df_structure</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> |
||||
|
||||
<span class="k">def</span> <span class="nf">dataset_id</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-></span> <span class="nb">object</span><span class="p">:</span> |
||||
<span class="k">pass</span> |
||||
</pre></div> |
||||
</div> |
||||
</div> |
||||
<div class="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.PyCTBN.json_importer</span> <span class="kn">import</span> <span class="n">JsonImporter</span> |
||||
<span class="kn">from</span> <span class="nn">PyCTBN.PyCTBN.sample_path</span> <span class="kn">import</span> <span class="n">SamplePath</span> |
||||
<span class="kn">from</span> <span class="nn">PyCTBN.PyCTBN.network_graph</span> <span class="kn">import</span> <span class="n">NetworkGraph</span> |
||||
<span class="kn">from</span> <span class="nn">PyCTBN.PyCTBN.parameters_estimator</span> <span class="kn">import</span> <span class="n">ParametersEstimator</span> |
||||
|
||||
|
||||
<span class="k">def</span> <span class="nf">main</span><span class="p">():</span> |
||||
<span class="n">read_files</span> <span class="o">=</span> <span class="n">glob</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s1">'./data'</span><span class="p">,</span> <span class="s2">"*.json"</span><span class="p">))</span> <span class="c1">#Take all json files in this dir</span> |
||||
<span class="c1">#import data</span> |
||||
<span class="n">importer</span> <span class="o">=</span> <span class="n">JsonImporter</span><span class="p">(</span><span class="n">read_files</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s1">'samples'</span><span class="p">,</span> <span class="s1">'dyn.str'</span><span class="p">,</span> <span class="s1">'variables'</span><span class="p">,</span> <span class="s1">'Time'</span><span class="p">,</span> <span class="s1">'Name'</span><span class="p">)</span> |
||||
<span class="n">importer</span><span class="o">.</span><span class="n">import_data</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> |
||||
<span class="c1">#Create a SamplePath Obj passing an already filled AbstractImporter object</span> |
||||
<span class="n">s1</span> <span class="o">=</span> <span class="n">SamplePath</span><span class="p">(</span><span class="n">importer</span><span class="p">)</span> |
||||
<span class="c1">#Build The trajectries and the structural infos</span> |
||||
<span class="n">s1</span><span class="o">.</span><span class="n">build_trajectories</span><span class="p">()</span> |
||||
<span class="n">s1</span><span class="o">.</span><span class="n">build_structure</span><span class="p">()</span> |
||||
<span class="nb">print</span><span class="p">(</span><span class="n">s1</span><span class="o">.</span><span class="n">structure</span><span class="o">.</span><span class="n">edges</span><span class="p">)</span> |
||||
<span class="nb">print</span><span class="p">(</span><span class="n">s1</span><span class="o">.</span><span class="n">structure</span><span class="o">.</span><span class="n">nodes_values</span><span class="p">)</span> |
||||
<span class="c1">#From The Structure Object build the Graph</span> |
||||
<span class="n">g</span> <span class="o">=</span> <span class="n">NetworkGraph</span><span class="p">(</span><span class="n">s1</span><span class="o">.</span><span class="n">structure</span><span class="p">)</span> |
||||
<span class="c1">#Select a node you want to estimate the parameters</span> |
||||
<span class="n">node</span> <span class="o">=</span> <span class="n">g</span><span class="o">.</span><span class="n">nodes</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span> |
||||
<span class="nb">print</span><span class="p">(</span><span class="s2">"Node"</span><span class="p">,</span> <span class="n">node</span><span class="p">)</span> |
||||
<span class="c1">#Init the _graph specifically for THIS node</span> |
||||
<span class="n">g</span><span class="o">.</span><span class="n">fast_init</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> |
||||
<span class="c1">#Use SamplePath and Grpah to create a ParametersEstimator Object</span> |
||||
<span class="n">p1</span> <span class="o">=</span> <span class="n">ParametersEstimator</span><span class="p">(</span><span class="n">s1</span><span class="o">.</span><span class="n">trajectories</span><span class="p">,</span> <span class="n">g</span><span class="p">)</span> |
||||
<span class="c1">#Init the peEst specifically for THIS node</span> |
||||
<span class="n">p1</span><span class="o">.</span><span class="n">fast_init</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> |
||||
<span class="c1">#Compute the parameters</span> |
||||
<span class="n">sofc1</span> <span class="o">=</span> <span class="n">p1</span><span class="o">.</span><span class="n">compute_parameters_for_node</span><span class="p">(</span><span class="n">node</span><span class="p">)</span> |
||||
<span class="c1">#The est CIMS are inside the resultant SetOfCIms Obj</span> |
||||
<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"> |
||||
<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.PyCTBN.json_importer</span> <span class="kn">import</span> <span class="n">JsonImporter</span> |
||||
<span class="kn">from</span> <span class="nn">PyCTBN.PyCTBN.sample_path</span> <span class="kn">import</span> <span class="n">SamplePath</span> |
||||
<span class="kn">from</span> <span class="nn">PyCTBN.PyCTBN.structure_estimator</span> <span class="kn">import</span> <span class="n">StructureEstimator</span> |
||||
|
||||
<span class="k">def</span> <span class="nf">structure_estimation_example</span><span class="p">():</span> |
||||
|
||||
<span class="c1"># read the json files in ./data path</span> |
||||
<span class="n">read_files</span> <span class="o">=</span> <span class="n">glob</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="s1">'./data'</span><span class="p">,</span> <span class="s2">"*.json"</span><span class="p">))</span> |
||||
<span class="c1"># initialize a JsonImporter object for the first file</span> |
||||
<span class="n">importer</span> <span class="o">=</span> <span class="n">JsonImporter</span><span class="p">(</span><span class="n">read_files</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s1">'samples'</span><span class="p">,</span> <span class="s1">'dyn.str'</span><span class="p">,</span> <span class="s1">'variables'</span><span class="p">,</span> <span class="s1">'Time'</span><span class="p">,</span> <span class="s1">'Name'</span><span class="p">)</span> |
||||
<span class="c1"># import the data at index 0 of the outer json array</span> |
||||
<span class="n">importer</span><span class="o">.</span><span class="n">import_data</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span> |
||||
<span class="c1"># construct a SamplePath Object passing a filled AbstractImporter</span> |
||||
<span class="n">s1</span> <span class="o">=</span> <span class="n">SamplePath</span><span class="p">(</span><span class="n">importer</span><span class="p">)</span> |
||||
<span class="c1"># build the trajectories</span> |
||||
<span class="n">s1</span><span class="o">.</span><span class="n">build_trajectories</span><span class="p">()</span> |
||||
<span class="c1"># build the real structure</span> |
||||
<span class="n">s1</span><span class="o">.</span><span class="n">build_structure</span><span class="p">()</span> |
||||
<span class="c1"># construct a StructureEstimator object</span> |
||||
<span class="n">se1</span> <span class="o">=</span> <span class="n">StructureEstimator</span><span class="p">(</span><span class="n">s1</span><span class="p">,</span> <span class="mf">0.1</span><span class="p">,</span> <span class="mf">0.1</span><span class="p">)</span> |
||||
<span class="c1"># call the ctpc algorithm</span> |
||||
<span class="n">se1</span><span class="o">.</span><span class="n">ctpc_algorithm</span><span class="p">()</span> |
||||
<span class="c1"># the adjacency matrix of the estimated structure</span> |
||||
<span class="nb">print</span><span class="p">(</span><span class="n">se1</span><span class="o">.</span><span class="n">adjacency_matrix</span><span class="p">())</span> |
||||
<span class="c1"># save results to a json file</span> |
||||
<span class="n">se1</span><span class="o">.</span><span class="n">save_results</span><span class="p">()</span> |
||||
</pre></div> |
||||
</div> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<footer> |
||||
|
||||
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation"> |
||||
|
||||
|
||||
<a href="PyCTBN.html" class="btn btn-neutral" title="PyCTBN package"><span class="fa fa-arrow-circle-left"></span> Previous</a> |
||||
|
||||
</div> |
||||
|
||||
|
||||
<hr/> |
||||
|
||||
<div role="contentinfo"> |
||||
<p> |
||||
© Copyright 2020, Alessandro Bregoli, Filippo Martini. |
||||
</p> |
||||
</div> |
||||
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <a href="http://poraodojuca.net">Porão do Juca</a>. |
||||
|
||||
</footer> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
var DOCUMENTATION_OPTIONS = { |
||||
URL_ROOT:'./', |
||||
VERSION:'1.0', |
||||
COLLAPSE_INDEX:false, |
||||
FILE_SUFFIX:'.html', |
||||
HAS_SOURCE: true |
||||
}; |
||||
</script> |
||||
<script type="text/javascript" src="_static/jquery.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="_static/underscore.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="_static/doctools.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="_static/language_data.js"> |
||||
|
||||
</script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript" |
||||
src="_static/js/theme.js"></script> |
||||
|
||||
<script type="text/javascript" |
||||
src="_static/js/pdj.js"></script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
jQuery(function () { |
||||
SphinxRtdTheme.StickyNav.enable(); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
</body> |
||||
</html> |
@ -0,0 +1,210 @@ |
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
||||
<html xml:lang="" lang="" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
|
||||
<title>PyCTBN — PyCTBN 1.0 documentation</title> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'/> |
||||
<link rel="stylesheet" href="_static/css/pdj.css" type="text/css" /> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index" |
||||
href="genindex.html"/> |
||||
<link rel="search" title="Search" href="search.html"/> |
||||
<link rel="top" title="PyCTBN 1.0 documentation" href="index.html"/> |
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
<meta http-equiv="cache-control" content="public" /> |
||||
<meta name="robots" content="follow, all" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<!-- Add jQuery library --> |
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="wy-body-for-nav" role="document"> |
||||
|
||||
<div class="wy-grid-for-nav"> |
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
||||
<div class="wy-side-nav-search"> |
||||
<a href="index.html" class="fa fa-home"> PyCTBN </a> |
||||
<div role="search"> |
||||
<form id ="rtd-search-form" class="wy-form" |
||||
action="search.html" method="get"> |
||||
<input type="text" name="q" placeholder="Search docs" /> |
||||
<input type="hidden" name="check_keywords" value="yes" /> |
||||
<input type="hidden" name="area" value="default" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
||||
|
||||
|
||||
|
||||
<p class="caption"><span class="caption-text">Contents:</span></p> |
||||
<ul> |
||||
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.html">PyCTBN package</a><ul> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#submodules">Submodules</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.abstract_importer">PyCTBN.abstract_importer module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.cache">PyCTBN.cache module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.conditional_intensity_matrix">PyCTBN.conditional_intensity_matrix module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.json_importer">PyCTBN.json_importer module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.network_graph">PyCTBN.network_graph module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.parameters_estimator">PyCTBN.parameters_estimator module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.sample_path">PyCTBN.sample_path module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.set_of_cims">PyCTBN.set_of_cims module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.structure">PyCTBN.structure module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.structure_estimator">PyCTBN.structure_estimator module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.trajectory">PyCTBN.trajectory module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN">Module contents</a></li> |
||||
</ul> |
||||
</li> |
||||
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a><ul> |
||||
<li class="toctree-l2"><a class="reference internal" href="examples.html#installation-usage">Installation/Usage:</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="examples.html#implementing-your-own-data-importer">Implementing your own data importer</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="examples.html#parameters-estimation-example">Parameters Estimation Example</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="examples.html#structure-estimation-example">Structure Estimation Example</a></li> |
||||
</ul> |
||||
</li> |
||||
</ul> |
||||
|
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</nav> |
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
||||
|
||||
<nav class="wy-nav-top" id="barra-mobile" role="navigation" aria-label="top navigation"> |
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
||||
<a href="#">Porão do Juca</a> |
||||
</nav> |
||||
|
||||
<div class="wy-nav-content"> |
||||
<div class="fundo-claro"> |
||||
</div> |
||||
<div class="fundo-escuro"> |
||||
</div> |
||||
|
||||
<div class="rst-content"> |
||||
<div role="navigation" aria-label="breadcrumbs navigation"> |
||||
|
||||
<!-- <ul class="wy-breadcrumbs"> --> |
||||
<!-- <li><a href="#">Docs</a> »</li> --> |
||||
|
||||
<!-- <li>Features</li> --> |
||||
<!-- <li class="wy-breadcrumbs-aside"> --> |
||||
|
||||
<!-- <a href="_sources/index.txt" rel="nofollow"> View page source</a> --> |
||||
|
||||
<!-- </li> --> |
||||
<!-- </ul> --> |
||||
<!-- <hr/> --> |
||||
</div> |
||||
|
||||
<div role="main" class=""> |
||||
|
||||
<div id="content" class="hfeed entry-container hentry"> |
||||
<div class="section" id="pyctbn"> |
||||
<h1>PyCTBN<a class="headerlink" href="#pyctbn" title="Permalink to this headline">¶</a></h1> |
||||
<div class="toctree-wrapper compound"> |
||||
<ul> |
||||
<li class="toctree-l1"><a class="reference internal" href="PyCTBN.html">PyCTBN package</a><ul> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#submodules">Submodules</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.abstract_importer">PyCTBN.abstract_importer module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.cache">PyCTBN.cache module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.conditional_intensity_matrix">PyCTBN.conditional_intensity_matrix module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.json_importer">PyCTBN.json_importer module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.network_graph">PyCTBN.network_graph module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.parameters_estimator">PyCTBN.parameters_estimator module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.sample_path">PyCTBN.sample_path module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.set_of_cims">PyCTBN.set_of_cims module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.structure">PyCTBN.structure module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.structure_estimator">PyCTBN.structure_estimator module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN.trajectory">PyCTBN.trajectory module</a></li> |
||||
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.html#module-PyCTBN">Module contents</a></li> |
||||
</ul> |
||||
</li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<footer> |
||||
|
||||
|
||||
<hr/> |
||||
|
||||
<div role="contentinfo"> |
||||
<p> |
||||
© Copyright 2020, Alessandro Bregoli, Filippo Martini. |
||||
</p> |
||||
</div> |
||||
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <a href="http://poraodojuca.net">Porão do Juca</a>. |
||||
|
||||
</footer> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
var DOCUMENTATION_OPTIONS = { |
||||
URL_ROOT:'./', |
||||
VERSION:'1.0', |
||||
COLLAPSE_INDEX:false, |
||||
FILE_SUFFIX:'.html', |
||||
HAS_SOURCE: true |
||||
}; |
||||
</script> |
||||
<script type="text/javascript" src="_static/jquery.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="_static/underscore.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="_static/doctools.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="_static/language_data.js"> |
||||
|
||||
</script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript" |
||||
src="_static/js/theme.js"></script> |
||||
|
||||
<script type="text/javascript" |
||||
src="_static/js/pdj.js"></script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
jQuery(function () { |
||||
SphinxRtdTheme.StickyNav.enable(); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
</body> |
||||
</html> |
Binary file not shown.
@ -1,333 +0,0 @@ |
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
||||
<html xml:lang="" lang="" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
|
||||
<title>abstract_importer module — PyCTBN documentation</title> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'/> |
||||
<link rel="stylesheet" href="../_static/css/pdj.css" type="text/css" /> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index" |
||||
href="../genindex.html"/> |
||||
<link rel="search" title="Search" href="../search.html"/> |
||||
<link rel="top" title="PyCTBN documentation" href="../index.html"/> |
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
<meta http-equiv="cache-control" content="public" /> |
||||
<meta name="robots" content="follow, all" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<!-- Add jQuery library --> |
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="wy-body-for-nav" role="document"> |
||||
|
||||
<div class="wy-grid-for-nav"> |
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
||||
<div class="wy-side-nav-search"> |
||||
<a href="../index.html" class="fa fa-home"> PyCTBN </a> |
||||
<div role="search"> |
||||
<form id ="rtd-search-form" class="wy-form" |
||||
action="../search.html" method="get"> |
||||
<input type="text" name="q" placeholder="Search docs" /> |
||||
<input type="hidden" name="check_keywords" value="yes" /> |
||||
<input type="hidden" name="area" value="default" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
||||
|
||||
|
||||
|
||||
<!-- Local TOC --> |
||||
<div class="local-toc"><ul> |
||||
<li><a class="reference internal" href="#">abstract_importer module</a></li> |
||||
</ul> |
||||
</div> |
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</nav> |
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
||||
|
||||
<nav class="wy-nav-top" id="barra-mobile" role="navigation" aria-label="top navigation"> |
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
||||
<a href="#">Porão do Juca</a> |
||||
</nav> |
||||
|
||||
<div class="wy-nav-content"> |
||||
<div class="fundo-claro"> |
||||
</div> |
||||
<div class="fundo-escuro"> |
||||
</div> |
||||
|
||||
<div class="rst-content"> |
||||
<div role="navigation" aria-label="breadcrumbs navigation"> |
||||
|
||||
<!-- <ul class="wy-breadcrumbs"> --> |
||||
<!-- <li><a href="#">Docs</a> »</li> --> |
||||
|
||||
<!-- <li>Features</li> --> |
||||
<!-- <li class="wy-breadcrumbs-aside"> --> |
||||
|
||||
<!-- <a href="_sources/index.txt" rel="nofollow"> View page source</a> --> |
||||
|
||||
<!-- </li> --> |
||||
<!-- </ul> --> |
||||
<!-- <hr/> --> |
||||
</div> |
||||
|
||||
<div role="main" class=""> |
||||
|
||||
<div id="content" class="hfeed entry-container hentry"> |
||||
<div class="section" id="module-abstract_importer"> |
||||
<span id="abstract-importer-module"></span><h1>abstract_importer module<a class="headerlink" href="#module-abstract_importer" title="Permalink to this headline">¶</a></h1> |
||||
<dl class="py class"> |
||||
<dt id="abstract_importer.AbstractImporter"> |
||||
<em class="property">class </em><code class="sig-prename descclassname">abstract_importer.</code><code class="sig-name descname">AbstractImporter</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><a class="headerlink" href="#abstract_importer.AbstractImporter" 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 all the necessary methods to process the trajectories and the net structure.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>file_path</strong> (<em>str</em>) – the file path</p> |
||||
</dd> |
||||
<dt class="field-even">_concatenated_samples</dt> |
||||
<dd class="field-even"><p>Dataframe containing the concatenation of all the processed trajectories</p> |
||||
</dd> |
||||
<dt class="field-odd">_df_structure</dt> |
||||
<dd class="field-odd"><p>Dataframe containing the structure of the network (edges)</p> |
||||
</dd> |
||||
<dt class="field-even">_df_variables</dt> |
||||
<dd class="field-even"><p>Dataframe containing the nodes cardinalities</p> |
||||
</dd> |
||||
<dt class="field-odd">_sorter</dt> |
||||
<dd class="field-odd"><p>A list containing the columns header (excluding the time column) of the <cite>_concatenated_samples</cite></p> |
||||
</dd> |
||||
</dl> |
||||
<dl class="py method"> |
||||
<dt id="abstract_importer.AbstractImporter.build_list_of_samples_array"> |
||||
<code class="sig-name descname">build_list_of_samples_array</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">data_frame</span><span class="p">:</span> <span class="n">pandas.core.frame.DataFrame</span></em><span class="sig-paren">)</span> → List<a class="headerlink" href="#abstract_importer.AbstractImporter.build_list_of_samples_array" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Builds a List containing the columns of data_frame and converts them to a numpy array.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>data_frame</strong> (<em>pandas.Dataframe</em>) – the dataframe from which the columns have to be extracted and converted</p> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>the resulting list of numpy arrays</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>List</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="abstract_importer.AbstractImporter.build_sorter"> |
||||
<em class="property">abstract </em><code class="sig-name descname">build_sorter</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">sample_frame</span><span class="p">:</span> <span class="n">pandas.core.frame.DataFrame</span></em><span class="sig-paren">)</span> → List<a class="headerlink" href="#abstract_importer.AbstractImporter.build_sorter" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Initializes the <code class="docutils literal notranslate"><span class="pre">_sorter</span></code> class member from a trajectory dataframe, exctracting the header of the frame |
||||
and keeping ONLY the variables symbolic labels, cutting out the time label in the header.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>sample_frame</strong> (<em>pandas.DataFrame</em>) – The dataframe from which extract the header</p> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>A list containing the processed header.</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>List</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="abstract_importer.AbstractImporter.clear_concatenated_frame"> |
||||
<code class="sig-name descname">clear_concatenated_frame</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → None<a class="headerlink" href="#abstract_importer.AbstractImporter.clear_concatenated_frame" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Removes all values in the dataframe concatenated_samples.</p> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="abstract_importer.AbstractImporter.compute_row_delta_in_all_samples_frames"> |
||||
<code class="sig-name descname">compute_row_delta_in_all_samples_frames</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">df_samples_list</span><span class="p">:</span> <span class="n">List</span></em><span class="sig-paren">)</span> → None<a class="headerlink" href="#abstract_importer.AbstractImporter.compute_row_delta_in_all_samples_frames" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Calls the method <code class="docutils literal notranslate"><span class="pre">compute_row_delta_sigle_samples_frame</span></code> on every dataframe present in the list |
||||
<code class="docutils literal notranslate"><span class="pre">df_samples_list</span></code>. |
||||
Concatenates the result in the dataframe <code class="docutils literal notranslate"><span class="pre">concatanated_samples</span></code></p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>df_samples_list</strong> (<em>List</em>) – the datframe’s list to be processed and concatenated</p> |
||||
</dd> |
||||
</dl> |
||||
<div class="admonition warning"> |
||||
<p class="admonition-title">Warning</p> |
||||
<p>The Dataframe sample_frame has to follow the column structure of this header: |
||||
Header of sample_frame = [Time | Variable values] |
||||
The class member self._sorter HAS to be properly INITIALIZED (See class members definition doc)</p> |
||||
</div> |
||||
<div class="admonition note"> |
||||
<p class="admonition-title">Note</p> |
||||
<p>After the call of this method the class member <code class="docutils literal notranslate"><span class="pre">concatanated_samples</span></code> will contain all processed |
||||
and merged trajectories</p> |
||||
</div> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="abstract_importer.AbstractImporter.compute_row_delta_sigle_samples_frame"> |
||||
<code class="sig-name descname">compute_row_delta_sigle_samples_frame</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">sample_frame</span><span class="p">:</span> <span class="n">pandas.core.frame.DataFrame</span></em>, <em class="sig-param"><span class="n">columns_header</span><span class="p">:</span> <span class="n">List</span></em>, <em class="sig-param"><span class="n">shifted_cols_header</span><span class="p">:</span> <span class="n">List</span></em><span class="sig-paren">)</span> → pandas.core.frame.DataFrame<a class="headerlink" href="#abstract_importer.AbstractImporter.compute_row_delta_sigle_samples_frame" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Computes the difference between each value present in th time column. |
||||
Copies and shift by one position up all the values present in the remaining columns.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>sample_frame</strong> (<em>pandas.Dataframe</em>) – the traj to be processed</p></li> |
||||
<li><p><strong>columns_header</strong> (<em>List</em>) – the original header of sample_frame</p></li> |
||||
<li><p><strong>shifted_cols_header</strong> (<em>List</em>) – a copy of columns_header with changed names of the contents</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>The processed dataframe</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>pandas.Dataframe</p> |
||||
</dd> |
||||
</dl> |
||||
<div class="admonition warning"> |
||||
<p class="admonition-title">Warning</p> |
||||
<p>the Dataframe <code class="docutils literal notranslate"><span class="pre">sample_frame</span></code> has to follow the column structure of this header: |
||||
Header of sample_frame = [Time | Variable values]</p> |
||||
</div> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="abstract_importer.AbstractImporter.concatenated_samples"> |
||||
<em class="property">property </em><code class="sig-name descname">concatenated_samples</code><a class="headerlink" href="#abstract_importer.AbstractImporter.concatenated_samples" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="abstract_importer.AbstractImporter.dataset_id"> |
||||
<em class="property">abstract </em><code class="sig-name descname">dataset_id</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → object<a class="headerlink" href="#abstract_importer.AbstractImporter.dataset_id" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>If the original dataset contains multiple dataset, this method returns a unique id to identify the current |
||||
dataset</p> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="abstract_importer.AbstractImporter.file_path"> |
||||
<em class="property">property </em><code class="sig-name descname">file_path</code><a class="headerlink" href="#abstract_importer.AbstractImporter.file_path" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="abstract_importer.AbstractImporter.import_data"> |
||||
<em class="property">abstract </em><code class="sig-name descname">import_data</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → None<a class="headerlink" href="#abstract_importer.AbstractImporter.import_data" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Imports all the trajectories, variables cardinalities, and net edges.</p> |
||||
<div class="admonition warning"> |
||||
<p class="admonition-title">Warning</p> |
||||
<p>The class members <code class="docutils literal notranslate"><span class="pre">_df_variables</span></code> and <code class="docutils literal notranslate"><span class="pre">_df_structure</span></code> HAVE to be properly constructed |
||||
as Pandas Dataframes with the following structure: |
||||
Header of _df_structure = [From_Node | To_Node] |
||||
Header of _df_variables = [Variable_Label | Variable_Cardinality]</p> |
||||
</div> |
||||
<div class="admonition note"> |
||||
<p class="admonition-title">Note</p> |
||||
<p>See :class:<code class="docutils literal notranslate"><span class="pre">JsonImporter</span></code> for an example of implementation of this method.</p> |
||||
</div> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="abstract_importer.AbstractImporter.sorter"> |
||||
<em class="property">property </em><code class="sig-name descname">sorter</code><a class="headerlink" href="#abstract_importer.AbstractImporter.sorter" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="abstract_importer.AbstractImporter.structure"> |
||||
<em class="property">property </em><code class="sig-name descname">structure</code><a class="headerlink" href="#abstract_importer.AbstractImporter.structure" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="abstract_importer.AbstractImporter.variables"> |
||||
<em class="property">property </em><code class="sig-name descname">variables</code><a class="headerlink" href="#abstract_importer.AbstractImporter.variables" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
</dd></dl> |
||||
|
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<footer> |
||||
|
||||
|
||||
<hr/> |
||||
|
||||
<div role="contentinfo"> |
||||
<p> |
||||
© Copyright 2020, Filippo Martini. |
||||
</p> |
||||
</div> |
||||
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <a href="http://poraodojuca.net">Porão do Juca</a>. |
||||
|
||||
</footer> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
var DOCUMENTATION_OPTIONS = { |
||||
URL_ROOT:'../', |
||||
VERSION:'', |
||||
COLLAPSE_INDEX:false, |
||||
FILE_SUFFIX:'.html', |
||||
HAS_SOURCE: true |
||||
}; |
||||
</script> |
||||
<script type="text/javascript" src="../_static/jquery.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/underscore.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/doctools.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/language_data.js"> |
||||
|
||||
</script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/theme.js"></script> |
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/pdj.js"></script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
jQuery(function () { |
||||
SphinxRtdTheme.StickyNav.enable(); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
</body> |
||||
</html> |
@ -1,224 +0,0 @@ |
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
||||
<html xml:lang="" lang="" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
|
||||
<title>cache module — PyCTBN documentation</title> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'/> |
||||
<link rel="stylesheet" href="../_static/css/pdj.css" type="text/css" /> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index" |
||||
href="../genindex.html"/> |
||||
<link rel="search" title="Search" href="../search.html"/> |
||||
<link rel="top" title="PyCTBN documentation" href="../index.html"/> |
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
<meta http-equiv="cache-control" content="public" /> |
||||
<meta name="robots" content="follow, all" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<!-- Add jQuery library --> |
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="wy-body-for-nav" role="document"> |
||||
|
||||
<div class="wy-grid-for-nav"> |
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
||||
<div class="wy-side-nav-search"> |
||||
<a href="../index.html" class="fa fa-home"> PyCTBN </a> |
||||
<div role="search"> |
||||
<form id ="rtd-search-form" class="wy-form" |
||||
action="../search.html" method="get"> |
||||
<input type="text" name="q" placeholder="Search docs" /> |
||||
<input type="hidden" name="check_keywords" value="yes" /> |
||||
<input type="hidden" name="area" value="default" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
||||
|
||||
|
||||
|
||||
<!-- Local TOC --> |
||||
<div class="local-toc"><ul> |
||||
<li><a class="reference internal" href="#">cache module</a></li> |
||||
</ul> |
||||
</div> |
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</nav> |
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
||||
|
||||
<nav class="wy-nav-top" id="barra-mobile" role="navigation" aria-label="top navigation"> |
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
||||
<a href="#">Porão do Juca</a> |
||||
</nav> |
||||
|
||||
<div class="wy-nav-content"> |
||||
<div class="fundo-claro"> |
||||
</div> |
||||
<div class="fundo-escuro"> |
||||
</div> |
||||
|
||||
<div class="rst-content"> |
||||
<div role="navigation" aria-label="breadcrumbs navigation"> |
||||
|
||||
<!-- <ul class="wy-breadcrumbs"> --> |
||||
<!-- <li><a href="#">Docs</a> »</li> --> |
||||
|
||||
<!-- <li>Features</li> --> |
||||
<!-- <li class="wy-breadcrumbs-aside"> --> |
||||
|
||||
<!-- <a href="_sources/index.txt" rel="nofollow"> View page source</a> --> |
||||
|
||||
<!-- </li> --> |
||||
<!-- </ul> --> |
||||
<!-- <hr/> --> |
||||
</div> |
||||
|
||||
<div role="main" class=""> |
||||
|
||||
<div id="content" class="hfeed entry-container hentry"> |
||||
<div class="section" id="module-cache"> |
||||
<span id="cache-module"></span><h1>cache module<a class="headerlink" href="#module-cache" title="Permalink to this headline">¶</a></h1> |
||||
<dl class="py class"> |
||||
<dt id="cache.Cache"> |
||||
<em class="property">class </em><code class="sig-prename descclassname">cache.</code><code class="sig-name descname">Cache</code><a class="headerlink" href="#cache.Cache" 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>This class acts as a cache of <code class="docutils literal notranslate"><span class="pre">SetOfCims</span></code> objects for a node.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">_list_of_sets_of_parents</dt> |
||||
<dd class="field-odd"><p>a list of <code class="docutils literal notranslate"><span class="pre">Sets</span></code> objects of the parents to which the cim in cache at SAME |
||||
index is related</p> |
||||
</dd> |
||||
<dt class="field-even">_actual_cache</dt> |
||||
<dd class="field-even"><p>a list of setOfCims objects</p> |
||||
</dd> |
||||
</dl> |
||||
<dl class="py method"> |
||||
<dt id="cache.Cache.clear"> |
||||
<code class="sig-name descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → None<a class="headerlink" href="#cache.Cache.clear" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Clear the contents both of <code class="docutils literal notranslate"><span class="pre">_actual_cache</span></code> and <code class="docutils literal notranslate"><span class="pre">_list_of_sets_of_parents</span></code>.</p> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="cache.Cache.find"> |
||||
<code class="sig-name descname">find</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">parents_comb</span><span class="p">:</span> <span class="n">Set</span></em><span class="sig-paren">)</span> → <a class="reference internal" href="set_of_cims.html#set_of_cims.SetOfCims" title="set_of_cims.SetOfCims">set_of_cims.SetOfCims</a><a class="headerlink" href="#cache.Cache.find" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Tries to find in cache given the symbolic parents combination <code class="docutils literal notranslate"><span class="pre">parents_comb</span></code> the <code class="docutils literal notranslate"><span class="pre">SetOfCims</span></code> |
||||
related to that <code class="docutils literal notranslate"><span class="pre">parents_comb</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>parents_comb</strong> (<em>Set</em>) – the parents related to that <code class="docutils literal notranslate"><span class="pre">SetOfCims</span></code></p> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>A <code class="docutils literal notranslate"><span class="pre">SetOfCims</span></code> object if the <code class="docutils literal notranslate"><span class="pre">parents_comb</span></code> index is found in <code class="docutils literal notranslate"><span class="pre">_list_of_sets_of_parents</span></code>. |
||||
None otherwise.</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p><a class="reference internal" href="set_of_cims.html#set_of_cims.SetOfCims" title="set_of_cims.SetOfCims">SetOfCims</a></p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="cache.Cache.put"> |
||||
<code class="sig-name descname">put</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">parents_comb</span><span class="p">:</span> <span class="n">Set</span></em>, <em class="sig-param"><span class="n">socim</span><span class="p">:</span> <span class="n"><a class="reference internal" href="set_of_cims.html#set_of_cims.SetOfCims" title="set_of_cims.SetOfCims">set_of_cims.SetOfCims</a></span></em><span class="sig-paren">)</span> → None<a class="headerlink" href="#cache.Cache.put" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Place in cache the <code class="docutils literal notranslate"><span class="pre">SetOfCims</span></code> object, and the related symbolic index <code class="docutils literal notranslate"><span class="pre">parents_comb</span></code> in |
||||
<code class="docutils literal notranslate"><span class="pre">_list_of_sets_of_parents</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>parents_comb</strong> (<em>Set</em>) – the symbolic set index</p></li> |
||||
<li><p><strong>socim</strong> (<a class="reference internal" href="set_of_cims.html#set_of_cims.SetOfCims" title="set_of_cims.SetOfCims"><em>SetOfCims</em></a>) – the related SetOfCims object</p></li> |
||||
</ul> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
</dd></dl> |
||||
|
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<footer> |
||||
|
||||
|
||||
<hr/> |
||||
|
||||
<div role="contentinfo"> |
||||
<p> |
||||
© Copyright 2020, Filippo Martini. |
||||
</p> |
||||
</div> |
||||
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <a href="http://poraodojuca.net">Porão do Juca</a>. |
||||
|
||||
</footer> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
var DOCUMENTATION_OPTIONS = { |
||||
URL_ROOT:'../', |
||||
VERSION:'', |
||||
COLLAPSE_INDEX:false, |
||||
FILE_SUFFIX:'.html', |
||||
HAS_SOURCE: true |
||||
}; |
||||
</script> |
||||
<script type="text/javascript" src="../_static/jquery.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/underscore.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/doctools.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/language_data.js"> |
||||
|
||||
</script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/theme.js"></script> |
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/pdj.js"></script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
jQuery(function () { |
||||
SphinxRtdTheme.StickyNav.enable(); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
</body> |
||||
</html> |
@ -1,209 +0,0 @@ |
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
||||
<html xml:lang="" lang="" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
|
||||
<title>conditional_intensity_matrix module — PyCTBN documentation</title> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'/> |
||||
<link rel="stylesheet" href="../_static/css/pdj.css" type="text/css" /> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index" |
||||
href="../genindex.html"/> |
||||
<link rel="search" title="Search" href="../search.html"/> |
||||
<link rel="top" title="PyCTBN documentation" href="../index.html"/> |
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
<meta http-equiv="cache-control" content="public" /> |
||||
<meta name="robots" content="follow, all" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<!-- Add jQuery library --> |
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="wy-body-for-nav" role="document"> |
||||
|
||||
<div class="wy-grid-for-nav"> |
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
||||
<div class="wy-side-nav-search"> |
||||
<a href="../index.html" class="fa fa-home"> PyCTBN </a> |
||||
<div role="search"> |
||||
<form id ="rtd-search-form" class="wy-form" |
||||
action="../search.html" method="get"> |
||||
<input type="text" name="q" placeholder="Search docs" /> |
||||
<input type="hidden" name="check_keywords" value="yes" /> |
||||
<input type="hidden" name="area" value="default" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
||||
|
||||
|
||||
|
||||
<!-- Local TOC --> |
||||
<div class="local-toc"><ul> |
||||
<li><a class="reference internal" href="#">conditional_intensity_matrix module</a></li> |
||||
</ul> |
||||
</div> |
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</nav> |
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
||||
|
||||
<nav class="wy-nav-top" id="barra-mobile" role="navigation" aria-label="top navigation"> |
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
||||
<a href="#">Porão do Juca</a> |
||||
</nav> |
||||
|
||||
<div class="wy-nav-content"> |
||||
<div class="fundo-claro"> |
||||
</div> |
||||
<div class="fundo-escuro"> |
||||
</div> |
||||
|
||||
<div class="rst-content"> |
||||
<div role="navigation" aria-label="breadcrumbs navigation"> |
||||
|
||||
<!-- <ul class="wy-breadcrumbs"> --> |
||||
<!-- <li><a href="#">Docs</a> »</li> --> |
||||
|
||||
<!-- <li>Features</li> --> |
||||
<!-- <li class="wy-breadcrumbs-aside"> --> |
||||
|
||||
<!-- <a href="_sources/index.txt" rel="nofollow"> View page source</a> --> |
||||
|
||||
<!-- </li> --> |
||||
<!-- </ul> --> |
||||
<!-- <hr/> --> |
||||
</div> |
||||
|
||||
<div role="main" class=""> |
||||
|
||||
<div id="content" class="hfeed entry-container hentry"> |
||||
<div class="section" id="module-conditional_intensity_matrix"> |
||||
<span id="conditional-intensity-matrix-module"></span><h1>conditional_intensity_matrix module<a class="headerlink" href="#module-conditional_intensity_matrix" title="Permalink to this headline">¶</a></h1> |
||||
<dl class="py class"> |
||||
<dt id="conditional_intensity_matrix.ConditionalIntensityMatrix"> |
||||
<em class="property">class </em><code class="sig-prename descclassname">conditional_intensity_matrix.</code><code class="sig-name descname">ConditionalIntensityMatrix</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">state_residence_times</span><span class="p">:</span> <span class="n">numpy.array</span></em>, <em class="sig-param"><span class="n">state_transition_matrix</span><span class="p">:</span> <span class="n">numpy.array</span></em><span class="sig-paren">)</span><a class="headerlink" href="#conditional_intensity_matrix.ConditionalIntensityMatrix" 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>Abstracts the Conditional Intesity matrix of a node as aggregation of the state residence times vector |
||||
and state transition matrix and the actual CIM matrix.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>state_residence_times</strong> (<em>numpy.array</em>) – state residence times vector</p></li> |
||||
<li><p><strong>state_transition_matrix</strong> (<em>numpy.ndArray</em>) – the transitions count matrix</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">_cim</dt> |
||||
<dd class="field-even"><p>the actual cim of the node</p> |
||||
</dd> |
||||
</dl> |
||||
<dl class="py method"> |
||||
<dt id="conditional_intensity_matrix.ConditionalIntensityMatrix.cim"> |
||||
<em class="property">property </em><code class="sig-name descname">cim</code><a class="headerlink" href="#conditional_intensity_matrix.ConditionalIntensityMatrix.cim" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="conditional_intensity_matrix.ConditionalIntensityMatrix.compute_cim_coefficients"> |
||||
<code class="sig-name descname">compute_cim_coefficients</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → None<a class="headerlink" href="#conditional_intensity_matrix.ConditionalIntensityMatrix.compute_cim_coefficients" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Compute the coefficients of the matrix _cim by using the following equality q_xx’ = M[x, x’] / T[x]. |
||||
The class member <code class="docutils literal notranslate"><span class="pre">_cim</span></code> will contain the computed cim</p> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="conditional_intensity_matrix.ConditionalIntensityMatrix.state_residence_times"> |
||||
<em class="property">property </em><code class="sig-name descname">state_residence_times</code><a class="headerlink" href="#conditional_intensity_matrix.ConditionalIntensityMatrix.state_residence_times" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="conditional_intensity_matrix.ConditionalIntensityMatrix.state_transition_matrix"> |
||||
<em class="property">property </em><code class="sig-name descname">state_transition_matrix</code><a class="headerlink" href="#conditional_intensity_matrix.ConditionalIntensityMatrix.state_transition_matrix" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
</dd></dl> |
||||
|
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<footer> |
||||
|
||||
|
||||
<hr/> |
||||
|
||||
<div role="contentinfo"> |
||||
<p> |
||||
© Copyright 2020, Filippo Martini. |
||||
</p> |
||||
</div> |
||||
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <a href="http://poraodojuca.net">Porão do Juca</a>. |
||||
|
||||
</footer> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
var DOCUMENTATION_OPTIONS = { |
||||
URL_ROOT:'../', |
||||
VERSION:'', |
||||
COLLAPSE_INDEX:false, |
||||
FILE_SUFFIX:'.html', |
||||
HAS_SOURCE: true |
||||
}; |
||||
</script> |
||||
<script type="text/javascript" src="../_static/jquery.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/underscore.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/doctools.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/language_data.js"> |
||||
|
||||
</script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/theme.js"></script> |
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/pdj.js"></script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
jQuery(function () { |
||||
SphinxRtdTheme.StickyNav.enable(); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
</body> |
||||
</html> |
@ -1,353 +0,0 @@ |
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
||||
<html xml:lang="" lang="" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
|
||||
<title>json_importer module — PyCTBN documentation</title> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'/> |
||||
<link rel="stylesheet" href="../_static/css/pdj.css" type="text/css" /> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index" |
||||
href="../genindex.html"/> |
||||
<link rel="search" title="Search" href="../search.html"/> |
||||
<link rel="top" title="PyCTBN documentation" href="../index.html"/> |
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
<meta http-equiv="cache-control" content="public" /> |
||||
<meta name="robots" content="follow, all" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<!-- Add jQuery library --> |
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="wy-body-for-nav" role="document"> |
||||
|
||||
<div class="wy-grid-for-nav"> |
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
||||
<div class="wy-side-nav-search"> |
||||
<a href="../index.html" class="fa fa-home"> PyCTBN </a> |
||||
<div role="search"> |
||||
<form id ="rtd-search-form" class="wy-form" |
||||
action="../search.html" method="get"> |
||||
<input type="text" name="q" placeholder="Search docs" /> |
||||
<input type="hidden" name="check_keywords" value="yes" /> |
||||
<input type="hidden" name="area" value="default" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
||||
|
||||
|
||||
|
||||
<!-- Local TOC --> |
||||
<div class="local-toc"><ul> |
||||
<li><a class="reference internal" href="#">json_importer module</a></li> |
||||
</ul> |
||||
</div> |
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</nav> |
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
||||
|
||||
<nav class="wy-nav-top" id="barra-mobile" role="navigation" aria-label="top navigation"> |
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
||||
<a href="#">Porão do Juca</a> |
||||
</nav> |
||||
|
||||
<div class="wy-nav-content"> |
||||
<div class="fundo-claro"> |
||||
</div> |
||||
<div class="fundo-escuro"> |
||||
</div> |
||||
|
||||
<div class="rst-content"> |
||||
<div role="navigation" aria-label="breadcrumbs navigation"> |
||||
|
||||
<!-- <ul class="wy-breadcrumbs"> --> |
||||
<!-- <li><a href="#">Docs</a> »</li> --> |
||||
|
||||
<!-- <li>Features</li> --> |
||||
<!-- <li class="wy-breadcrumbs-aside"> --> |
||||
|
||||
<!-- <a href="_sources/index.txt" rel="nofollow"> View page source</a> --> |
||||
|
||||
<!-- </li> --> |
||||
<!-- </ul> --> |
||||
<!-- <hr/> --> |
||||
</div> |
||||
|
||||
<div role="main" class=""> |
||||
|
||||
<div id="content" class="hfeed entry-container hentry"> |
||||
<div class="section" id="module-json_importer"> |
||||
<span id="json-importer-module"></span><h1>json_importer module<a class="headerlink" href="#module-json_importer" title="Permalink to this headline">¶</a></h1> |
||||
<dl class="py class"> |
||||
<dt id="json_importer.JsonImporter"> |
||||
<em class="property">class </em><code class="sig-prename descclassname">json_importer.</code><code class="sig-name descname">JsonImporter</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>, <em class="sig-param"><span class="n">samples_label</span><span class="p">:</span> <span class="n">str</span></em>, <em class="sig-param"><span class="n">structure_label</span><span class="p">:</span> <span class="n">str</span></em>, <em class="sig-param"><span class="n">variables_label</span><span class="p">:</span> <span class="n">str</span></em>, <em class="sig-param"><span class="n">time_key</span><span class="p">:</span> <span class="n">str</span></em>, <em class="sig-param"><span class="n">variables_key</span><span class="p">:</span> <span class="n">str</span></em>, <em class="sig-param"><span class="n">array_indx</span><span class="p">:</span> <span class="n">int</span></em><span class="sig-paren">)</span><a class="headerlink" href="#json_importer.JsonImporter" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Bases: <a class="reference internal" href="abstract_importer.html#abstract_importer.AbstractImporter" title="abstract_importer.AbstractImporter"><code class="xref py py-class docutils literal notranslate"><span class="pre">abstract_importer.AbstractImporter</span></code></a></p> |
||||
<p>Implements the abstracts methods of AbstractImporter and adds all the necessary methods to process and prepare the data in json ext. |
||||
with the following structure: |
||||
[0]</p> |
||||
<blockquote> |
||||
<div><p><a href="#id1"><span class="problematic" id="id2">|</span></a>_ dyn.cims |
||||
<a href="#id3"><span class="problematic" id="id4">|</span></a>_ dyn.str |
||||
<a href="#id5"><span class="problematic" id="id6">|</span></a>_ samples |
||||
<a href="#id7"><span class="problematic" id="id8">|</span></a>_ variabels</p> |
||||
</div></blockquote> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>file_path</strong> (<em>string</em>) – the path of the file that contains tha data to be imported</p></li> |
||||
<li><p><strong>samples_label</strong> (<em>string</em>) – the reference key for the samples in the trajectories</p></li> |
||||
<li><p><strong>structure_label</strong> (<em>string</em>) – the reference key for the structure of the network data</p></li> |
||||
<li><p><strong>variables_label</strong> (<em>string</em>) – the reference key for the cardinalites of the nodes data</p></li> |
||||
<li><p><strong>time_key</strong> (<em>string</em>) – the key used to identify the timestamps in each trajectory</p></li> |
||||
<li><p><strong>variables_key</strong> (<em>string</em>) – the key used to identify the names of the variables in the net</p></li> |
||||
<li><p><strong>array_indx</strong> (<em>int</em>) – the index of the outer JsonArray to exctract the data from</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">_df_samples_list</dt> |
||||
<dd class="field-even"><p>a Dataframe list in which every dataframe contains a trajectory</p> |
||||
</dd> |
||||
</dl> |
||||
<dl class="py method"> |
||||
<dt id="json_importer.JsonImporter.build_sorter"> |
||||
<code class="sig-name descname">build_sorter</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">sample_frame</span><span class="p">:</span> <span class="n">pandas.core.frame.DataFrame</span></em><span class="sig-paren">)</span> → List<a class="headerlink" href="#json_importer.JsonImporter.build_sorter" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Implements the abstract method build_sorter of the <code class="xref py py-class docutils literal notranslate"><span class="pre">AbstractImporter</span></code> for this dataset</p> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="json_importer.JsonImporter.clear_data_frame_list"> |
||||
<code class="sig-name descname">clear_data_frame_list</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → None<a class="headerlink" href="#json_importer.JsonImporter.clear_data_frame_list" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Removes all values present in the dataframes in the list <code class="docutils literal notranslate"><span class="pre">_df_samples_list</span></code>.</p> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="json_importer.JsonImporter.dataset_id"> |
||||
<code class="sig-name descname">dataset_id</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → object<a class="headerlink" href="#json_importer.JsonImporter.dataset_id" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>If the original dataset contains multiple dataset, this method returns a unique id to identify the current |
||||
dataset</p> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="json_importer.JsonImporter.import_data"> |
||||
<code class="sig-name descname">import_data</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → None<a class="headerlink" href="#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> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="json_importer.JsonImporter.import_sampled_cims"> |
||||
<code class="sig-name descname">import_sampled_cims</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">raw_data</span><span class="p">:</span> <span class="n">List</span></em>, <em class="sig-param"><span class="n">indx</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">cims_key</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> → Dict<a class="headerlink" href="#json_importer.JsonImporter.import_sampled_cims" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Imports the synthetic CIMS in the dataset in a dictionary, using variables labels |
||||
as keys for the set of CIMS of a particular node.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>raw_data</strong> (<em>List</em>) – List of Dicts</p></li> |
||||
<li><p><strong>indx</strong> (<em>int</em>) – The index of the array from which the data have to be extracted</p></li> |
||||
<li><p><strong>cims_key</strong> (<em>string</em>) – the key where the json object cims are placed</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>a dictionary containing the sampled CIMS for all the variables in the net</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>Dictionary</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="json_importer.JsonImporter.import_structure"> |
||||
<code class="sig-name descname">import_structure</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">raw_data</span><span class="p">:</span> <span class="n">List</span></em><span class="sig-paren">)</span> → pandas.core.frame.DataFrame<a class="headerlink" href="#json_importer.JsonImporter.import_structure" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Imports in a dataframe the data in the list raw_data at the key <code class="docutils literal notranslate"><span class="pre">_structure_label</span></code></p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>raw_data</strong> (<em>List</em>) – List of Dicts</p> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>Dataframe containg the starting node a ending node of every arc of the network</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>pandas.Dataframe</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="json_importer.JsonImporter.import_trajectories"> |
||||
<code class="sig-name descname">import_trajectories</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">raw_data</span><span class="p">:</span> <span class="n">List</span></em><span class="sig-paren">)</span> → List<a class="headerlink" href="#json_importer.JsonImporter.import_trajectories" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Imports the trajectories from the list of dicts <code class="docutils literal notranslate"><span class="pre">raw_data</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>raw_data</strong> (<em>List</em>) – List of Dicts</p> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>List of dataframes containing all the trajectories</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>List</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="json_importer.JsonImporter.import_variables"> |
||||
<code class="sig-name descname">import_variables</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">raw_data</span><span class="p">:</span> <span class="n">List</span></em><span class="sig-paren">)</span> → pandas.core.frame.DataFrame<a class="headerlink" href="#json_importer.JsonImporter.import_variables" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Imports the data in <code class="docutils literal notranslate"><span class="pre">raw_data</span></code> at the key <code class="docutils literal notranslate"><span class="pre">_variables_label</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>raw_data</strong> (<em>List</em>) – List of Dicts</p> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>Datframe containg the variables simbolic labels and their cardinalities</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>pandas.Dataframe</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="json_importer.JsonImporter.normalize_trajectories"> |
||||
<code class="sig-name descname">normalize_trajectories</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">raw_data</span><span class="p">:</span> <span class="n">List</span></em>, <em class="sig-param"><span class="n">indx</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">trajectories_key</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> → List<a class="headerlink" href="#json_importer.JsonImporter.normalize_trajectories" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Extracts the trajectories in <code class="docutils literal notranslate"><span class="pre">raw_data</span></code> at the index <code class="docutils literal notranslate"><span class="pre">index</span></code> at the key <code class="docutils literal notranslate"><span class="pre">trajectories</span> <span class="pre">key</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>raw_data</strong> (<em>List</em>) – List of Dicts</p></li> |
||||
<li><p><strong>indx</strong> (<em>int</em>) – The index of the array from which the data have to be extracted</p></li> |
||||
<li><p><strong>trajectories_key</strong> (<em>string</em>) – the key of the trajectories objects</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>A list of daframes containg the trajectories</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>List</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="json_importer.JsonImporter.one_level_normalizing"> |
||||
<code class="sig-name descname">one_level_normalizing</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">raw_data</span><span class="p">:</span> <span class="n">List</span></em>, <em class="sig-param"><span class="n">indx</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">key</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> → pandas.core.frame.DataFrame<a class="headerlink" href="#json_importer.JsonImporter.one_level_normalizing" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Extracts the one-level nested data in the list <code class="docutils literal notranslate"><span class="pre">raw_data</span></code> at the index <code class="docutils literal notranslate"><span class="pre">indx</span></code> at the key <code class="docutils literal notranslate"><span class="pre">key</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>raw_data</strong> (<em>List</em>) – List of Dicts</p></li> |
||||
<li><p><strong>indx</strong> (<em>int</em>) – The index of the array from which the data have to be extracted</p></li> |
||||
<li><p><strong>key</strong> (<em>string</em>) – the key for the Dicts from which exctract data</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>A normalized dataframe</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>pandas.Datframe</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="json_importer.JsonImporter.read_json_file"> |
||||
<code class="sig-name descname">read_json_file</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → List<a class="headerlink" href="#json_importer.JsonImporter.read_json_file" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Reads the JSON file in the path self.filePath</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Returns</dt> |
||||
<dd class="field-odd"><p>The contents of the json file</p> |
||||
</dd> |
||||
<dt class="field-even">Return type</dt> |
||||
<dd class="field-even"><p>List</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
</dd></dl> |
||||
|
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<footer> |
||||
|
||||
|
||||
<hr/> |
||||
|
||||
<div role="contentinfo"> |
||||
<p> |
||||
© Copyright 2020, Filippo Martini. |
||||
</p> |
||||
</div> |
||||
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <a href="http://poraodojuca.net">Porão do Juca</a>. |
||||
|
||||
</footer> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
var DOCUMENTATION_OPTIONS = { |
||||
URL_ROOT:'../', |
||||
VERSION:'', |
||||
COLLAPSE_INDEX:false, |
||||
FILE_SUFFIX:'.html', |
||||
HAS_SOURCE: true |
||||
}; |
||||
</script> |
||||
<script type="text/javascript" src="../_static/jquery.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/underscore.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/doctools.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/language_data.js"> |
||||
|
||||
</script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/theme.js"></script> |
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/pdj.js"></script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
jQuery(function () { |
||||
SphinxRtdTheme.StickyNav.enable(); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
</body> |
||||
</html> |
@ -1,183 +0,0 @@ |
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
||||
<html xml:lang="" lang="" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
|
||||
<title>scripts — PyCTBN documentation</title> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'/> |
||||
<link rel="stylesheet" href="../_static/css/pdj.css" type="text/css" /> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index" |
||||
href="../genindex.html"/> |
||||
<link rel="search" title="Search" href="../search.html"/> |
||||
<link rel="top" title="PyCTBN documentation" href="../index.html"/> |
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
<meta http-equiv="cache-control" content="public" /> |
||||
<meta name="robots" content="follow, all" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<!-- Add jQuery library --> |
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="wy-body-for-nav" role="document"> |
||||
|
||||
<div class="wy-grid-for-nav"> |
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
||||
<div class="wy-side-nav-search"> |
||||
<a href="../index.html" class="fa fa-home"> PyCTBN </a> |
||||
<div role="search"> |
||||
<form id ="rtd-search-form" class="wy-form" |
||||
action="../search.html" method="get"> |
||||
<input type="text" name="q" placeholder="Search docs" /> |
||||
<input type="hidden" name="check_keywords" value="yes" /> |
||||
<input type="hidden" name="area" value="default" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
||||
|
||||
|
||||
|
||||
<!-- Local TOC --> |
||||
<div class="local-toc"><ul> |
||||
<li><a class="reference internal" href="#">scripts</a></li> |
||||
</ul> |
||||
</div> |
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</nav> |
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
||||
|
||||
<nav class="wy-nav-top" id="barra-mobile" role="navigation" aria-label="top navigation"> |
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
||||
<a href="#">Porão do Juca</a> |
||||
</nav> |
||||
|
||||
<div class="wy-nav-content"> |
||||
<div class="fundo-claro"> |
||||
</div> |
||||
<div class="fundo-escuro"> |
||||
</div> |
||||
|
||||
<div class="rst-content"> |
||||
<div role="navigation" aria-label="breadcrumbs navigation"> |
||||
|
||||
<!-- <ul class="wy-breadcrumbs"> --> |
||||
<!-- <li><a href="#">Docs</a> »</li> --> |
||||
|
||||
<!-- <li>Features</li> --> |
||||
<!-- <li class="wy-breadcrumbs-aside"> --> |
||||
|
||||
<!-- <a href="_sources/index.txt" rel="nofollow"> View page source</a> --> |
||||
|
||||
<!-- </li> --> |
||||
<!-- </ul> --> |
||||
<!-- <hr/> --> |
||||
</div> |
||||
|
||||
<div role="main" class=""> |
||||
|
||||
<div id="content" class="hfeed entry-container hentry"> |
||||
<div class="section" id="scripts"> |
||||
<h1>scripts<a class="headerlink" href="#scripts" title="Permalink to this headline">¶</a></h1> |
||||
<div class="toctree-wrapper compound"> |
||||
<ul> |
||||
<li class="toctree-l1"><a class="reference internal" href="abstract_importer.html">abstract_importer module</a></li> |
||||
<li class="toctree-l1"><a class="reference internal" href="cache.html">cache module</a></li> |
||||
<li class="toctree-l1"><a class="reference internal" href="conditional_intensity_matrix.html">conditional_intensity_matrix module</a></li> |
||||
<li class="toctree-l1"><a class="reference internal" href="json_importer.html">json_importer module</a></li> |
||||
<li class="toctree-l1"><a class="reference internal" href="network_graph.html">network_graph module</a></li> |
||||
<li class="toctree-l1"><a class="reference internal" href="parameters_estimator.html">parameters_estimator module</a></li> |
||||
<li class="toctree-l1"><a class="reference internal" href="sample_path.html">sample_path module</a></li> |
||||
<li class="toctree-l1"><a class="reference internal" href="set_of_cims.html">set_of_cims module</a></li> |
||||
<li class="toctree-l1"><a class="reference internal" href="structure.html">structure module</a></li> |
||||
<li class="toctree-l1"><a class="reference internal" href="structure_estimator.html">structure_estimator module</a></li> |
||||
<li class="toctree-l1"><a class="reference internal" href="trajectory.html">trajectory module</a></li> |
||||
</ul> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<footer> |
||||
|
||||
|
||||
<hr/> |
||||
|
||||
<div role="contentinfo"> |
||||
<p> |
||||
© Copyright 2020, Filippo Martini. |
||||
</p> |
||||
</div> |
||||
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <a href="http://poraodojuca.net">Porão do Juca</a>. |
||||
|
||||
</footer> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
var DOCUMENTATION_OPTIONS = { |
||||
URL_ROOT:'../', |
||||
VERSION:'', |
||||
COLLAPSE_INDEX:false, |
||||
FILE_SUFFIX:'.html', |
||||
HAS_SOURCE: true |
||||
}; |
||||
</script> |
||||
<script type="text/javascript" src="../_static/jquery.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/underscore.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/doctools.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/language_data.js"> |
||||
|
||||
</script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/theme.js"></script> |
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/pdj.js"></script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
jQuery(function () { |
||||
SphinxRtdTheme.StickyNav.enable(); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
</body> |
||||
</html> |
@ -1,420 +0,0 @@ |
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
||||
<html xml:lang="" lang="" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
|
||||
<title>network_graph module — PyCTBN documentation</title> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'/> |
||||
<link rel="stylesheet" href="../_static/css/pdj.css" type="text/css" /> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index" |
||||
href="../genindex.html"/> |
||||
<link rel="search" title="Search" href="../search.html"/> |
||||
<link rel="top" title="PyCTBN documentation" href="../index.html"/> |
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
<meta http-equiv="cache-control" content="public" /> |
||||
<meta name="robots" content="follow, all" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<!-- Add jQuery library --> |
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="wy-body-for-nav" role="document"> |
||||
|
||||
<div class="wy-grid-for-nav"> |
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
||||
<div class="wy-side-nav-search"> |
||||
<a href="../index.html" class="fa fa-home"> PyCTBN </a> |
||||
<div role="search"> |
||||
<form id ="rtd-search-form" class="wy-form" |
||||
action="../search.html" method="get"> |
||||
<input type="text" name="q" placeholder="Search docs" /> |
||||
<input type="hidden" name="check_keywords" value="yes" /> |
||||
<input type="hidden" name="area" value="default" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
||||
|
||||
|
||||
|
||||
<!-- Local TOC --> |
||||
<div class="local-toc"><ul> |
||||
<li><a class="reference internal" href="#">network_graph module</a></li> |
||||
</ul> |
||||
</div> |
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</nav> |
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
||||
|
||||
<nav class="wy-nav-top" id="barra-mobile" role="navigation" aria-label="top navigation"> |
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
||||
<a href="#">Porão do Juca</a> |
||||
</nav> |
||||
|
||||
<div class="wy-nav-content"> |
||||
<div class="fundo-claro"> |
||||
</div> |
||||
<div class="fundo-escuro"> |
||||
</div> |
||||
|
||||
<div class="rst-content"> |
||||
<div role="navigation" aria-label="breadcrumbs navigation"> |
||||
|
||||
<!-- <ul class="wy-breadcrumbs"> --> |
||||
<!-- <li><a href="#">Docs</a> »</li> --> |
||||
|
||||
<!-- <li>Features</li> --> |
||||
<!-- <li class="wy-breadcrumbs-aside"> --> |
||||
|
||||
<!-- <a href="_sources/index.txt" rel="nofollow"> View page source</a> --> |
||||
|
||||
<!-- </li> --> |
||||
<!-- </ul> --> |
||||
<!-- <hr/> --> |
||||
</div> |
||||
|
||||
<div role="main" class=""> |
||||
|
||||
<div id="content" class="hfeed entry-container hentry"> |
||||
<div class="section" id="module-network_graph"> |
||||
<span id="network-graph-module"></span><h1>network_graph module<a class="headerlink" href="#module-network_graph" title="Permalink to this headline">¶</a></h1> |
||||
<dl class="py class"> |
||||
<dt id="network_graph.NetworkGraph"> |
||||
<em class="property">class </em><code class="sig-prename descclassname">network_graph.</code><code class="sig-name descname">NetworkGraph</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">graph_struct</span><span class="p">:</span> <span class="n"><a class="reference internal" href="structure.html#structure.Structure" title="structure.Structure">structure.Structure</a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#network_graph.NetworkGraph" 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>Abstracts the infos contained in the Structure class in the form of a directed graph. |
||||
Has the task of creating all the necessary filtering and indexing structures for parameters estimation</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>graph_struct</strong> (<a class="reference internal" href="structure.html#structure.Structure" title="structure.Structure"><em>Structure</em></a>) – the <code class="docutils literal notranslate"><span class="pre">Structure</span></code> object from which infos about the net will be extracted</p> |
||||
</dd> |
||||
<dt class="field-even">_graph</dt> |
||||
<dd class="field-even"><p>directed graph</p> |
||||
</dd> |
||||
<dt class="field-odd">_aggregated_info_about_nodes_parents</dt> |
||||
<dd class="field-odd"><p>a structure that contains all the necessary infos |
||||
about every parents of the node of which all the indexing and filtering structures will be constructed.</p> |
||||
</dd> |
||||
<dt class="field-even">_time_scalar_indexing_structure</dt> |
||||
<dd class="field-even"><p>the indexing structure for state res time estimation</p> |
||||
</dd> |
||||
<dt class="field-odd">_transition_scalar_indexing_structure</dt> |
||||
<dd class="field-odd"><p>the indexing structure for transition computation</p> |
||||
</dd> |
||||
<dt class="field-even">_time_filtering</dt> |
||||
<dd class="field-even"><p>the columns filtering structure used in the computation of the state res times</p> |
||||
</dd> |
||||
<dt class="field-odd">_transition_filtering</dt> |
||||
<dd class="field-odd"><p>the columns filtering structure used in the computation of the transition |
||||
from one state to another</p> |
||||
</dd> |
||||
<dt class="field-even">_p_combs_structure</dt> |
||||
<dd class="field-even"><p>all the possible parents states combination for the node of interest</p> |
||||
</dd> |
||||
</dl> |
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.add_edges"> |
||||
<code class="sig-name descname">add_edges</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">list_of_edges</span><span class="p">:</span> <span class="n">List</span></em><span class="sig-paren">)</span> → None<a class="headerlink" href="#network_graph.NetworkGraph.add_edges" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Add the edges to the <code class="docutils literal notranslate"><span class="pre">_graph</span></code> contained in the list <code class="docutils literal notranslate"><span class="pre">list_of_edges</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>list_of_edges</strong> (<em>List</em>) – the list containing of tuples containing the edges</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.add_nodes"> |
||||
<code class="sig-name descname">add_nodes</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">list_of_nodes</span><span class="p">:</span> <span class="n">List</span></em><span class="sig-paren">)</span> → None<a class="headerlink" href="#network_graph.NetworkGraph.add_nodes" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Adds the nodes to the <code class="docutils literal notranslate"><span class="pre">_graph</span></code> contained in the list of nodes <code class="docutils literal notranslate"><span class="pre">list_of_nodes</span></code>. |
||||
Sets all the properties that identify a nodes (index, positional index, cardinality)</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>list_of_nodes</strong> (<em>List</em>) – the nodes to add to <code class="docutils literal notranslate"><span class="pre">_graph</span></code></p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.build_p_comb_structure_for_a_node"> |
||||
<code class="sig-name descname">build_p_comb_structure_for_a_node</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">parents_values</span><span class="p">:</span> <span class="n">List</span></em><span class="sig-paren">)</span> → numpy.ndarray<a class="headerlink" href="#network_graph.NetworkGraph.build_p_comb_structure_for_a_node" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Builds the combinatorial structure that contains the combinations of all the values contained in |
||||
<code class="docutils literal notranslate"><span class="pre">parents_values</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>parents_values</strong> (<em>List</em>) – the cardinalities of the nodes</p> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>A numpy matrix containing a grid of the combinations</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>numpy.ndArray</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.build_time_columns_filtering_for_a_node"> |
||||
<code class="sig-name descname">build_time_columns_filtering_for_a_node</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_indx</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">p_indxs</span><span class="p">:</span> <span class="n">List</span></em><span class="sig-paren">)</span> → numpy.ndarray<a class="headerlink" href="#network_graph.NetworkGraph.build_time_columns_filtering_for_a_node" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Builds the necessary structure to filter the desired columns indicated by <code class="docutils literal notranslate"><span class="pre">node_indx</span></code> and <code class="docutils literal notranslate"><span class="pre">p_indxs</span></code> |
||||
in the dataset. |
||||
This structute will be used in the computation of the state res times. |
||||
:param node_indx: the index of the node |
||||
:type node_indx: int |
||||
:param p_indxs: the indexes of the node’s parents |
||||
:type p_indxs: List |
||||
:return: The filtering structure for times estimation |
||||
:rtype: numpy.ndArray</p> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.build_time_scalar_indexing_structure_for_a_node"> |
||||
<code class="sig-name descname">build_time_scalar_indexing_structure_for_a_node</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_id</span><span class="p">:</span> <span class="n">str</span></em>, <em class="sig-param"><span class="n">parents_vals</span><span class="p">:</span> <span class="n">List</span></em><span class="sig-paren">)</span> → numpy.ndarray<a class="headerlink" href="#network_graph.NetworkGraph.build_time_scalar_indexing_structure_for_a_node" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Builds an indexing structure for the computation of state residence times values.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>node_id</strong> (<em>string</em>) – the node label</p></li> |
||||
<li><p><strong>parents_vals</strong> (<em>List</em>) – the caridinalites of the node’s parents</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>The time indexing structure</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>numpy.ndArray</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.build_transition_filtering_for_a_node"> |
||||
<code class="sig-name descname">build_transition_filtering_for_a_node</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_indx</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">p_indxs</span><span class="p">:</span> <span class="n">List</span></em><span class="sig-paren">)</span> → numpy.ndarray<a class="headerlink" href="#network_graph.NetworkGraph.build_transition_filtering_for_a_node" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Builds the necessary structure to filter the desired columns indicated by <code class="docutils literal notranslate"><span class="pre">node_indx</span></code> and <code class="docutils literal notranslate"><span class="pre">p_indxs</span></code> |
||||
in the dataset. |
||||
This structure will be used in the computation of the state transitions values. |
||||
:param node_indx: the index of the node |
||||
:type node_indx: int |
||||
:param p_indxs: the indexes of the node’s parents |
||||
:type p_indxs: List |
||||
:return: The filtering structure for transitions estimation |
||||
:rtype: numpy.ndArray</p> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.build_transition_scalar_indexing_structure_for_a_node"> |
||||
<code class="sig-name descname">build_transition_scalar_indexing_structure_for_a_node</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_id</span><span class="p">:</span> <span class="n">str</span></em>, <em class="sig-param"><span class="n">parents_vals</span><span class="p">:</span> <span class="n">List</span></em><span class="sig-paren">)</span> → numpy.ndarray<a class="headerlink" href="#network_graph.NetworkGraph.build_transition_scalar_indexing_structure_for_a_node" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Builds an indexing structure for the computation of state transitions values.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>node_id</strong> (<em>string</em>) – the node label</p></li> |
||||
<li><p><strong>parents_vals</strong> (<em>List</em>) – the caridinalites of the node’s parents</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>The transition indexing structure</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>numpy.ndArray</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.edges"> |
||||
<em class="property">property </em><code class="sig-name descname">edges</code><a class="headerlink" href="#network_graph.NetworkGraph.edges" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.fast_init"> |
||||
<code class="sig-name descname">fast_init</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_id</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> → None<a class="headerlink" href="#network_graph.NetworkGraph.fast_init" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Initializes all the necessary structures for parameters estimation of the node identified by the label |
||||
node_id</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>node_id</strong> (<em>string</em>) – the label of the node</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.get_node_indx"> |
||||
<code class="sig-name descname">get_node_indx</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_id</span></em><span class="sig-paren">)</span> → int<a class="headerlink" href="#network_graph.NetworkGraph.get_node_indx" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.get_ordered_by_indx_set_of_parents"> |
||||
<code class="sig-name descname">get_ordered_by_indx_set_of_parents</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> → Tuple<a class="headerlink" href="#network_graph.NetworkGraph.get_ordered_by_indx_set_of_parents" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Builds the aggregated structure that holds all the infos relative to the parent set of the node, namely |
||||
(parents_labels, parents_indexes, parents_cardinalities).</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>node</strong> (<em>string</em>) – the label of the node</p> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>a tuple containing all the parent set infos</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>Tuple</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.get_parents_by_id"> |
||||
<code class="sig-name descname">get_parents_by_id</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_id</span></em><span class="sig-paren">)</span> → List<a class="headerlink" href="#network_graph.NetworkGraph.get_parents_by_id" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Returns a list of labels of the parents of the node <code class="docutils literal notranslate"><span class="pre">node_id</span></code></p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>node_id</strong> (<em>string</em>) – the node label</p> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>a List of labels of the parents</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>List</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.get_positional_node_indx"> |
||||
<code class="sig-name descname">get_positional_node_indx</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_id</span></em><span class="sig-paren">)</span> → int<a class="headerlink" href="#network_graph.NetworkGraph.get_positional_node_indx" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.get_states_number"> |
||||
<code class="sig-name descname">get_states_number</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_id</span></em><span class="sig-paren">)</span> → int<a class="headerlink" href="#network_graph.NetworkGraph.get_states_number" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.nodes"> |
||||
<em class="property">property </em><code class="sig-name descname">nodes</code><a class="headerlink" href="#network_graph.NetworkGraph.nodes" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.nodes_indexes"> |
||||
<em class="property">property </em><code class="sig-name descname">nodes_indexes</code><a class="headerlink" href="#network_graph.NetworkGraph.nodes_indexes" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.nodes_values"> |
||||
<em class="property">property </em><code class="sig-name descname">nodes_values</code><a class="headerlink" href="#network_graph.NetworkGraph.nodes_values" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.p_combs"> |
||||
<em class="property">property </em><code class="sig-name descname">p_combs</code><a class="headerlink" href="#network_graph.NetworkGraph.p_combs" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.time_filtering"> |
||||
<em class="property">property </em><code class="sig-name descname">time_filtering</code><a class="headerlink" href="#network_graph.NetworkGraph.time_filtering" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.time_scalar_indexing_strucure"> |
||||
<em class="property">property </em><code class="sig-name descname">time_scalar_indexing_strucure</code><a class="headerlink" href="#network_graph.NetworkGraph.time_scalar_indexing_strucure" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.transition_filtering"> |
||||
<em class="property">property </em><code class="sig-name descname">transition_filtering</code><a class="headerlink" href="#network_graph.NetworkGraph.transition_filtering" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="network_graph.NetworkGraph.transition_scalar_indexing_structure"> |
||||
<em class="property">property </em><code class="sig-name descname">transition_scalar_indexing_structure</code><a class="headerlink" href="#network_graph.NetworkGraph.transition_scalar_indexing_structure" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
</dd></dl> |
||||
|
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<footer> |
||||
|
||||
|
||||
<hr/> |
||||
|
||||
<div role="contentinfo"> |
||||
<p> |
||||
© Copyright 2020, Filippo Martini. |
||||
</p> |
||||
</div> |
||||
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <a href="http://poraodojuca.net">Porão do Juca</a>. |
||||
|
||||
</footer> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
var DOCUMENTATION_OPTIONS = { |
||||
URL_ROOT:'../', |
||||
VERSION:'', |
||||
COLLAPSE_INDEX:false, |
||||
FILE_SUFFIX:'.html', |
||||
HAS_SOURCE: true |
||||
}; |
||||
</script> |
||||
<script type="text/javascript" src="../_static/jquery.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/underscore.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/doctools.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/language_data.js"> |
||||
|
||||
</script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/theme.js"></script> |
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/pdj.js"></script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
jQuery(function () { |
||||
SphinxRtdTheme.StickyNav.enable(); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
</body> |
||||
</html> |
@ -1,250 +0,0 @@ |
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
||||
<html xml:lang="" lang="" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
|
||||
<title>parameters_estimator module — PyCTBN documentation</title> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'/> |
||||
<link rel="stylesheet" href="../_static/css/pdj.css" type="text/css" /> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index" |
||||
href="../genindex.html"/> |
||||
<link rel="search" title="Search" href="../search.html"/> |
||||
<link rel="top" title="PyCTBN documentation" href="../index.html"/> |
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
<meta http-equiv="cache-control" content="public" /> |
||||
<meta name="robots" content="follow, all" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<!-- Add jQuery library --> |
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="wy-body-for-nav" role="document"> |
||||
|
||||
<div class="wy-grid-for-nav"> |
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
||||
<div class="wy-side-nav-search"> |
||||
<a href="../index.html" class="fa fa-home"> PyCTBN </a> |
||||
<div role="search"> |
||||
<form id ="rtd-search-form" class="wy-form" |
||||
action="../search.html" method="get"> |
||||
<input type="text" name="q" placeholder="Search docs" /> |
||||
<input type="hidden" name="check_keywords" value="yes" /> |
||||
<input type="hidden" name="area" value="default" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
||||
|
||||
|
||||
|
||||
<!-- Local TOC --> |
||||
<div class="local-toc"><ul> |
||||
<li><a class="reference internal" href="#">parameters_estimator module</a></li> |
||||
</ul> |
||||
</div> |
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</nav> |
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
||||
|
||||
<nav class="wy-nav-top" id="barra-mobile" role="navigation" aria-label="top navigation"> |
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
||||
<a href="#">Porão do Juca</a> |
||||
</nav> |
||||
|
||||
<div class="wy-nav-content"> |
||||
<div class="fundo-claro"> |
||||
</div> |
||||
<div class="fundo-escuro"> |
||||
</div> |
||||
|
||||
<div class="rst-content"> |
||||
<div role="navigation" aria-label="breadcrumbs navigation"> |
||||
|
||||
<!-- <ul class="wy-breadcrumbs"> --> |
||||
<!-- <li><a href="#">Docs</a> »</li> --> |
||||
|
||||
<!-- <li>Features</li> --> |
||||
<!-- <li class="wy-breadcrumbs-aside"> --> |
||||
|
||||
<!-- <a href="_sources/index.txt" rel="nofollow"> View page source</a> --> |
||||
|
||||
<!-- </li> --> |
||||
<!-- </ul> --> |
||||
<!-- <hr/> --> |
||||
</div> |
||||
|
||||
<div role="main" class=""> |
||||
|
||||
<div id="content" class="hfeed entry-container hentry"> |
||||
<div class="section" id="module-parameters_estimator"> |
||||
<span id="parameters-estimator-module"></span><h1>parameters_estimator module<a class="headerlink" href="#module-parameters_estimator" title="Permalink to this headline">¶</a></h1> |
||||
<dl class="py class"> |
||||
<dt id="parameters_estimator.ParametersEstimator"> |
||||
<em class="property">class </em><code class="sig-prename descclassname">parameters_estimator.</code><code class="sig-name descname">ParametersEstimator</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">trajectories</span><span class="p">:</span> <span class="n"><a class="reference internal" href="trajectory.html#trajectory.Trajectory" title="trajectory.Trajectory">trajectory.Trajectory</a></span></em>, <em class="sig-param"><span class="n">net_graph</span><span class="p">:</span> <span class="n"><a class="reference internal" href="network_graph.html#network_graph.NetworkGraph" title="network_graph.NetworkGraph">network_graph.NetworkGraph</a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#parameters_estimator.ParametersEstimator" 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>Has the task of computing the cims of particular node given the trajectories and the net structure |
||||
in the graph <code class="docutils literal notranslate"><span class="pre">_net_graph</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>trajectories</strong> (<a class="reference internal" href="trajectory.html#trajectory.Trajectory" title="trajectory.Trajectory"><em>Trajectory</em></a>) – the trajectories</p></li> |
||||
<li><p><strong>net_graph</strong> (<a class="reference internal" href="network_graph.html#network_graph.NetworkGraph" title="network_graph.NetworkGraph"><em>NetworkGraph</em></a>) – the net structure</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">_single_set_of_cims</dt> |
||||
<dd class="field-even"><p>the set of cims object that will hold the cims of the node</p> |
||||
</dd> |
||||
</dl> |
||||
<dl class="py method"> |
||||
<dt id="parameters_estimator.ParametersEstimator.compute_parameters_for_node"> |
||||
<code class="sig-name descname">compute_parameters_for_node</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_id</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> → <a class="reference internal" href="set_of_cims.html#set_of_cims.SetOfCims" title="set_of_cims.SetOfCims">set_of_cims.SetOfCims</a><a class="headerlink" href="#parameters_estimator.ParametersEstimator.compute_parameters_for_node" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Compute the CIMS of the node identified by the label <code class="docutils literal notranslate"><span class="pre">node_id</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>node_id</strong> (<em>string</em>) – the node label</p> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>A SetOfCims object filled with the computed CIMS</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p><a class="reference internal" href="set_of_cims.html#set_of_cims.SetOfCims" title="set_of_cims.SetOfCims">SetOfCims</a></p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="parameters_estimator.ParametersEstimator.compute_state_res_time_for_node"> |
||||
<code class="sig-name descname">compute_state_res_time_for_node</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_indx</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">times</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">trajectory</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">cols_filter</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">scalar_indexes_struct</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">T</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em><span class="sig-paren">)</span> → None<a class="headerlink" href="#parameters_estimator.ParametersEstimator.compute_state_res_time_for_node" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Compute the state residence times for a node and fill the matrix <code class="docutils literal notranslate"><span class="pre">T</span></code> with the results</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>node_indx</strong> (<em>int</em>) – the index of the node</p></li> |
||||
<li><p><strong>times</strong> (<em>numpy.array</em>) – the times deltas vector</p></li> |
||||
<li><p><strong>trajectory</strong> (<em>numpy.ndArray</em>) – the trajectory</p></li> |
||||
<li><p><strong>cols_filter</strong> (<em>numpy.array</em>) – the columns filtering structure</p></li> |
||||
<li><p><strong>scalar_indexes_struct</strong> (<em>numpy.array</em>) – the indexing structure</p></li> |
||||
<li><p><strong>T</strong> (<em>numpy.ndArray</em>) – the state residence times vectors</p></li> |
||||
</ul> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="parameters_estimator.ParametersEstimator.compute_state_transitions_for_a_node"> |
||||
<code class="sig-name descname">compute_state_transitions_for_a_node</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_indx</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">trajectory</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">cols_filter</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">scalar_indexing</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">M</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em><span class="sig-paren">)</span><a class="headerlink" href="#parameters_estimator.ParametersEstimator.compute_state_transitions_for_a_node" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Compute the state residence times for a node and fill the matrices <code class="docutils literal notranslate"><span class="pre">M</span></code> with the results.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>node_indx</strong> (<em>int</em>) – the index of the node</p></li> |
||||
<li><p><strong>trajectory</strong> (<em>numpy.ndArray</em>) – the trajectory</p></li> |
||||
<li><p><strong>cols_filter</strong> (<em>numpy.array</em>) – the columns filtering structure</p></li> |
||||
<li><p><strong>scalar_indexing</strong> (<em>numpy.array</em>) – the indexing structure</p></li> |
||||
<li><p><strong>M</strong> (<em>numpy.ndArray</em>) – the state transitions matrices</p></li> |
||||
</ul> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="parameters_estimator.ParametersEstimator.fast_init"> |
||||
<code class="sig-name descname">fast_init</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_id</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> → None<a class="headerlink" href="#parameters_estimator.ParametersEstimator.fast_init" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Initializes all the necessary structures for the parameters estimation for the node <code class="docutils literal notranslate"><span class="pre">node_id</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>node_id</strong> (<em>string</em>) – the node label</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
</dd></dl> |
||||
|
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<footer> |
||||
|
||||
|
||||
<hr/> |
||||
|
||||
<div role="contentinfo"> |
||||
<p> |
||||
© Copyright 2020, Filippo Martini. |
||||
</p> |
||||
</div> |
||||
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <a href="http://poraodojuca.net">Porão do Juca</a>. |
||||
|
||||
</footer> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
var DOCUMENTATION_OPTIONS = { |
||||
URL_ROOT:'../', |
||||
VERSION:'', |
||||
COLLAPSE_INDEX:false, |
||||
FILE_SUFFIX:'.html', |
||||
HAS_SOURCE: true |
||||
}; |
||||
</script> |
||||
<script type="text/javascript" src="../_static/jquery.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/underscore.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/doctools.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/language_data.js"> |
||||
|
||||
</script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/theme.js"></script> |
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/pdj.js"></script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
jQuery(function () { |
||||
SphinxRtdTheme.StickyNav.enable(); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
</body> |
||||
</html> |
@ -1,219 +0,0 @@ |
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
||||
<html xml:lang="" lang="" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
|
||||
<title>sample_path module — PyCTBN documentation</title> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'/> |
||||
<link rel="stylesheet" href="../_static/css/pdj.css" type="text/css" /> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index" |
||||
href="../genindex.html"/> |
||||
<link rel="search" title="Search" href="../search.html"/> |
||||
<link rel="top" title="PyCTBN documentation" href="../index.html"/> |
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
<meta http-equiv="cache-control" content="public" /> |
||||
<meta name="robots" content="follow, all" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<!-- Add jQuery library --> |
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="wy-body-for-nav" role="document"> |
||||
|
||||
<div class="wy-grid-for-nav"> |
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
||||
<div class="wy-side-nav-search"> |
||||
<a href="../index.html" class="fa fa-home"> PyCTBN </a> |
||||
<div role="search"> |
||||
<form id ="rtd-search-form" class="wy-form" |
||||
action="../search.html" method="get"> |
||||
<input type="text" name="q" placeholder="Search docs" /> |
||||
<input type="hidden" name="check_keywords" value="yes" /> |
||||
<input type="hidden" name="area" value="default" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
||||
|
||||
|
||||
|
||||
<!-- Local TOC --> |
||||
<div class="local-toc"><ul> |
||||
<li><a class="reference internal" href="#">sample_path module</a></li> |
||||
</ul> |
||||
</div> |
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</nav> |
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
||||
|
||||
<nav class="wy-nav-top" id="barra-mobile" role="navigation" aria-label="top navigation"> |
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
||||
<a href="#">Porão do Juca</a> |
||||
</nav> |
||||
|
||||
<div class="wy-nav-content"> |
||||
<div class="fundo-claro"> |
||||
</div> |
||||
<div class="fundo-escuro"> |
||||
</div> |
||||
|
||||
<div class="rst-content"> |
||||
<div role="navigation" aria-label="breadcrumbs navigation"> |
||||
|
||||
<!-- <ul class="wy-breadcrumbs"> --> |
||||
<!-- <li><a href="#">Docs</a> »</li> --> |
||||
|
||||
<!-- <li>Features</li> --> |
||||
<!-- <li class="wy-breadcrumbs-aside"> --> |
||||
|
||||
<!-- <a href="_sources/index.txt" rel="nofollow"> View page source</a> --> |
||||
|
||||
<!-- </li> --> |
||||
<!-- </ul> --> |
||||
<!-- <hr/> --> |
||||
</div> |
||||
|
||||
<div role="main" class=""> |
||||
|
||||
<div id="content" class="hfeed entry-container hentry"> |
||||
<div class="section" id="module-sample_path"> |
||||
<span id="sample-path-module"></span><h1>sample_path module<a class="headerlink" href="#module-sample_path" title="Permalink to this headline">¶</a></h1> |
||||
<dl class="py class"> |
||||
<dt id="sample_path.SamplePath"> |
||||
<em class="property">class </em><code class="sig-prename descclassname">sample_path.</code><code class="sig-name descname">SamplePath</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">importer</span><span class="p">:</span> <span class="n"><a class="reference internal" href="abstract_importer.html#abstract_importer.AbstractImporter" title="abstract_importer.AbstractImporter">abstract_importer.AbstractImporter</a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#sample_path.SamplePath" 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>Aggregates all the informations about the trajectories, the real structure of the sampled net and variables |
||||
cardinalites. Has the task of creating the objects <code class="docutils literal notranslate"><span class="pre">Trajectory</span></code> and <code class="docutils literal notranslate"><span class="pre">Structure</span></code> that will |
||||
contain the mentioned data.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>importer</strong> (<a class="reference internal" href="abstract_importer.html#abstract_importer.AbstractImporter" title="abstract_importer.AbstractImporter"><em>AbstractImporter</em></a>) – the Importer objects that will import ad process data</p> |
||||
</dd> |
||||
<dt class="field-even">_trajectories</dt> |
||||
<dd class="field-even"><p>the <code class="docutils literal notranslate"><span class="pre">Trajectory</span></code> object that will contain all the concatenated trajectories</p> |
||||
</dd> |
||||
<dt class="field-odd">_structure</dt> |
||||
<dd class="field-odd"><p>the <code class="docutils literal notranslate"><span class="pre">Structure</span></code> Object that will contain all the structurral infos about the net</p> |
||||
</dd> |
||||
<dt class="field-even">_total_variables_count</dt> |
||||
<dd class="field-even"><p>the number of variables in the net</p> |
||||
</dd> |
||||
</dl> |
||||
<dl class="py method"> |
||||
<dt id="sample_path.SamplePath.build_structure"> |
||||
<code class="sig-name descname">build_structure</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → None<a class="headerlink" href="#sample_path.SamplePath.build_structure" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Builds the <code class="docutils literal notranslate"><span class="pre">Structure</span></code> object that aggregates all the infos about the net.</p> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="sample_path.SamplePath.build_trajectories"> |
||||
<code class="sig-name descname">build_trajectories</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → None<a class="headerlink" href="#sample_path.SamplePath.build_trajectories" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Builds the Trajectory object that will contain all the trajectories. |
||||
Clears all the unused dataframes in <code class="docutils literal notranslate"><span class="pre">_importer</span></code> Object</p> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="sample_path.SamplePath.structure"> |
||||
<em class="property">property </em><code class="sig-name descname">structure</code><a class="headerlink" href="#sample_path.SamplePath.structure" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="sample_path.SamplePath.total_variables_count"> |
||||
<em class="property">property </em><code class="sig-name descname">total_variables_count</code><a class="headerlink" href="#sample_path.SamplePath.total_variables_count" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="sample_path.SamplePath.trajectories"> |
||||
<em class="property">property </em><code class="sig-name descname">trajectories</code><a class="headerlink" href="#sample_path.SamplePath.trajectories" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
</dd></dl> |
||||
|
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<footer> |
||||
|
||||
|
||||
<hr/> |
||||
|
||||
<div role="contentinfo"> |
||||
<p> |
||||
© Copyright 2020, Filippo Martini. |
||||
</p> |
||||
</div> |
||||
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <a href="http://poraodojuca.net">Porão do Juca</a>. |
||||
|
||||
</footer> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
var DOCUMENTATION_OPTIONS = { |
||||
URL_ROOT:'../', |
||||
VERSION:'', |
||||
COLLAPSE_INDEX:false, |
||||
FILE_SUFFIX:'.html', |
||||
HAS_SOURCE: true |
||||
}; |
||||
</script> |
||||
<script type="text/javascript" src="../_static/jquery.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/underscore.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/doctools.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/language_data.js"> |
||||
|
||||
</script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/theme.js"></script> |
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/pdj.js"></script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
jQuery(function () { |
||||
SphinxRtdTheme.StickyNav.enable(); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
</body> |
||||
</html> |
@ -1,251 +0,0 @@ |
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
||||
<html xml:lang="" lang="" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
|
||||
<title>set_of_cims module — PyCTBN documentation</title> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'/> |
||||
<link rel="stylesheet" href="../_static/css/pdj.css" type="text/css" /> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index" |
||||
href="../genindex.html"/> |
||||
<link rel="search" title="Search" href="../search.html"/> |
||||
<link rel="top" title="PyCTBN documentation" href="../index.html"/> |
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
<meta http-equiv="cache-control" content="public" /> |
||||
<meta name="robots" content="follow, all" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<!-- Add jQuery library --> |
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="wy-body-for-nav" role="document"> |
||||
|
||||
<div class="wy-grid-for-nav"> |
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
||||
<div class="wy-side-nav-search"> |
||||
<a href="../index.html" class="fa fa-home"> PyCTBN </a> |
||||
<div role="search"> |
||||
<form id ="rtd-search-form" class="wy-form" |
||||
action="../search.html" method="get"> |
||||
<input type="text" name="q" placeholder="Search docs" /> |
||||
<input type="hidden" name="check_keywords" value="yes" /> |
||||
<input type="hidden" name="area" value="default" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
||||
|
||||
|
||||
|
||||
<!-- Local TOC --> |
||||
<div class="local-toc"><ul> |
||||
<li><a class="reference internal" href="#">set_of_cims module</a></li> |
||||
</ul> |
||||
</div> |
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</nav> |
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
||||
|
||||
<nav class="wy-nav-top" id="barra-mobile" role="navigation" aria-label="top navigation"> |
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
||||
<a href="#">Porão do Juca</a> |
||||
</nav> |
||||
|
||||
<div class="wy-nav-content"> |
||||
<div class="fundo-claro"> |
||||
</div> |
||||
<div class="fundo-escuro"> |
||||
</div> |
||||
|
||||
<div class="rst-content"> |
||||
<div role="navigation" aria-label="breadcrumbs navigation"> |
||||
|
||||
<!-- <ul class="wy-breadcrumbs"> --> |
||||
<!-- <li><a href="#">Docs</a> »</li> --> |
||||
|
||||
<!-- <li>Features</li> --> |
||||
<!-- <li class="wy-breadcrumbs-aside"> --> |
||||
|
||||
<!-- <a href="_sources/index.txt" rel="nofollow"> View page source</a> --> |
||||
|
||||
<!-- </li> --> |
||||
<!-- </ul> --> |
||||
<!-- <hr/> --> |
||||
</div> |
||||
|
||||
<div role="main" class=""> |
||||
|
||||
<div id="content" class="hfeed entry-container hentry"> |
||||
<div class="section" id="module-set_of_cims"> |
||||
<span id="set-of-cims-module"></span><h1>set_of_cims module<a class="headerlink" href="#module-set_of_cims" title="Permalink to this headline">¶</a></h1> |
||||
<dl class="py class"> |
||||
<dt id="set_of_cims.SetOfCims"> |
||||
<em class="property">class </em><code class="sig-prename descclassname">set_of_cims.</code><code class="sig-name descname">SetOfCims</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_id</span><span class="p">:</span> <span class="n">str</span></em>, <em class="sig-param"><span class="n">parents_states_number</span><span class="p">:</span> <span class="n">List</span></em>, <em class="sig-param"><span class="n">node_states_number</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">p_combs</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em><span class="sig-paren">)</span><a class="headerlink" href="#set_of_cims.SetOfCims" 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>Aggregates all the CIMS of the node identified by the label _node_id.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>node_id</strong> – the node label</p></li> |
||||
<li><p><strong>parents_states_number</strong> (<em>List</em>) – the cardinalities of the parents</p></li> |
||||
<li><p><strong>node_states_number</strong> (<em>int</em>) – the caridinality of the node</p></li> |
||||
<li><p><strong>p_combs</strong> (<em>numpy.ndArray</em>) – the p_comb structure bound to this node</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">_state_residence_time</dt> |
||||
<dd class="field-even"><p>matrix containing all the state residence time vectors for the node</p> |
||||
</dd> |
||||
<dt class="field-odd">_transition_matrices</dt> |
||||
<dd class="field-odd"><p>matrix containing all the transition matrices for the node</p> |
||||
</dd> |
||||
<dt class="field-even">_actual_cims</dt> |
||||
<dd class="field-even"><p>the cims of the node</p> |
||||
</dd> |
||||
</dl> |
||||
<dl class="py method"> |
||||
<dt id="set_of_cims.SetOfCims.actual_cims"> |
||||
<em class="property">property </em><code class="sig-name descname">actual_cims</code><a class="headerlink" href="#set_of_cims.SetOfCims.actual_cims" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="set_of_cims.SetOfCims.build_cims"> |
||||
<code class="sig-name descname">build_cims</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">state_res_times</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">transition_matrices</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em><span class="sig-paren">)</span> → None<a class="headerlink" href="#set_of_cims.SetOfCims.build_cims" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Build the <code class="docutils literal notranslate"><span class="pre">ConditionalIntensityMatrix</span></code> objects given the state residence times and transitions matrices. |
||||
Compute the cim coefficients.The class member <code class="docutils literal notranslate"><span class="pre">_actual_cims</span></code> will contain the computed cims.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>state_res_times</strong> (<em>numpy.ndArray</em>) – the state residence times matrix</p></li> |
||||
<li><p><strong>transition_matrices</strong> (<em>numpy.ndArray</em>) – the transition matrices</p></li> |
||||
</ul> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="set_of_cims.SetOfCims.build_times_and_transitions_structures"> |
||||
<code class="sig-name descname">build_times_and_transitions_structures</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → None<a class="headerlink" href="#set_of_cims.SetOfCims.build_times_and_transitions_structures" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Initializes at the correct dimensions the state residence times matrix and the state transition matrices.</p> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="set_of_cims.SetOfCims.filter_cims_with_mask"> |
||||
<code class="sig-name descname">filter_cims_with_mask</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">mask_arr</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">comb</span><span class="p">:</span> <span class="n">List</span></em><span class="sig-paren">)</span> → numpy.ndarray<a class="headerlink" href="#set_of_cims.SetOfCims.filter_cims_with_mask" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Filter the cims contained in the array <code class="docutils literal notranslate"><span class="pre">_actual_cims</span></code> given the boolean mask <code class="docutils literal notranslate"><span class="pre">mask_arr</span></code> and the index |
||||
<code class="docutils literal notranslate"><span class="pre">comb</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>mask_arr</strong> (<em>numpy.array</em>) – the boolean mask that indicates which parent to consider</p></li> |
||||
<li><p><strong>comb</strong> (<em>numpy.array</em>) – the state/s of the filtered parents</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>Array of <code class="docutils literal notranslate"><span class="pre">ConditionalIntensityMatrix</span></code> objects</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>numpy.array</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="set_of_cims.SetOfCims.get_cims_number"> |
||||
<code class="sig-name descname">get_cims_number</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#set_of_cims.SetOfCims.get_cims_number" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="set_of_cims.SetOfCims.p_combs"> |
||||
<em class="property">property </em><code class="sig-name descname">p_combs</code><a class="headerlink" href="#set_of_cims.SetOfCims.p_combs" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
</dd></dl> |
||||
|
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<footer> |
||||
|
||||
|
||||
<hr/> |
||||
|
||||
<div role="contentinfo"> |
||||
<p> |
||||
© Copyright 2020, Filippo Martini. |
||||
</p> |
||||
</div> |
||||
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <a href="http://poraodojuca.net">Porão do Juca</a>. |
||||
|
||||
</footer> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
var DOCUMENTATION_OPTIONS = { |
||||
URL_ROOT:'../', |
||||
VERSION:'', |
||||
COLLAPSE_INDEX:false, |
||||
FILE_SUFFIX:'.html', |
||||
HAS_SOURCE: true |
||||
}; |
||||
</script> |
||||
<script type="text/javascript" src="../_static/jquery.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/underscore.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/doctools.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/language_data.js"> |
||||
|
||||
</script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/theme.js"></script> |
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/pdj.js"></script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
jQuery(function () { |
||||
SphinxRtdTheme.StickyNav.enable(); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
</body> |
||||
</html> |
@ -1,267 +0,0 @@ |
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
||||
<html xml:lang="" lang="" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
|
||||
<title>structure module — PyCTBN documentation</title> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'/> |
||||
<link rel="stylesheet" href="../_static/css/pdj.css" type="text/css" /> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index" |
||||
href="../genindex.html"/> |
||||
<link rel="search" title="Search" href="../search.html"/> |
||||
<link rel="top" title="PyCTBN documentation" href="../index.html"/> |
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
<meta http-equiv="cache-control" content="public" /> |
||||
<meta name="robots" content="follow, all" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<!-- Add jQuery library --> |
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="wy-body-for-nav" role="document"> |
||||
|
||||
<div class="wy-grid-for-nav"> |
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
||||
<div class="wy-side-nav-search"> |
||||
<a href="../index.html" class="fa fa-home"> PyCTBN </a> |
||||
<div role="search"> |
||||
<form id ="rtd-search-form" class="wy-form" |
||||
action="../search.html" method="get"> |
||||
<input type="text" name="q" placeholder="Search docs" /> |
||||
<input type="hidden" name="check_keywords" value="yes" /> |
||||
<input type="hidden" name="area" value="default" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
||||
|
||||
|
||||
|
||||
<!-- Local TOC --> |
||||
<div class="local-toc"><ul> |
||||
<li><a class="reference internal" href="#">structure module</a></li> |
||||
</ul> |
||||
</div> |
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</nav> |
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
||||
|
||||
<nav class="wy-nav-top" id="barra-mobile" role="navigation" aria-label="top navigation"> |
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
||||
<a href="#">Porão do Juca</a> |
||||
</nav> |
||||
|
||||
<div class="wy-nav-content"> |
||||
<div class="fundo-claro"> |
||||
</div> |
||||
<div class="fundo-escuro"> |
||||
</div> |
||||
|
||||
<div class="rst-content"> |
||||
<div role="navigation" aria-label="breadcrumbs navigation"> |
||||
|
||||
<!-- <ul class="wy-breadcrumbs"> --> |
||||
<!-- <li><a href="#">Docs</a> »</li> --> |
||||
|
||||
<!-- <li>Features</li> --> |
||||
<!-- <li class="wy-breadcrumbs-aside"> --> |
||||
|
||||
<!-- <a href="_sources/index.txt" rel="nofollow"> View page source</a> --> |
||||
|
||||
<!-- </li> --> |
||||
<!-- </ul> --> |
||||
<!-- <hr/> --> |
||||
</div> |
||||
|
||||
<div role="main" class=""> |
||||
|
||||
<div id="content" class="hfeed entry-container hentry"> |
||||
<div class="section" id="module-structure"> |
||||
<span id="structure-module"></span><h1>structure module<a class="headerlink" href="#module-structure" title="Permalink to this headline">¶</a></h1> |
||||
<dl class="py class"> |
||||
<dt id="structure.Structure"> |
||||
<em class="property">class </em><code class="sig-prename descclassname">structure.</code><code class="sig-name descname">Structure</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">nodes_labels_list</span><span class="p">:</span> <span class="n">List</span></em>, <em class="sig-param"><span class="n">nodes_indexes_arr</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">nodes_vals_arr</span><span class="p">:</span> <span class="n">numpy.ndarray</span></em>, <em class="sig-param"><span class="n">edges_list</span><span class="p">:</span> <span class="n">List</span></em>, <em class="sig-param"><span class="n">total_variables_number</span><span class="p">:</span> <span class="n">int</span></em><span class="sig-paren">)</span><a class="headerlink" href="#structure.Structure" 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>Contains all the infos about the network structure(nodes labels, nodes caridinalites, edges, indexes)</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>nodes_labels_list</strong> (<em>List</em>) – the symbolic names of the variables</p></li> |
||||
<li><p><strong>nodes_indexes_arr</strong> (<em>numpy.ndArray</em>) – the indexes of the nodes</p></li> |
||||
<li><p><strong>nodes_vals_arr</strong> (<em>numpy.ndArray</em>) – the cardinalites of the nodes</p></li> |
||||
<li><p><strong>edges_list</strong> (<em>List</em>) – the edges of the network</p></li> |
||||
<li><p><strong>total_variables_number</strong> (<em>int</em>) – the total number of variables in the net</p></li> |
||||
</ul> |
||||
</dd> |
||||
</dl> |
||||
<dl class="py method"> |
||||
<dt id="structure.Structure.edges"> |
||||
<em class="property">property </em><code class="sig-name descname">edges</code><a class="headerlink" href="#structure.Structure.edges" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="structure.Structure.get_node_id"> |
||||
<code class="sig-name descname">get_node_id</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_indx</span><span class="p">:</span> <span class="n">int</span></em><span class="sig-paren">)</span> → str<a class="headerlink" href="#structure.Structure.get_node_id" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Given the <code class="docutils literal notranslate"><span class="pre">node_index</span></code> returns the node label.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>node_indx</strong> (<em>int</em>) – the node index</p> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>the node label</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>string</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="structure.Structure.get_node_indx"> |
||||
<code class="sig-name descname">get_node_indx</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_id</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> → int<a class="headerlink" href="#structure.Structure.get_node_indx" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Given the <code class="docutils literal notranslate"><span class="pre">node_index</span></code> returns the node label.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>node_id</strong> (<em>string</em>) – the node label</p> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>the node index</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>int</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="structure.Structure.get_positional_node_indx"> |
||||
<code class="sig-name descname">get_positional_node_indx</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_id</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> → int<a class="headerlink" href="#structure.Structure.get_positional_node_indx" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="structure.Structure.get_states_number"> |
||||
<code class="sig-name descname">get_states_number</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> → int<a class="headerlink" href="#structure.Structure.get_states_number" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Given the node label <code class="docutils literal notranslate"><span class="pre">node</span></code> returns the cardinality of the node.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>node</strong> (<em>string</em>) – the node label</p> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>the node cardinality</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>int</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="structure.Structure.nodes_indexes"> |
||||
<em class="property">property </em><code class="sig-name descname">nodes_indexes</code><a class="headerlink" href="#structure.Structure.nodes_indexes" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="structure.Structure.nodes_labels"> |
||||
<em class="property">property </em><code class="sig-name descname">nodes_labels</code><a class="headerlink" href="#structure.Structure.nodes_labels" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="structure.Structure.nodes_values"> |
||||
<em class="property">property </em><code class="sig-name descname">nodes_values</code><a class="headerlink" href="#structure.Structure.nodes_values" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="structure.Structure.total_variables_number"> |
||||
<em class="property">property </em><code class="sig-name descname">total_variables_number</code><a class="headerlink" href="#structure.Structure.total_variables_number" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
</dd></dl> |
||||
|
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<footer> |
||||
|
||||
|
||||
<hr/> |
||||
|
||||
<div role="contentinfo"> |
||||
<p> |
||||
© Copyright 2020, Filippo Martini. |
||||
</p> |
||||
</div> |
||||
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <a href="http://poraodojuca.net">Porão do Juca</a>. |
||||
|
||||
</footer> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
var DOCUMENTATION_OPTIONS = { |
||||
URL_ROOT:'../', |
||||
VERSION:'', |
||||
COLLAPSE_INDEX:false, |
||||
FILE_SUFFIX:'.html', |
||||
HAS_SOURCE: true |
||||
}; |
||||
</script> |
||||
<script type="text/javascript" src="../_static/jquery.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/underscore.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/doctools.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/language_data.js"> |
||||
|
||||
</script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/theme.js"></script> |
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/pdj.js"></script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
jQuery(function () { |
||||
SphinxRtdTheme.StickyNav.enable(); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
</body> |
||||
</html> |
@ -1,309 +0,0 @@ |
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
||||
<html xml:lang="" lang="" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
|
||||
<title>structure_estimator module — PyCTBN documentation</title> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'/> |
||||
<link rel="stylesheet" href="../_static/css/pdj.css" type="text/css" /> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index" |
||||
href="../genindex.html"/> |
||||
<link rel="search" title="Search" href="../search.html"/> |
||||
<link rel="top" title="PyCTBN documentation" href="../index.html"/> |
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
<meta http-equiv="cache-control" content="public" /> |
||||
<meta name="robots" content="follow, all" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<!-- Add jQuery library --> |
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="wy-body-for-nav" role="document"> |
||||
|
||||
<div class="wy-grid-for-nav"> |
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
||||
<div class="wy-side-nav-search"> |
||||
<a href="../index.html" class="fa fa-home"> PyCTBN </a> |
||||
<div role="search"> |
||||
<form id ="rtd-search-form" class="wy-form" |
||||
action="../search.html" method="get"> |
||||
<input type="text" name="q" placeholder="Search docs" /> |
||||
<input type="hidden" name="check_keywords" value="yes" /> |
||||
<input type="hidden" name="area" value="default" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
||||
|
||||
|
||||
|
||||
<!-- Local TOC --> |
||||
<div class="local-toc"><ul> |
||||
<li><a class="reference internal" href="#">structure_estimator module</a></li> |
||||
</ul> |
||||
</div> |
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</nav> |
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
||||
|
||||
<nav class="wy-nav-top" id="barra-mobile" role="navigation" aria-label="top navigation"> |
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
||||
<a href="#">Porão do Juca</a> |
||||
</nav> |
||||
|
||||
<div class="wy-nav-content"> |
||||
<div class="fundo-claro"> |
||||
</div> |
||||
<div class="fundo-escuro"> |
||||
</div> |
||||
|
||||
<div class="rst-content"> |
||||
<div role="navigation" aria-label="breadcrumbs navigation"> |
||||
|
||||
<!-- <ul class="wy-breadcrumbs"> --> |
||||
<!-- <li><a href="#">Docs</a> »</li> --> |
||||
|
||||
<!-- <li>Features</li> --> |
||||
<!-- <li class="wy-breadcrumbs-aside"> --> |
||||
|
||||
<!-- <a href="_sources/index.txt" rel="nofollow"> View page source</a> --> |
||||
|
||||
<!-- </li> --> |
||||
<!-- </ul> --> |
||||
<!-- <hr/> --> |
||||
</div> |
||||
|
||||
<div role="main" class=""> |
||||
|
||||
<div id="content" class="hfeed entry-container hentry"> |
||||
<div class="section" id="module-structure_estimator"> |
||||
<span id="structure-estimator-module"></span><h1>structure_estimator module<a class="headerlink" href="#module-structure_estimator" title="Permalink to this headline">¶</a></h1> |
||||
<dl class="py class"> |
||||
<dt id="structure_estimator.StructureEstimator"> |
||||
<em class="property">class </em><code class="sig-prename descclassname">structure_estimator.</code><code class="sig-name descname">StructureEstimator</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">sample_path</span><span class="p">:</span> <span class="n"><a class="reference internal" href="sample_path.html#sample_path.SamplePath" title="sample_path.SamplePath">sample_path.SamplePath</a></span></em>, <em class="sig-param"><span class="n">exp_test_alfa</span><span class="p">:</span> <span class="n">float</span></em>, <em class="sig-param"><span class="n">chi_test_alfa</span><span class="p">:</span> <span class="n">float</span></em><span class="sig-paren">)</span><a class="headerlink" href="#structure_estimator.StructureEstimator" 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>Has the task of estimating the network structure given the trajectories in <code class="docutils literal notranslate"><span class="pre">samplepath</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>sample_path</strong> (<a class="reference internal" href="sample_path.html#sample_path.SamplePath" title="sample_path.SamplePath"><em>SamplePath</em></a>) – the _sample_path object containing the trajectories and the real structure</p></li> |
||||
<li><p><strong>exp_test_alfa</strong> (<em>float</em>) – the significance level for the exponential Hp test</p></li> |
||||
<li><p><strong>chi_test_alfa</strong> (<em>float</em>) – the significance level for the chi Hp test</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">_nodes</dt> |
||||
<dd class="field-even"><p>the nodes labels</p> |
||||
</dd> |
||||
<dt class="field-odd">_nodes_vals</dt> |
||||
<dd class="field-odd"><p>the nodes cardinalities</p> |
||||
</dd> |
||||
<dt class="field-even">_nodes_indxs</dt> |
||||
<dd class="field-even"><p>the nodes indexes</p> |
||||
</dd> |
||||
<dt class="field-odd">_complete_graph</dt> |
||||
<dd class="field-odd"><p>the complete directed graph built using the nodes labels in <code class="docutils literal notranslate"><span class="pre">_nodes</span></code></p> |
||||
</dd> |
||||
<dt class="field-even">_cache</dt> |
||||
<dd class="field-even"><p>the Cache object</p> |
||||
</dd> |
||||
</dl> |
||||
<dl class="py method"> |
||||
<dt id="structure_estimator.StructureEstimator.build_complete_graph"> |
||||
<code class="sig-name descname">build_complete_graph</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">node_ids</span><span class="p">:</span> <span class="n">List</span></em><span class="sig-paren">)</span> → networkx.classes.digraph.DiGraph<a class="headerlink" href="#structure_estimator.StructureEstimator.build_complete_graph" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Builds a complete directed graph (no self loops) given the nodes labels in the list <code class="docutils literal notranslate"><span class="pre">node_ids</span></code>:</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><p><strong>node_ids</strong> (<em>List</em>) – the list of nodes labels</p> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>a complete Digraph Object</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>networkx.DiGraph</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="structure_estimator.StructureEstimator.complete_test"> |
||||
<code class="sig-name descname">complete_test</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">test_parent</span><span class="p">:</span> <span class="n">str</span></em>, <em class="sig-param"><span class="n">test_child</span><span class="p">:</span> <span class="n">str</span></em>, <em class="sig-param"><span class="n">parent_set</span><span class="p">:</span> <span class="n">List</span></em>, <em class="sig-param"><span class="n">child_states_numb</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">tot_vars_count</span><span class="p">:</span> <span class="n">int</span></em><span class="sig-paren">)</span> → bool<a class="headerlink" href="#structure_estimator.StructureEstimator.complete_test" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Performs a complete independence test on the directed graphs G1 = {test_child U parent_set} |
||||
G2 = {G1 U test_parent} (added as an additional parent of the test_child). |
||||
Generates all the necessary structures and datas to perform the tests.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>test_parent</strong> (<em>string</em>) – the node label of the test parent</p></li> |
||||
<li><p><strong>test_child</strong> (<em>string</em>) – the node label of the child</p></li> |
||||
<li><p><strong>parent_set</strong> (<em>List</em>) – the common parent set</p></li> |
||||
<li><p><strong>child_states_numb</strong> (<em>int</em>) – the cardinality of the <code class="docutils literal notranslate"><span class="pre">test_child</span></code></p></li> |
||||
<li><p><strong>tot_vars_count</strong> (<em>int</em>) – the total number of variables in the net</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>True iff test_child and test_parent are independent given the sep_set parent_set. False otherwise</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>bool</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="structure_estimator.StructureEstimator.ctpc_algorithm"> |
||||
<code class="sig-name descname">ctpc_algorithm</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → None<a class="headerlink" href="#structure_estimator.StructureEstimator.ctpc_algorithm" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Compute the CTPC algorithm over the entire net.</p> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="structure_estimator.StructureEstimator.generate_possible_sub_sets_of_size"> |
||||
<code class="sig-name descname">generate_possible_sub_sets_of_size</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">u</span><span class="p">:</span> <span class="n">List</span></em>, <em class="sig-param"><span class="n">size</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">parent_label</span><span class="p">:</span> <span class="n">str</span></em><span class="sig-paren">)</span> → Iterator<a class="headerlink" href="#structure_estimator.StructureEstimator.generate_possible_sub_sets_of_size" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Creates a list containing all possible subsets of the list <code class="docutils literal notranslate"><span class="pre">u</span></code> of size <code class="docutils literal notranslate"><span class="pre">size</span></code>, |
||||
that do not contains a the node identified by <code class="docutils literal notranslate"><span class="pre">parent_label</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>u</strong> (<em>List</em>) – the list of nodes</p></li> |
||||
<li><p><strong>size</strong> (<em>int</em>) – the size of the subsets</p></li> |
||||
<li><p><strong>parent_label</strong> (<em>string</em>) – the node to exclude in the subsets generation</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">Returns</dt> |
||||
<dd class="field-even"><p>an Iterator Object containing a list of lists</p> |
||||
</dd> |
||||
<dt class="field-odd">Return type</dt> |
||||
<dd class="field-odd"><p>Iterator</p> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="structure_estimator.StructureEstimator.independence_test"> |
||||
<code class="sig-name descname">independence_test</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">child_states_numb</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">cim1</span><span class="p">:</span> <span class="n"><a class="reference internal" href="conditional_intensity_matrix.html#conditional_intensity_matrix.ConditionalIntensityMatrix" title="conditional_intensity_matrix.ConditionalIntensityMatrix">conditional_intensity_matrix.ConditionalIntensityMatrix</a></span></em>, <em class="sig-param"><span class="n">cim2</span><span class="p">:</span> <span class="n"><a class="reference internal" href="conditional_intensity_matrix.html#conditional_intensity_matrix.ConditionalIntensityMatrix" title="conditional_intensity_matrix.ConditionalIntensityMatrix">conditional_intensity_matrix.ConditionalIntensityMatrix</a></span></em><span class="sig-paren">)</span> → bool<a class="headerlink" href="#structure_estimator.StructureEstimator.independence_test" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Compute the actual independence test using two cims. |
||||
It is performed first the exponential test and if the null hypothesis is not rejected, |
||||
it is performed also the chi_test.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>child_states_numb</strong> (<em>int</em>) – the cardinality of the test child</p></li> |
||||
<li><p><strong>cim1</strong> (<a class="reference internal" href="conditional_intensity_matrix.html#conditional_intensity_matrix.ConditionalIntensityMatrix" title="conditional_intensity_matrix.ConditionalIntensityMatrix"><em>ConditionalIntensityMatrix</em></a>) – a cim belonging to the graph without test parent</p></li> |
||||
<li><p><strong>cim2</strong> (<a class="reference internal" href="conditional_intensity_matrix.html#conditional_intensity_matrix.ConditionalIntensityMatrix" title="conditional_intensity_matrix.ConditionalIntensityMatrix"><em>ConditionalIntensityMatrix</em></a>) – a cim belonging to the graph with test parent</p></li> |
||||
</ul> |
||||
</dd> |
||||
</dl> |
||||
<p>:return:True iff both tests do NOT reject the null hypothesis of indipendence. False otherwise. |
||||
:rtype: bool</p> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="structure_estimator.StructureEstimator.one_iteration_of_CTPC_algorithm"> |
||||
<code class="sig-name descname">one_iteration_of_CTPC_algorithm</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">var_id</span><span class="p">:</span> <span class="n">str</span></em>, <em class="sig-param"><span class="n">tot_vars_count</span><span class="p">:</span> <span class="n">int</span></em><span class="sig-paren">)</span> → None<a class="headerlink" href="#structure_estimator.StructureEstimator.one_iteration_of_CTPC_algorithm" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Performs an iteration of the CTPC algorithm using the node <code class="docutils literal notranslate"><span class="pre">var_id</span></code> as <code class="docutils literal notranslate"><span class="pre">test_child</span></code>.</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>var_id</strong> (<em>string</em>) – the node label of the test child</p></li> |
||||
<li><p><strong>tot_vars_count</strong> (<em>int</em>) – the number of _nodes in the net</p></li> |
||||
</ul> |
||||
</dd> |
||||
</dl> |
||||
</dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="structure_estimator.StructureEstimator.save_results"> |
||||
<code class="sig-name descname">save_results</code><span class="sig-paren">(</span><span class="sig-paren">)</span> → None<a class="headerlink" href="#structure_estimator.StructureEstimator.save_results" title="Permalink to this definition">¶</a></dt> |
||||
<dd><p>Save the estimated Structure to a .json file in the path where the data are loaded from. |
||||
The file is named as the input dataset but the <a href="#id1"><span class="problematic" id="id2">results_</span></a> word is appendend to the results file.</p> |
||||
</dd></dl> |
||||
|
||||
</dd></dl> |
||||
|
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<footer> |
||||
|
||||
|
||||
<hr/> |
||||
|
||||
<div role="contentinfo"> |
||||
<p> |
||||
© Copyright 2020, Filippo Martini. |
||||
</p> |
||||
</div> |
||||
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <a href="http://poraodojuca.net">Porão do Juca</a>. |
||||
|
||||
</footer> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
var DOCUMENTATION_OPTIONS = { |
||||
URL_ROOT:'../', |
||||
VERSION:'', |
||||
COLLAPSE_INDEX:false, |
||||
FILE_SUFFIX:'.html', |
||||
HAS_SOURCE: true |
||||
}; |
||||
</script> |
||||
<script type="text/javascript" src="../_static/jquery.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/underscore.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/doctools.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/language_data.js"> |
||||
|
||||
</script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/theme.js"></script> |
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/pdj.js"></script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
jQuery(function () { |
||||
SphinxRtdTheme.StickyNav.enable(); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
</body> |
||||
</html> |
@ -1,210 +0,0 @@ |
||||
|
||||
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
||||
<html xml:lang="" lang="" version="-//W3C//DTD XHTML 1.1//EN" xmlns="http://www.w3.org/1999/xhtml"> |
||||
<head> |
||||
<meta charset="utf-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
|
||||
|
||||
<title>trajectory module — PyCTBN documentation</title> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link href='https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700' rel='stylesheet' type='text/css'/> |
||||
<link rel="stylesheet" href="../_static/css/pdj.css" type="text/css" /> |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="index" title="Index" |
||||
href="../genindex.html"/> |
||||
<link rel="search" title="Search" href="../search.html"/> |
||||
<link rel="top" title="PyCTBN documentation" href="../index.html"/> |
||||
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
||||
<meta http-equiv="cache-control" content="public" /> |
||||
<meta name="robots" content="follow, all" /> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
||||
<!-- Add jQuery library --> |
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> |
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.6.2/modernizr.min.js"></script> |
||||
|
||||
</head> |
||||
|
||||
<body class="wy-body-for-nav" role="document"> |
||||
|
||||
<div class="wy-grid-for-nav"> |
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
||||
<div class="wy-side-nav-search"> |
||||
<a href="../index.html" class="fa fa-home"> PyCTBN </a> |
||||
<div role="search"> |
||||
<form id ="rtd-search-form" class="wy-form" |
||||
action="../search.html" method="get"> |
||||
<input type="text" name="q" placeholder="Search docs" /> |
||||
<input type="hidden" name="check_keywords" value="yes" /> |
||||
<input type="hidden" name="area" value="default" /> |
||||
</form> |
||||
</div> |
||||
</div> |
||||
|
||||
<div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation"> |
||||
|
||||
|
||||
|
||||
<!-- Local TOC --> |
||||
<div class="local-toc"><ul> |
||||
<li><a class="reference internal" href="#">trajectory module</a></li> |
||||
</ul> |
||||
</div> |
||||
|
||||
|
||||
|
||||
</div> |
||||
|
||||
</nav> |
||||
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"> |
||||
|
||||
<nav class="wy-nav-top" id="barra-mobile" role="navigation" aria-label="top navigation"> |
||||
<i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
||||
<a href="#">Porão do Juca</a> |
||||
</nav> |
||||
|
||||
<div class="wy-nav-content"> |
||||
<div class="fundo-claro"> |
||||
</div> |
||||
<div class="fundo-escuro"> |
||||
</div> |
||||
|
||||
<div class="rst-content"> |
||||
<div role="navigation" aria-label="breadcrumbs navigation"> |
||||
|
||||
<!-- <ul class="wy-breadcrumbs"> --> |
||||
<!-- <li><a href="#">Docs</a> »</li> --> |
||||
|
||||
<!-- <li>Features</li> --> |
||||
<!-- <li class="wy-breadcrumbs-aside"> --> |
||||
|
||||
<!-- <a href="_sources/index.txt" rel="nofollow"> View page source</a> --> |
||||
|
||||
<!-- </li> --> |
||||
<!-- </ul> --> |
||||
<!-- <hr/> --> |
||||
</div> |
||||
|
||||
<div role="main" class=""> |
||||
|
||||
<div id="content" class="hfeed entry-container hentry"> |
||||
<div class="section" id="module-trajectory"> |
||||
<span id="trajectory-module"></span><h1>trajectory module<a class="headerlink" href="#module-trajectory" title="Permalink to this headline">¶</a></h1> |
||||
<dl class="py class"> |
||||
<dt id="trajectory.Trajectory"> |
||||
<em class="property">class </em><code class="sig-prename descclassname">trajectory.</code><code class="sig-name descname">Trajectory</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">list_of_columns</span><span class="p">:</span> <span class="n">List</span></em>, <em class="sig-param"><span class="n">original_cols_number</span><span class="p">:</span> <span class="n">int</span></em><span class="sig-paren">)</span><a class="headerlink" href="#trajectory.Trajectory" 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>Abstracts the infos about a complete set of trajectories, represented as a numpy array of doubles (the time deltas) |
||||
and a numpy matrix of ints (the changes of states).</p> |
||||
<dl class="field-list simple"> |
||||
<dt class="field-odd">Parameters</dt> |
||||
<dd class="field-odd"><ul class="simple"> |
||||
<li><p><strong>list_of_columns</strong> (<em>List</em>) – the list containing the times array and values matrix</p></li> |
||||
<li><p><strong>original_cols_number</strong> (<em>int</em>) – total number of cols in the data</p></li> |
||||
</ul> |
||||
</dd> |
||||
<dt class="field-even">_actual_trajectory</dt> |
||||
<dd class="field-even"><p>the trajectory containing also the duplicated/shifted values</p> |
||||
</dd> |
||||
<dt class="field-odd">_times</dt> |
||||
<dd class="field-odd"><p>the array containing the time deltas</p> |
||||
</dd> |
||||
</dl> |
||||
<dl class="py method"> |
||||
<dt id="trajectory.Trajectory.complete_trajectory"> |
||||
<em class="property">property </em><code class="sig-name descname">complete_trajectory</code><a class="headerlink" href="#trajectory.Trajectory.complete_trajectory" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="trajectory.Trajectory.size"> |
||||
<code class="sig-name descname">size</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#trajectory.Trajectory.size" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="trajectory.Trajectory.times"> |
||||
<em class="property">property </em><code class="sig-name descname">times</code><a class="headerlink" href="#trajectory.Trajectory.times" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
<dl class="py method"> |
||||
<dt id="trajectory.Trajectory.trajectory"> |
||||
<em class="property">property </em><code class="sig-name descname">trajectory</code><a class="headerlink" href="#trajectory.Trajectory.trajectory" title="Permalink to this definition">¶</a></dt> |
||||
<dd></dd></dl> |
||||
|
||||
</dd></dl> |
||||
|
||||
</div> |
||||
|
||||
|
||||
</div> |
||||
<footer> |
||||
|
||||
|
||||
<hr/> |
||||
|
||||
<div role="contentinfo"> |
||||
<p> |
||||
© Copyright 2020, Filippo Martini. |
||||
</p> |
||||
</div> |
||||
|
||||
Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <a href="http://poraodojuca.net">Porão do Juca</a>. |
||||
|
||||
</footer> |
||||
</div> |
||||
</div> |
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
var DOCUMENTATION_OPTIONS = { |
||||
URL_ROOT:'../', |
||||
VERSION:'', |
||||
COLLAPSE_INDEX:false, |
||||
FILE_SUFFIX:'.html', |
||||
HAS_SOURCE: true |
||||
}; |
||||
</script> |
||||
<script type="text/javascript" src="../_static/jquery.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/underscore.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/doctools.js"> |
||||
|
||||
</script> |
||||
<script type="text/javascript" src="../_static/language_data.js"> |
||||
|
||||
</script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/theme.js"></script> |
||||
|
||||
<script type="text/javascript" |
||||
src="../_static/js/pdj.js"></script> |
||||
|
||||
|
||||
|
||||
<script type="text/javascript"> |
||||
jQuery(function () { |
||||
SphinxRtdTheme.StickyNav.enable(); |
||||
}); |
||||
</script> |
||||
|
||||
|
||||
</body> |
||||
</html> |
File diff suppressed because one or more lines are too long
@ -0,0 +1,123 @@ |
||||
Examples |
||||
============= |
||||
|
||||
Installation/Usage: |
||||
******************* |
||||
|
||||
|
||||
Implementing your own data importer |
||||
*********************************** |
||||
.. 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. |
||||
""" |
||||
|
||||
from .abstract_importer import AbstractImporter |
||||
|
||||
class CSVImporter(AbstractImporter): |
||||
|
||||
def __init__(self, file_path): |
||||
self._df_samples_list = None |
||||
super(CSVImporter, self).__init__(file_path) |
||||
|
||||
def import_data(self): |
||||
self.read_csv_file() |
||||
self._sorter = self.build_sorter(self._df_samples_list[0]) |
||||
self.import_variables() |
||||
self.import_structure() |
||||
self.compute_row_delta_in_all_samples_frames(self._df_samples_list) |
||||
|
||||
def read_csv_file(self): |
||||
df = pd.read_csv(self._file_path) |
||||
df.drop(df.columns[[0]], axis=1, inplace=True) |
||||
self._df_samples_list = [df] |
||||
|
||||
def import_variables(self): |
||||
values_list = [3 for var in self._sorter] |
||||
# initialize dict of lists |
||||
data = {'Name':self._sorter, 'Value':values_list} |
||||
# Create the pandas DataFrame |
||||
self._df_variables = pd.DataFrame(data) |
||||
|
||||
def build_sorter(self, sample_frame: pd.DataFrame) -> typing.List: |
||||
return list(sample_frame.columns)[1:] |
||||
|
||||
def import_structure(self): |
||||
data = {'From':['X','Y','Z'], 'To':['Z','Z','Y']} |
||||
self._df_structure = pd.DataFrame(data) |
||||
|
||||
def dataset_id(self) -> object: |
||||
pass |
||||
|
||||
Parameters Estimation Example |
||||
***************************** |
||||
|
||||
.. code-block:: python |
||||
|
||||
from PyCTBN.PyCTBN.json_importer import JsonImporter |
||||
from PyCTBN.PyCTBN.sample_path import SamplePath |
||||
from PyCTBN.PyCTBN.network_graph import NetworkGraph |
||||
from PyCTBN.PyCTBN.parameters_estimator import ParametersEstimator |
||||
|
||||
|
||||
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') |
||||
importer.import_data(0) |
||||
#Create a SamplePath Obj passing an already filled AbstractImporter object |
||||
s1 = SamplePath(importer) |
||||
#Build The trajectries and the structural infos |
||||
s1.build_trajectories() |
||||
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 |
||||
**************************** |
||||
|
||||
.. code-block:: python |
||||
|
||||
from PyCTBN.PyCTBN.json_importer import JsonImporter |
||||
from PyCTBN.PyCTBN.sample_path import SamplePath |
||||
from PyCTBN.PyCTBN.structure_estimator import StructureEstimator |
||||
|
||||
def structure_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 |
||||
importer.import_data(0) |
||||
# construct a SamplePath Object passing a filled AbstractImporter |
||||
s1 = SamplePath(importer) |
||||
# build the trajectories |
||||
s1.build_trajectories() |
||||
# build the real structure |
||||
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 |
||||
print(se1.adjacency_matrix()) |
||||
# save results to a json file |
||||
se1.save_results() |
||||
|
@ -0,0 +1,7 @@ |
||||
PyCTBN |
||||
====== |
||||
|
||||
.. toctree:: |
||||
:maxdepth: 4 |
||||
|
||||
PyCTBN |
@ -1,48 +0,0 @@ |
||||
abstract\_importer module |
||||
========================= |
||||
|
||||
.. automodule:: abstract_importer |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
||||
|
||||
An example of a simple CSV Importer |
||||
=================================== |
||||
Suppose you have a csv dataset containing only the trajectories, three variables labels and cardinalites. |
||||
Then the resulting importer that inherit and extends AbstractImpoter would be: |
||||
|
||||
.. code_block:: python |
||||
class CSVImporter(AbstractImporter): |
||||
|
||||
def __init__(self, file_path): |
||||
self._df_samples_list = None |
||||
super(CSVImporter, self).__init__(file_path) |
||||
|
||||
def import_data(self): |
||||
self.read_csv_file() |
||||
self._sorter = self.build_sorter(self._df_samples_list[0]) |
||||
self.import_variables() |
||||
self.import_structure() |
||||
self.compute_row_delta_in_all_samples_frames(self._df_samples_list) |
||||
|
||||
def read_csv_file(self): |
||||
df = pd.read_csv(self._file_path) |
||||
df.drop(df.columns[[0]], axis=1, inplace=True) |
||||
self._df_samples_list = [df] |
||||
|
||||
def import_variables(self): |
||||
values_list = [3 for var in self._sorter] |
||||
# initialize dict of lists |
||||
data = {'Name':self._sorter, 'Value':values_list} |
||||
# Create the pandas DataFrame |
||||
self._df_variables = pd.DataFrame(data) |
||||
|
||||
def build_sorter(self, sample_frame: pd.DataFrame) -> typing.List: |
||||
return list(sample_frame.columns)[1:] |
||||
|
||||
def import_structure(self): |
||||
data = {'From':['X','Y','Z'], 'To':['Z','Z','Y']} |
||||
self._df_structure = pd.DataFrame(data) |
||||
|
||||
def dataset_id(self) -> object: |
||||
pass |
@ -1,7 +0,0 @@ |
||||
cache module |
||||
============ |
||||
|
||||
.. automodule:: cache |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
conditional\_intensity\_matrix module |
||||
===================================== |
||||
|
||||
.. automodule:: conditional_intensity_matrix |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
json\_importer module |
||||
===================== |
||||
|
||||
.. automodule:: json_importer |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,17 +0,0 @@ |
||||
scripts |
||||
======= |
||||
|
||||
.. toctree:: |
||||
:maxdepth: 4 |
||||
|
||||
abstract_importer |
||||
cache |
||||
conditional_intensity_matrix |
||||
json_importer |
||||
network_graph |
||||
parameters_estimator |
||||
sample_path |
||||
set_of_cims |
||||
structure |
||||
structure_estimator |
||||
trajectory |
@ -1,7 +0,0 @@ |
||||
network\_graph module |
||||
===================== |
||||
|
||||
.. automodule:: network_graph |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
parameters\_estimator module |
||||
============================ |
||||
|
||||
.. automodule:: parameters_estimator |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
sample\_path module |
||||
=================== |
||||
|
||||
.. automodule:: sample_path |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
set\_of\_cims module |
||||
==================== |
||||
|
||||
.. automodule:: set_of_cims |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
structure module |
||||
================ |
||||
|
||||
.. automodule:: structure |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
structure\_estimator module |
||||
=========================== |
||||
|
||||
.. automodule:: structure_estimator |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -1,7 +0,0 @@ |
||||
trajectory module |
||||
================= |
||||
|
||||
.. automodule:: trajectory |
||||
:members: |
||||
:undoc-members: |
||||
:show-inheritance: |
@ -0,0 +1,42 @@ |
||||
|
||||
import os |
||||
import glob |
||||
|
||||
|
||||
from PyCTBN.PyCTBN.json_importer import JsonImporter |
||||
from PyCTBN.PyCTBN.sample_path import SamplePath |
||||
from PyCTBN.PyCTBN.network_graph import NetworkGraph |
||||
from PyCTBN.PyCTBN.parameters_estimator import ParametersEstimator |
||||
|
||||
|
||||
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') |
||||
importer.import_data(0) |
||||
#Create a SamplePath Obj |
||||
s1 = SamplePath(importer) |
||||
#Build The trajectries and the structural infos |
||||
s1.build_trajectories() |
||||
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) |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
main() |
@ -0,0 +1,30 @@ |
||||
import os |
||||
import glob |
||||
|
||||
from PyCTBN.PyCTBN.json_importer import JsonImporter |
||||
from PyCTBN.PyCTBN.sample_path import SamplePath |
||||
from PyCTBN.PyCTBN.structure_estimator import StructureEstimator |
||||
|
||||
|
||||
def structure_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 |
||||
importer.import_data(0) |
||||
# construct a SamplePath Object passing a filled AbstractImporter |
||||
s1 = SamplePath(importer) |
||||
# build the trajectories |
||||
s1.build_trajectories() |
||||
# build the real structure |
||||
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 |
||||
print(se1.adjacency_matrix()) |
||||
# save results to a json file |
||||
se1.save_results() |
@ -0,0 +1,241 @@ |
||||
<# |
||||
.Synopsis |
||||
Activate a Python virtual environment for the current PowerShell session. |
||||
|
||||
.Description |
||||
Pushes the python executable for a virtual environment to the front of the |
||||
$Env:PATH environment variable and sets the prompt to signify that you are |
||||
in a Python virtual environment. Makes use of the command line switches as |
||||
well as the `pyvenv.cfg` file values present in the virtual environment. |
||||
|
||||
.Parameter VenvDir |
||||
Path to the directory that contains the virtual environment to activate. The |
||||
default value for this is the parent of the directory that the Activate.ps1 |
||||
script is located within. |
||||
|
||||
.Parameter Prompt |
||||
The prompt prefix to display when this virtual environment is activated. By |
||||
default, this prompt is the name of the virtual environment folder (VenvDir) |
||||
surrounded by parentheses and followed by a single space (ie. '(.venv) '). |
||||
|
||||
.Example |
||||
Activate.ps1 |
||||
Activates the Python virtual environment that contains the Activate.ps1 script. |
||||
|
||||
.Example |
||||
Activate.ps1 -Verbose |
||||
Activates the Python virtual environment that contains the Activate.ps1 script, |
||||
and shows extra information about the activation as it executes. |
||||
|
||||
.Example |
||||
Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv |
||||
Activates the Python virtual environment located in the specified location. |
||||
|
||||
.Example |
||||
Activate.ps1 -Prompt "MyPython" |
||||
Activates the Python virtual environment that contains the Activate.ps1 script, |
||||
and prefixes the current prompt with the specified string (surrounded in |
||||
parentheses) while the virtual environment is active. |
||||
|
||||
.Notes |
||||
On Windows, it may be required to enable this Activate.ps1 script by setting the |
||||
execution policy for the user. You can do this by issuing the following PowerShell |
||||
command: |
||||
|
||||
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser |
||||
|
||||
For more information on Execution Policies: |
||||
https://go.microsoft.com/fwlink/?LinkID=135170 |
||||
|
||||
#> |
||||
Param( |
||||
[Parameter(Mandatory = $false)] |
||||
[String] |
||||
$VenvDir, |
||||
[Parameter(Mandatory = $false)] |
||||
[String] |
||||
$Prompt |
||||
) |
||||
|
||||
<# Function declarations --------------------------------------------------- #> |
||||
|
||||
<# |
||||
.Synopsis |
||||
Remove all shell session elements added by the Activate script, including the |
||||
addition of the virtual environment's Python executable from the beginning of |
||||
the PATH variable. |
||||
|
||||
.Parameter NonDestructive |
||||
If present, do not remove this function from the global namespace for the |
||||
session. |
||||
|
||||
#> |
||||
function global:deactivate ([switch]$NonDestructive) { |
||||
# Revert to original values |
||||
|
||||
# The prior prompt: |
||||
if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { |
||||
Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt |
||||
Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT |
||||
} |
||||
|
||||
# The prior PYTHONHOME: |
||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { |
||||
Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME |
||||
Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME |
||||
} |
||||
|
||||
# The prior PATH: |
||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { |
||||
Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH |
||||
Remove-Item -Path Env:_OLD_VIRTUAL_PATH |
||||
} |
||||
|
||||
# Just remove the VIRTUAL_ENV altogether: |
||||
if (Test-Path -Path Env:VIRTUAL_ENV) { |
||||
Remove-Item -Path env:VIRTUAL_ENV |
||||
} |
||||
|
||||
# Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: |
||||
if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { |
||||
Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force |
||||
} |
||||
|
||||
# Leave deactivate function in the global namespace if requested: |
||||
if (-not $NonDestructive) { |
||||
Remove-Item -Path function:deactivate |
||||
} |
||||
} |
||||
|
||||
<# |
||||
.Description |
||||
Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the |
||||
given folder, and returns them in a map. |
||||
|
||||
For each line in the pyvenv.cfg file, if that line can be parsed into exactly |
||||
two strings separated by `=` (with any amount of whitespace surrounding the =) |
||||
then it is considered a `key = value` line. The left hand string is the key, |
||||
the right hand is the value. |
||||
|
||||
If the value starts with a `'` or a `"` then the first and last character is |
||||
stripped from the value before being captured. |
||||
|
||||
.Parameter ConfigDir |
||||
Path to the directory that contains the `pyvenv.cfg` file. |
||||
#> |
||||
function Get-PyVenvConfig( |
||||
[String] |
||||
$ConfigDir |
||||
) { |
||||
Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" |
||||
|
||||
# Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). |
||||
$pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue |
||||
|
||||
# An empty map will be returned if no config file is found. |
||||
$pyvenvConfig = @{ } |
||||
|
||||
if ($pyvenvConfigPath) { |
||||
|
||||
Write-Verbose "File exists, parse `key = value` lines" |
||||
$pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath |
||||
|
||||
$pyvenvConfigContent | ForEach-Object { |
||||
$keyval = $PSItem -split "\s*=\s*", 2 |
||||
if ($keyval[0] -and $keyval[1]) { |
||||
$val = $keyval[1] |
||||
|
||||
# Remove extraneous quotations around a string value. |
||||
if ("'""".Contains($val.Substring(0, 1))) { |
||||
$val = $val.Substring(1, $val.Length - 2) |
||||
} |
||||
|
||||
$pyvenvConfig[$keyval[0]] = $val |
||||
Write-Verbose "Adding Key: '$($keyval[0])'='$val'" |
||||
} |
||||
} |
||||
} |
||||
return $pyvenvConfig |
||||
} |
||||
|
||||
|
||||
<# Begin Activate script --------------------------------------------------- #> |
||||
|
||||
# Determine the containing directory of this script |
||||
$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition |
||||
$VenvExecDir = Get-Item -Path $VenvExecPath |
||||
|
||||
Write-Verbose "Activation script is located in path: '$VenvExecPath'" |
||||
Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" |
||||
Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" |
||||
|
||||
# Set values required in priority: CmdLine, ConfigFile, Default |
||||
# First, get the location of the virtual environment, it might not be |
||||
# VenvExecDir if specified on the command line. |
||||
if ($VenvDir) { |
||||
Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" |
||||
} |
||||
else { |
||||
Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." |
||||
$VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") |
||||
Write-Verbose "VenvDir=$VenvDir" |
||||
} |
||||
|
||||
# Next, read the `pyvenv.cfg` file to determine any required value such |
||||
# as `prompt`. |
||||
$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir |
||||
|
||||
# Next, set the prompt from the command line, or the config file, or |
||||
# just use the name of the virtual environment folder. |
||||
if ($Prompt) { |
||||
Write-Verbose "Prompt specified as argument, using '$Prompt'" |
||||
} |
||||
else { |
||||
Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" |
||||
if ($pyvenvCfg -and $pyvenvCfg['prompt']) { |
||||
Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" |
||||
$Prompt = $pyvenvCfg['prompt']; |
||||
} |
||||
else { |
||||
Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virutal environment)" |
||||
Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" |
||||
$Prompt = Split-Path -Path $venvDir -Leaf |
||||
} |
||||
} |
||||
|
||||
Write-Verbose "Prompt = '$Prompt'" |
||||
Write-Verbose "VenvDir='$VenvDir'" |
||||
|
||||
# Deactivate any currently active virtual environment, but leave the |
||||
# deactivate function in place. |
||||
deactivate -nondestructive |
||||
|
||||
# Now set the environment variable VIRTUAL_ENV, used by many tools to determine |
||||
# that there is an activated venv. |
||||
$env:VIRTUAL_ENV = $VenvDir |
||||
|
||||
if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { |
||||
|
||||
Write-Verbose "Setting prompt to '$Prompt'" |
||||
|
||||
# Set the prompt to include the env name |
||||
# Make sure _OLD_VIRTUAL_PROMPT is global |
||||
function global:_OLD_VIRTUAL_PROMPT { "" } |
||||
Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT |
||||
New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt |
||||
|
||||
function global:prompt { |
||||
Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " |
||||
_OLD_VIRTUAL_PROMPT |
||||
} |
||||
} |
||||
|
||||
# Clear PYTHONHOME |
||||
if (Test-Path -Path Env:PYTHONHOME) { |
||||
Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME |
||||
Remove-Item -Path Env:PYTHONHOME |
||||
} |
||||
|
||||
# Add the venv to the PATH |
||||
Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH |
||||
$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" |
@ -0,0 +1,66 @@ |
||||
# This file must be used with "source bin/activate" *from bash* |
||||
# you cannot run it directly |
||||
|
||||
deactivate () { |
||||
# reset old environment variables |
||||
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then |
||||
PATH="${_OLD_VIRTUAL_PATH:-}" |
||||
export PATH |
||||
unset _OLD_VIRTUAL_PATH |
||||
fi |
||||
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then |
||||
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" |
||||
export PYTHONHOME |
||||
unset _OLD_VIRTUAL_PYTHONHOME |
||||
fi |
||||
|
||||
# This should detect bash and zsh, which have a hash command that must |
||||
# be called to get it to forget past commands. Without forgetting |
||||
# past commands the $PATH changes we made may not be respected |
||||
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then |
||||
hash -r 2> /dev/null |
||||
fi |
||||
|
||||
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then |
||||
PS1="${_OLD_VIRTUAL_PS1:-}" |
||||
export PS1 |
||||
unset _OLD_VIRTUAL_PS1 |
||||
fi |
||||
|
||||
unset VIRTUAL_ENV |
||||
if [ ! "${1:-}" = "nondestructive" ] ; then |
||||
# Self destruct! |
||||
unset -f deactivate |
||||
fi |
||||
} |
||||
|
||||
# unset irrelevant variables |
||||
deactivate nondestructive |
||||
|
||||
VIRTUAL_ENV="/Users/Zalum/Desktop/Tesi/PyCTBN/venv" |
||||
export VIRTUAL_ENV |
||||
|
||||
_OLD_VIRTUAL_PATH="$PATH" |
||||
PATH="$VIRTUAL_ENV/bin:$PATH" |
||||
export PATH |
||||
|
||||
# unset PYTHONHOME if set |
||||
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) |
||||
# could use `if (set -u; : $PYTHONHOME) ;` in bash |
||||
if [ -n "${PYTHONHOME:-}" ] ; then |
||||
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" |
||||
unset PYTHONHOME |
||||
fi |
||||
|
||||
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then |
||||
_OLD_VIRTUAL_PS1="${PS1:-}" |
||||
PS1="(venv) ${PS1:-}" |
||||
export PS1 |
||||
fi |
||||
|
||||
# This should detect bash and zsh, which have a hash command that must |
||||
# be called to get it to forget past commands. Without forgetting |
||||
# past commands the $PATH changes we made may not be respected |
||||
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then |
||||
hash -r 2> /dev/null |
||||
fi |
@ -0,0 +1,25 @@ |
||||
# This file must be used with "source bin/activate.csh" *from csh*. |
||||
# You cannot run it directly. |
||||
# Created by Davide Di Blasi <davidedb@gmail.com>. |
||||
# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com> |
||||
|
||||
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; test "\!:*" != "nondestructive" && unalias deactivate' |
||||
|
||||
# Unset irrelevant variables. |
||||
deactivate nondestructive |
||||
|
||||
setenv VIRTUAL_ENV "/Users/Zalum/Desktop/Tesi/PyCTBN/venv" |
||||
|
||||
set _OLD_VIRTUAL_PATH="$PATH" |
||||
setenv PATH "$VIRTUAL_ENV/bin:$PATH" |
||||
|
||||
|
||||
set _OLD_VIRTUAL_PROMPT="$prompt" |
||||
|
||||
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then |
||||
set prompt = "(venv) $prompt" |
||||
endif |
||||
|
||||
alias pydoc python -m pydoc |
||||
|
||||
rehash |
@ -0,0 +1,64 @@ |
||||
# This file must be used with "source <venv>/bin/activate.fish" *from fish* |
||||
# (https://fishshell.com/); you cannot run it directly. |
||||
|
||||
function deactivate -d "Exit virtual environment and return to normal shell environment" |
||||
# reset old environment variables |
||||
if test -n "$_OLD_VIRTUAL_PATH" |
||||
set -gx PATH $_OLD_VIRTUAL_PATH |
||||
set -e _OLD_VIRTUAL_PATH |
||||
end |
||||
if test -n "$_OLD_VIRTUAL_PYTHONHOME" |
||||
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME |
||||
set -e _OLD_VIRTUAL_PYTHONHOME |
||||
end |
||||
|
||||
if test -n "$_OLD_FISH_PROMPT_OVERRIDE" |
||||
functions -e fish_prompt |
||||
set -e _OLD_FISH_PROMPT_OVERRIDE |
||||
functions -c _old_fish_prompt fish_prompt |
||||
functions -e _old_fish_prompt |
||||
end |
||||
|
||||
set -e VIRTUAL_ENV |
||||
if test "$argv[1]" != "nondestructive" |
||||
# Self-destruct! |
||||
functions -e deactivate |
||||
end |
||||
end |
||||
|
||||
# Unset irrelevant variables. |
||||
deactivate nondestructive |
||||
|
||||
set -gx VIRTUAL_ENV "/Users/Zalum/Desktop/Tesi/PyCTBN/venv" |
||||
|
||||
set -gx _OLD_VIRTUAL_PATH $PATH |
||||
set -gx PATH "$VIRTUAL_ENV/bin" $PATH |
||||
|
||||
# Unset PYTHONHOME if set. |
||||
if set -q PYTHONHOME |
||||
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME |
||||
set -e PYTHONHOME |
||||
end |
||||
|
||||
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" |
||||
# fish uses a function instead of an env var to generate the prompt. |
||||
|
||||
# Save the current fish_prompt function as the function _old_fish_prompt. |
||||
functions -c fish_prompt _old_fish_prompt |
||||
|
||||
# With the original prompt function renamed, we can override with our own. |
||||
function fish_prompt |
||||
# Save the return status of the last command. |
||||
set -l old_status $status |
||||
|
||||
# Output the venv prompt; color taken from the blue of the Python logo. |
||||
printf "%s%s%s" (set_color 4B8BBE) "(venv) " (set_color normal) |
||||
|
||||
# Restore the return status of the previous command. |
||||
echo "exit $old_status" | . |
||||
# Output the original/"old" prompt. |
||||
_old_fish_prompt |
||||
end |
||||
|
||||
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" |
||||
end |
@ -0,0 +1,8 @@ |
||||
#!/Users/Zalum/Desktop/Tesi/PyCTBN/venv/bin/python |
||||
# -*- coding: utf-8 -*- |
||||
import re |
||||
import sys |
||||
from setuptools.command.easy_install import main |
||||
if __name__ == '__main__': |
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
||||
sys.exit(main()) |
@ -0,0 +1,8 @@ |
||||
#!/Users/Zalum/Desktop/Tesi/PyCTBN/venv/bin/python |
||||
# -*- coding: utf-8 -*- |
||||
import re |
||||
import sys |
||||
from setuptools.command.easy_install import main |
||||
if __name__ == '__main__': |
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
||||
sys.exit(main()) |
@ -0,0 +1,8 @@ |
||||
#!/Users/Zalum/Desktop/Tesi/PyCTBN/venv/bin/python |
||||
# -*- coding: utf-8 -*- |
||||
import re |
||||
import sys |
||||
from numpy.f2py.f2py2e import main |
||||
if __name__ == '__main__': |
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
||||
sys.exit(main()) |
@ -0,0 +1,8 @@ |
||||
#!/Users/Zalum/Desktop/Tesi/PyCTBN/venv/bin/python |
||||
# -*- coding: utf-8 -*- |
||||
import re |
||||
import sys |
||||
from numpy.f2py.f2py2e import main |
||||
if __name__ == '__main__': |
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
||||
sys.exit(main()) |
@ -0,0 +1,8 @@ |
||||
#!/Users/Zalum/Desktop/Tesi/PyCTBN/venv/bin/python |
||||
# -*- coding: utf-8 -*- |
||||
import re |
||||
import sys |
||||
from numpy.f2py.f2py2e import main |
||||
if __name__ == '__main__': |
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
||||
sys.exit(main()) |
@ -0,0 +1,8 @@ |
||||
#!/Users/Zalum/Desktop/Tesi/PyCTBN/venv/bin/python |
||||
# -*- coding: utf-8 -*- |
||||
import re |
||||
import sys |
||||
from pip._internal.cli.main import main |
||||
if __name__ == '__main__': |
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
||||
sys.exit(main()) |
@ -0,0 +1,8 @@ |
||||
#!/Users/Zalum/Desktop/Tesi/PyCTBN/venv/bin/python |
||||
# -*- coding: utf-8 -*- |
||||
import re |
||||
import sys |
||||
from pip._internal.cli.main import main |
||||
if __name__ == '__main__': |
||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) |
||||
sys.exit(main()) |
Some files were not shown because too many files have changed in this diff Show More
Reference in new issue