<liclass="toctree-l2"><aclass="reference internal"href="examples.html#implementing-your-own-data-importer">Implementing your own data importer</a></li>
<h1>PyCTBN.PyCTBN.structure_graph package<aclass="headerlink"href="#pyctbn-pyctbn-structure-graph-package"title="Permalink to this headline">¶</a></h1>
<spanid="pyctbn-pyctbn-structure-graph-conditional-intensity-matrix-module"></span><h2>PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix module<aclass="headerlink"href="#module-PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix"title="Permalink to this headline">¶</a></h2>
<emclass="property">class </em><codeclass="sig-prename descclassname">PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix.</code><codeclass="sig-name descname">ConditionalIntensityMatrix</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">state_residence_times</span><spanclass="p">:</span><spanclass="n">numpy.array</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">state_transition_matrix</span><spanclass="p">:</span><spanclass="n">numpy.array</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">cim</span><spanclass="p">:</span><spanclass="n">numpy.array</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix.ConditionalIntensityMatrix"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">cim</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix.ConditionalIntensityMatrix.cim"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">compute_cim_coefficients</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix.ConditionalIntensityMatrix.compute_cim_coefficients"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">state_residence_times</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix.ConditionalIntensityMatrix.state_residence_times"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">state_transition_matrix</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.conditional_intensity_matrix.ConditionalIntensityMatrix.state_transition_matrix"title="Permalink to this definition">¶</a></dt>
<spanid="pyctbn-pyctbn-structure-graph-network-generator-module"></span><h2>PyCTBN.PyCTBN.structure_graph.network_generator module<aclass="headerlink"href="#module-PyCTBN.PyCTBN.structure_graph.network_generator"title="Permalink to this headline">¶</a></h2>
<emclass="property">class </em><codeclass="sig-prename descclassname">PyCTBN.PyCTBN.structure_graph.network_generator.</code><codeclass="sig-name descname">NetworkGenerator</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">labels</span></em>, <emclass="sig-param"><spanclass="n">vals</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_generator.NetworkGenerator"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">cims</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_generator.NetworkGenerator.cims"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">dyn_str</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_generator.NetworkGenerator.dyn_str"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">generate_cims</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">min_val</span></em>, <emclass="sig-param"><spanclass="n">max_val</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_generator.NetworkGenerator.generate_cims"title="Permalink to this definition">¶</a></dt>
<dt>For each node, generate the corresponding SetOfCims. The objective is to group the CIMs </dt><dd><p>(actually generated by private method __generate_cim) according to parents possibles states of every node.
This method must obviously be executed after the graph has been generated.</p>
</dd>
</dl>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>min_val</strong> (<em>float</em>) – Minimum value allowed for the coefficients in the CIMs</p></li>
<li><p><strong>max_val</strong> (<em>float</em>) – Maximum value allowed for the coefficients in the CIMs</p></li>
<codeclass="sig-name descname">generate_graph</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">density</span></em>, <emclass="sig-param"><spanclass="n">fixed</span><spanclass="p">:</span><spanclass="n">bool</span><spanclass="o">=</span><spanclass="default_value">False</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_generator.NetworkGenerator.generate_graph"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">graph</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_generator.NetworkGenerator.graph"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">variables</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_generator.NetworkGenerator.variables"title="Permalink to this definition">¶</a></dt>
<spanid="pyctbn-pyctbn-structure-graph-network-graph-module"></span><h2>PyCTBN.PyCTBN.structure_graph.network_graph module<aclass="headerlink"href="#module-PyCTBN.PyCTBN.structure_graph.network_graph"title="Permalink to this headline">¶</a></h2>
<emclass="property">class </em><codeclass="sig-prename descclassname">PyCTBN.PyCTBN.structure_graph.network_graph.</code><codeclass="sig-name descname">NetworkGraph</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">graph_struct</span><spanclass="p">:</span><spanclass="n"><aclass="reference internal"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure"title="PyCTBN.PyCTBN.structure_graph.structure.Structure">PyCTBN.PyCTBN.structure_graph.structure.Structure</a></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph"title="Permalink to this definition">¶</a></dt>
<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>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>graph_struct</strong> (<aclass="reference internal"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure"title="PyCTBN.PyCTBN.structure_graph.structure.Structure"><em>Structure</em></a>) – the <codeclass="docutils literal notranslate"><spanclass="pre">Structure</span></code> object from which infos about the net will be extracted</p>
<codeclass="sig-name descname">add_edges</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">list_of_edges</span><spanclass="p">:</span><spanclass="n">List</span></em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.add_edges"title="Permalink to this definition">¶</a></dt>
<dd><p>Add the edges to the <codeclass="docutils literal notranslate"><spanclass="pre">_graph</span></code> contained in the list <codeclass="docutils literal notranslate"><spanclass="pre">list_of_edges</span></code>.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>list_of_edges</strong> (<em>List</em>) – the list containing of tuples containing the edges</p>
<codeclass="sig-name descname">add_nodes</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">list_of_nodes</span><spanclass="p">:</span><spanclass="n">List</span></em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.add_nodes"title="Permalink to this definition">¶</a></dt>
<dd><p>Adds the nodes to the <codeclass="docutils literal notranslate"><spanclass="pre">_graph</span></code> contained in the list of nodes <codeclass="docutils literal notranslate"><spanclass="pre">list_of_nodes</span></code>.
Sets all the properties that identify a nodes (index, positional index, cardinality)</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>list_of_nodes</strong> (<em>List</em>) – the nodes to add to <codeclass="docutils literal notranslate"><spanclass="pre">_graph</span></code></p>
<emclass="property">static </em><codeclass="sig-name descname">build_p_comb_structure_for_a_node</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">parents_values</span><spanclass="p">:</span><spanclass="n">List</span></em><spanclass="sig-paren">)</span>→ numpy.ndarray<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.build_p_comb_structure_for_a_node"title="Permalink to this definition">¶</a></dt>
<emclass="property">static </em><codeclass="sig-name descname">build_time_columns_filtering_for_a_node</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node_indx</span><spanclass="p">:</span><spanclass="n">int</span></em>, <emclass="sig-param"><spanclass="n">p_indxs</span><spanclass="p">:</span><spanclass="n">List</span></em><spanclass="sig-paren">)</span>→ numpy.ndarray<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.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 <codeclass="docutils literal notranslate"><spanclass="pre">node_indx</span></code> and <codeclass="docutils literal notranslate"><spanclass="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
<emclass="property">static </em><codeclass="sig-name descname">build_time_scalar_indexing_structure_for_a_node</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node_states</span><spanclass="p">:</span><spanclass="n">int</span></em>, <emclass="sig-param"><spanclass="n">parents_vals</span><spanclass="p">:</span><spanclass="n">List</span></em><spanclass="sig-paren">)</span>→ numpy.ndarray<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.build_time_scalar_indexing_structure_for_a_node"title="Permalink to this definition">¶</a></dt>
<emclass="property">static </em><codeclass="sig-name descname">build_transition_filtering_for_a_node</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node_indx</span><spanclass="p">:</span><spanclass="n">int</span></em>, <emclass="sig-param"><spanclass="n">p_indxs</span><spanclass="p">:</span><spanclass="n">List</span></em>, <emclass="sig-param"><spanclass="n">nodes_number</span><spanclass="p">:</span><spanclass="n">int</span></em><spanclass="sig-paren">)</span>→ numpy.ndarray<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.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 <codeclass="docutils literal notranslate"><spanclass="pre">node_indx</span></code> and <codeclass="docutils literal notranslate"><spanclass="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
:param nodes_number: the total number of nodes in the dataset
:type nodes_number: int
:return: The filtering structure for transitions estimation
<emclass="property">static </em><codeclass="sig-name descname">build_transition_scalar_indexing_structure_for_a_node</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node_states_number</span><spanclass="p">:</span><spanclass="n">int</span></em>, <emclass="sig-param"><spanclass="n">parents_vals</span><spanclass="p">:</span><spanclass="n">List</span></em><spanclass="sig-paren">)</span>→ numpy.ndarray<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.build_transition_scalar_indexing_structure_for_a_node"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">clear_indexing_filtering_structures</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.clear_indexing_filtering_structures"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">edges</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.edges"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">fast_init</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node_id</span><spanclass="p">:</span><spanclass="n">str</span></em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.fast_init"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">get_node_indx</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node_id</span></em><spanclass="sig-paren">)</span>→ int<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.get_node_indx"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">get_ordered_by_indx_set_of_parents</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node</span><spanclass="p">:</span><spanclass="n">str</span></em><spanclass="sig-paren">)</span>→ Tuple<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.get_ordered_by_indx_set_of_parents"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">get_parents_by_id</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node_id</span></em><spanclass="sig-paren">)</span>→ List<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.get_parents_by_id"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">get_positional_node_indx</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node_id</span></em><spanclass="sig-paren">)</span>→ int<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.get_positional_node_indx"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">get_states_number</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node_id</span></em><spanclass="sig-paren">)</span>→ int<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.get_states_number"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">has_edge</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">edge</span><spanclass="p">:</span><spanclass="n">tuple</span></em><spanclass="sig-paren">)</span>→ bool<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.has_edge"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">nodes</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.nodes"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">nodes_indexes</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.nodes_indexes"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">nodes_values</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.nodes_values"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">p_combs</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.p_combs"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">remove_edges</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">list_of_edges</span><spanclass="p">:</span><spanclass="n">List</span></em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.remove_edges"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">remove_node</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node_id</span><spanclass="p">:</span><spanclass="n">str</span></em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.remove_node"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">time_filtering</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.time_filtering"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">time_scalar_indexing_strucure</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.time_scalar_indexing_strucure"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">transition_filtering</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.transition_filtering"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">transition_scalar_indexing_structure</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.network_graph.NetworkGraph.transition_scalar_indexing_structure"title="Permalink to this definition">¶</a></dt>
<spanid="pyctbn-pyctbn-structure-graph-sample-path-module"></span><h2>PyCTBN.PyCTBN.structure_graph.sample_path module<aclass="headerlink"href="#module-PyCTBN.PyCTBN.structure_graph.sample_path"title="Permalink to this headline">¶</a></h2>
<emclass="property">class </em><codeclass="sig-prename descclassname">PyCTBN.PyCTBN.structure_graph.sample_path.</code><codeclass="sig-name descname">SamplePath</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">importer</span><spanclass="p">:</span><spanclass="n"><aclass="reference internal"href="PyCTBN.PyCTBN.utility.html#PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter"title="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter">PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter</a></span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.sample_path.SamplePath"title="Permalink to this definition">¶</a></dt>
<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 <codeclass="docutils literal notranslate"><spanclass="pre">Trajectory</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">Structure</span></code> that will
contain the mentioned data.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>importer</strong> (<aclass="reference internal"href="PyCTBN.PyCTBN.utility.html#PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter"title="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter"><em>AbstractImporter</em></a>) – the Importer object which contains the imported and processed data</p>
</dd>
<dtclass="field-even">_trajectories</dt>
<ddclass="field-even"><p>the <codeclass="docutils literal notranslate"><spanclass="pre">Trajectory</span></code> object that will contain all the concatenated trajectories</p>
</dd>
<dtclass="field-odd">_structure</dt>
<ddclass="field-odd"><p>the <codeclass="docutils literal notranslate"><spanclass="pre">Structure</span></code> Object that will contain all the structural infos about the net</p>
</dd>
<dtclass="field-even">_total_variables_count</dt>
<ddclass="field-even"><p>the number of variables in the net</p>
<codeclass="sig-name descname">build_structure</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.sample_path.SamplePath.build_structure"title="Permalink to this definition">¶</a></dt>
<dd><p>Builds the <codeclass="docutils literal notranslate"><spanclass="pre">Structure</span></code> object that aggregates all the infos about the net.</p>
<codeclass="sig-name descname">build_trajectories</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.sample_path.SamplePath.build_trajectories"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">clear_memory</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.sample_path.SamplePath.clear_memory"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">has_prior_net_structure</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.sample_path.SamplePath.has_prior_net_structure"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">structure</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.sample_path.SamplePath.structure"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">total_variables_count</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.sample_path.SamplePath.total_variables_count"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">trajectories</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.sample_path.SamplePath.trajectories"title="Permalink to this definition">¶</a></dt>
<spanid="pyctbn-pyctbn-structure-graph-set-of-cims-module"></span><h2>PyCTBN.PyCTBN.structure_graph.set_of_cims module<aclass="headerlink"href="#module-PyCTBN.PyCTBN.structure_graph.set_of_cims"title="Permalink to this headline">¶</a></h2>
<emclass="property">property </em><codeclass="sig-name descname">actual_cims</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims.actual_cims"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">build_cims</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">state_res_times</span><spanclass="p">:</span><spanclass="n">numpy.ndarray</span></em>, <emclass="sig-param"><spanclass="n">transition_matrices</span><spanclass="p">:</span><spanclass="n">numpy.ndarray</span></em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims.build_cims"title="Permalink to this definition">¶</a></dt>
<dd><p>Build the <codeclass="docutils literal notranslate"><spanclass="pre">ConditionalIntensityMatrix</span></code> objects given the state residence times and transitions matrices.
Compute the cim coefficients.The class member <codeclass="docutils literal notranslate"><spanclass="pre">_actual_cims</span></code> will contain the computed cims.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="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>
<codeclass="sig-name descname">build_times_and_transitions_structures</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims.build_times_and_transitions_structures"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">filter_cims_with_mask</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">mask_arr</span><spanclass="p">:</span><spanclass="n">numpy.ndarray</span></em>, <emclass="sig-param"><spanclass="n">comb</span><spanclass="p">:</span><spanclass="n">List</span></em><spanclass="sig-paren">)</span>→ numpy.ndarray<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims.filter_cims_with_mask"title="Permalink to this definition">¶</a></dt>
<dd><p>Filter the cims contained in the array <codeclass="docutils literal notranslate"><spanclass="pre">_actual_cims</span></code> given the boolean mask <codeclass="docutils literal notranslate"><spanclass="pre">mask_arr</span></code> and the index
<codeclass="sig-name descname">get_cims_number</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims.get_cims_number"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">p_combs</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims.p_combs"title="Permalink to this definition">¶</a></dt>
<spanid="pyctbn-pyctbn-structure-graph-structure-module"></span><h2>PyCTBN.PyCTBN.structure_graph.structure module<aclass="headerlink"href="#module-PyCTBN.PyCTBN.structure_graph.structure"title="Permalink to this headline">¶</a></h2>
<codeclass="sig-name descname">add_edge</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">edge</span><spanclass="p">:</span><spanclass="n">tuple</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure.add_edge"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">clean_structure_edges</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure.clean_structure_edges"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">contains_edge</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">edge</span><spanclass="p">:</span><spanclass="n">tuple</span></em><spanclass="sig-paren">)</span>→ bool<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure.contains_edge"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">edges</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure.edges"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">get_node_id</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node_indx</span><spanclass="p">:</span><spanclass="n">int</span></em><spanclass="sig-paren">)</span>→ str<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure.get_node_id"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">get_node_indx</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node_id</span><spanclass="p">:</span><spanclass="n">str</span></em><spanclass="sig-paren">)</span>→ int<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure.get_node_indx"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">get_positional_node_indx</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node_id</span><spanclass="p">:</span><spanclass="n">str</span></em><spanclass="sig-paren">)</span>→ int<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure.get_positional_node_indx"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">get_states_number</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node</span><spanclass="p">:</span><spanclass="n">str</span></em><spanclass="sig-paren">)</span>→ int<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure.get_states_number"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">nodes_indexes</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure.nodes_indexes"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">nodes_labels</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure.nodes_labels"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">nodes_values</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure.nodes_values"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">remove_edge</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">edge</span><spanclass="p">:</span><spanclass="n">tuple</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure.remove_edge"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">remove_node</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">node_id</span><spanclass="p">:</span><spanclass="n">str</span></em><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure.remove_node"title="Permalink to this definition">¶</a></dt>
<dd><p>Remove the node <codeclass="docutils literal notranslate"><spanclass="pre">node_id</span></code> from all the class members.
The class member <codeclass="docutils literal notranslate"><spanclass="pre">_total_variables_number</span></code> since it refers to the total number of variables in the dataset.</p>
<emclass="property">property </em><codeclass="sig-name descname">total_variables_number</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.structure.Structure.total_variables_number"title="Permalink to this definition">¶</a></dt>
<spanid="pyctbn-pyctbn-structure-graph-trajectory-module"></span><h2>PyCTBN.PyCTBN.structure_graph.trajectory module<aclass="headerlink"href="#module-PyCTBN.PyCTBN.structure_graph.trajectory"title="Permalink to this headline">¶</a></h2>
<emclass="property">class </em><codeclass="sig-prename descclassname">PyCTBN.PyCTBN.structure_graph.trajectory.</code><codeclass="sig-name descname">Trajectory</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">list_of_columns</span><spanclass="p">:</span><spanclass="n">List</span></em>, <emclass="sig-param"><spanclass="n">original_cols_number</span><spanclass="p">:</span><spanclass="n">int</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.trajectory.Trajectory"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">complete_trajectory</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.trajectory.Trajectory.complete_trajectory"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">size</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.trajectory.Trajectory.size"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">times</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.trajectory.Trajectory.times"title="Permalink to this definition">¶</a></dt>
<emclass="property">property </em><codeclass="sig-name descname">trajectory</code><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.trajectory.Trajectory.trajectory"title="Permalink to this definition">¶</a></dt>
<spanid="pyctbn-pyctbn-structure-graph-trajectory-generator-module"></span><h2>PyCTBN.PyCTBN.structure_graph.trajectory_generator module<aclass="headerlink"href="#module-PyCTBN.PyCTBN.structure_graph.trajectory_generator"title="Permalink to this headline">¶</a></h2>
<p>Provides the methods to generate a trajectory basing on the network defined
in the importer.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>_importer</strong> (<aclass="reference internal"href="PyCTBN.PyCTBN.utility.html#PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter"title="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter"><em>AbstractImporter</em></a>) – the Importer object which contains the imported and processed data</p></li>
<li><p><strong>_vnames</strong> (<em>List</em>) – List of the variables labels that belong to the network</p></li>
<li><p><strong>_parents</strong> (<em>Dict</em>) – It contains, for each variable label (the key), the list of related parents labels</p></li>
<li><p><strong>_cims</strong> (<em>Dict</em>) – It contains, for each variable label (the key), the SetOfCims object related to it</p></li>
<li><p><strong>_generated_trajectory</strong> (<em>pandas.DataFrame</em>) – Result of the execution of CTBN_Sample, contains the output trajectory</p></li>
<codeclass="sig-name descname">CTBN_Sample</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">t_end</span><spanclass="o">=</span><spanclass="default_value">- 1</span></em>, <emclass="sig-param"><spanclass="n">max_tr</span><spanclass="o">=</span><spanclass="default_value">- 1</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.trajectory_generator.TrajectoryGenerator.CTBN_Sample"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="simple">
<dt>This method implements the generation of a trajectory, basing on the network structure and</dt><dd><p>on the coefficients defined in the CIMs.
The variables are initialized with value 0, and the method takes care of adding the
conventional last row made up of -1.</p>
</dd>
</dl>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>t_end</strong> (<em>float</em>) – If defined, the sampling ends when end time is reached</p></li>
<li><p><strong>max_tr</strong> (<em>int</em>) – Parameter taken in consideration in case that t_end isn’t defined. It specifies the number of transitions to execute</p></li>
<codeclass="sig-name descname">multi_trajectory</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">t_ends</span><spanclass="p">:</span><spanclass="n">list</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">max_trs</span><spanclass="p">:</span><spanclass="n">list</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.trajectory_generator.TrajectoryGenerator.multi_trajectory"title="Permalink to this definition">¶</a></dt>
<dd><p>Generate n trajectories in parallel, where n is the number of items in
t_ends, if defined, or the number of items in max_trs otherwise</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>t_ends</strong> (<em>list</em>) – List of t_end values for the trajectories that will be generated</p></li>
<li><p><strong>max_trs</strong> (<em>list</em>) – List of max_tr values for the trajectories that will be generated</p></li>
<codeclass="sig-name descname">worker</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">t_end</span></em>, <emclass="sig-param"><spanclass="n">max_tr</span></em>, <emclass="sig-param"><spanclass="n">trajectories</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#PyCTBN.PyCTBN.structure_graph.trajectory_generator.TrajectoryGenerator.worker"title="Permalink to this definition">¶</a></dt>
<dd><p>Single process that will be executed in parallel in order to generate one trajectory.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>t_end</strong> (<em>float</em>) – If defined, the sampling ends when end time is reached</p></li>
<li><p><strong>max_tr</strong> (<em>int</em>) – Parameter taken in consideration in case that t_end isn’t defined. It specifies the number of transitions to execute</p></li>
<li><p><strong>trajectories</strong> (<em>list</em>) – Shared list that contains to which the generated trajectory is added</p></li>
<spanid="module-contents"></span><h2>Module contents<aclass="headerlink"href="#module-PyCTBN.PyCTBN.structure_graph"title="Permalink to this headline">¶</a></h2>
Built with <ahref="http://sphinx-doc.org/">Sphinx</a> using a <ahref="https://github.com/jucacrispim/sphinx_pdj_theme">theme</a> provided by <ahref="http://poraodojuca.net">Porão do Juca</a>.