<spanid="classes-abstract-importer-module"></span><h2>classes.abstract_importer module<aclass="headerlink"href="#module-classes.abstract_importer"title="Permalink to this headline">¶</a></h2>
<emclass="property">class </em><codeclass="sig-prename descclassname">classes.abstract_importer.</code><codeclass="sig-name descname">AbstractImporter</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">file_path</span><spanclass="p">:</span><spanclass="n">str</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#classes.abstract_importer.AbstractImporter"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">classes.abstract_importer.</code><codeclass="sig-name descname">AbstractImporter</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">file_path</span><spanclass="p">:</span><spanclass="n">str</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">concatenated_samples</span><spanclass="p">:</span><spanclass="n">Union<spanclass="p">[</span>pandas.core.frame.DataFrame<spanclass="p">, </span>numpy.ndarray<spanclass="p">]</span></span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">variables</span><spanclass="p">:</span><spanclass="n">pandas.core.frame.DataFrame</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">prior_net_structure</span><spanclass="p">:</span><spanclass="n">pandas.core.frame.DataFrame</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#classes.abstract_importer.AbstractImporter"title="Permalink to this definition">¶</a></dt>
<p>Abstract class that exposes all the necessary methods to process the trajectories and the net structure.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>file_path</strong> (<em>str</em>) – the file path</p>
</dd>
<dtclass="field-even">_concatenated_samples</dt>
<ddclass="field-even"><p>Dataframe containing the concatenation of all the processed trajectories</p>
</dd>
<dtclass="field-odd">_df_structure</dt>
<ddclass="field-odd"><p>Dataframe containing the structure of the network (edges)</p>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>file_path</strong> (<em>str</em>) – the file path, or dataset name if you import already processed data</p></li>
<li><p><strong>concatenated_samples</strong> (<em>typing.Union</em><em>[</em><em>pandas.DataFrame</em><em>, </em><em>numpy.ndarray</em><em>]</em>) – Dataframe or numpy array containing the concatenation of all the processed trajectories</p></li>
<li><p><strong>variables</strong> (<em>pandas.DataFrame</em>) – Dataframe containing the nodes labels and cardinalities</p></li>
</ul>
</dd>
<dtclass="field-even">_df_variables</dt>
<ddclass="field-even"><p>Dataframe containing the nodes cardinalities</p>
<dtclass="field-even">Prior_net_structure</dt>
<ddclass="field-even"><p>Dataframe containing the structure of the network (edges)</p>
</dd>
<dtclass="field-odd">_sorter</dt>
<ddclass="field-odd"><p>A list containing the columns header (excluding the time column) of the<codeclass="docutils literal notranslate"><spanclass="pre">_concatenated_samples</span></code></p>
<ddclass="field-odd"><p>A list containing the variables labels in the SAME order as the columns in<codeclass="docutils literal notranslate"><spanclass="pre">concatenated_samples</span></code></p>
</dd>
</dl>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>The class members <codeclass="docutils literal notranslate"><spanclass="pre">_df_variables</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">_df_structure</span></code> HAVE to be properly constructed
<p>The parameters <codeclass="docutils literal notranslate"><spanclass="pre">variables</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">prior_net_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>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>If you don’t have prior network structure just leave <codeclass="docutils literal notranslate"><spanclass="pre">_df_structure</span></code> set to None.</p>
Header of _df_variables = [Variable_Label | Variable_Cardinality]
See the tutorial on how to construct a correct <codeclass="docutils literal notranslate"><spanclass="pre">concatenated_samples</span></code> Dataframe/ndarray.</p>
<codeclass="sig-name descname">build_list_of_samples_array</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">data_frame</span><spanclass="p">:</span><spanclass="n">pandas.core.frame.DataFrame</span></em><spanclass="sig-paren">)</span>→ List<aclass="headerlink"href="#classes.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>
<codeclass="sig-name descname">build_list_of_samples_array</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">concatenated_sample</span><spanclass="p">:</span><spanclass="n">Union<spanclass="p">[</span>pandas.core.frame.DataFrame<spanclass="p">, </span>numpy.ndarray<spanclass="p">]</span></span></em><spanclass="sig-paren">)</span>→ List<aclass="headerlink"href="#classes.abstract_importer.AbstractImporter.build_list_of_samples_array"title="Permalink to this definition">¶</a></dt>
<dd><p>Builds a List containing the the delta times numpy array, and the complete transitions matrix</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>data_frame</strong> (<em>pandas.Dataframe</em>) – the dataframe from which the columns have to be extracted and converted</p>
<ddclass="field-odd"><p><strong>concatenated_sample</strong> (<em>typing.Union</em><em>[</em><em>pandas.Dataframe</em><em>, </em><em>numpy.ndarray</em><em>]</em>) – the dataframe/array from which the time, and transitions matrix have to be extracted
and converted</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>the resulting list of numpy arrays</p>
@ -981,6 +977,11 @@ contain the mentioned data.</p>
Clears all the unused dataframes in <codeclass="docutils literal notranslate"><spanclass="pre">_importer</span></code> Object</p>
<emclass="property">property </em><codeclass="sig-name descname">has_prior_net_structure</code><aclass="headerlink"href="#classes.sample_path.SamplePath.has_prior_net_structure"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="py method">
<dtid="classes.sample_path.SamplePath.structure">
<emclass="property">property </em><codeclass="sig-name descname">structure</code><aclass="headerlink"href="#classes.sample_path.SamplePath.structure"title="Permalink to this definition">¶</a></dt>
@ -1228,7 +1229,7 @@ The class member <code class="docutils literal notranslate"><span class="pre">_t
<codeclass="sig-name descname">adjacency_matrix</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ numpy.ndarray<aclass="headerlink"href="#classes.structure_estimator.StructureEstimator.adjacency_matrix"title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the estimated structrure <codeclass="docutils literal notranslate"><spanclass="pre">_complete_graph</span></code> to a boolean adjacency matrix representation.</p>
<dd><p>Converts the estimated structure <codeclass="docutils literal notranslate"><spanclass="pre">_complete_graph</span></code> to a boolean adjacency matrix representation.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The adjacency matrix of the graph <codeclass="docutils literal notranslate"><spanclass="pre">_complete_graph</span></code></p>
@ -1343,6 +1344,13 @@ it is performed also the chi_test.</p>
<codeclass="sig-name descname">save_plot_estimated_structure_graph</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#classes.structure_estimator.StructureEstimator.save_plot_estimated_structure_graph"title="Permalink to this definition">¶</a></dt>
<dd><p>Plot the estimated structure in a graphical model style.
<codeclass="sig-name descname">save_results</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#classes.structure_estimator.StructureEstimator.save_results"title="Permalink to this definition">¶</a></dt>
@ -1350,6 +1358,23 @@ it is performed also the chi_test.</p>
The file is named as the input dataset but the <cite>results_</cite> word is appended to the results file.</p>
<codeclass="sig-name descname">spurious_edges</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ List<aclass="headerlink"href="#classes.structure_estimator.StructureEstimator.spurious_edges"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="simple">
<dt>Return the spurious edges present in the estimated structure, if a prior net structure is present in</dt><dd><p><codeclass="docutils literal notranslate"><spanclass="pre">_sample_path.structure</span></code>.</p>
</dd>
</dl>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A list containing the spurious edges</p>
<spanid="classes-abstract-importer-module"></span><h2>classes.abstract_importer module<aclass="headerlink"href="#module-classes.abstract_importer"title="Permalink to this headline">¶</a></h2>
<emclass="property">class </em><codeclass="sig-prename descclassname">classes.abstract_importer.</code><codeclass="sig-name descname">AbstractImporter</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">file_path</span><spanclass="p">:</span><spanclass="n">str</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#classes.abstract_importer.AbstractImporter"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">classes.abstract_importer.</code><codeclass="sig-name descname">AbstractImporter</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">file_path</span><spanclass="p">:</span><spanclass="n">str</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">concatenated_samples</span><spanclass="p">:</span><spanclass="n">Union<spanclass="p">[</span>pandas.core.frame.DataFrame<spanclass="p">, </span>numpy.ndarray<spanclass="p">]</span></span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">variables</span><spanclass="p">:</span><spanclass="n">pandas.core.frame.DataFrame</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">prior_net_structure</span><spanclass="p">:</span><spanclass="n">pandas.core.frame.DataFrame</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#classes.abstract_importer.AbstractImporter"title="Permalink to this definition">¶</a></dt>
<p>Abstract class that exposes all the necessary methods to process the trajectories and the net structure.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>file_path</strong> (<em>str</em>) – the file path</p>
</dd>
<dtclass="field-even">_concatenated_samples</dt>
<ddclass="field-even"><p>Dataframe containing the concatenation of all the processed trajectories</p>
</dd>
<dtclass="field-odd">_df_structure</dt>
<ddclass="field-odd"><p>Dataframe containing the structure of the network (edges)</p>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>file_path</strong> (<em>str</em>) – the file path, or dataset name if you import already processed data</p></li>
<li><p><strong>concatenated_samples</strong> (<em>typing.Union</em><em>[</em><em>pandas.DataFrame</em><em>, </em><em>numpy.ndarray</em><em>]</em>) – Dataframe or numpy array containing the concatenation of all the processed trajectories</p></li>
<li><p><strong>variables</strong> (<em>pandas.DataFrame</em>) – Dataframe containing the nodes labels and cardinalities</p></li>
</ul>
</dd>
<dtclass="field-even">_df_variables</dt>
<ddclass="field-even"><p>Dataframe containing the nodes cardinalities</p>
<dtclass="field-even">Prior_net_structure</dt>
<ddclass="field-even"><p>Dataframe containing the structure of the network (edges)</p>
</dd>
<dtclass="field-odd">_sorter</dt>
<ddclass="field-odd"><p>A list containing the columns header (excluding the time column) of the<codeclass="docutils literal notranslate"><spanclass="pre">_concatenated_samples</span></code></p>
<ddclass="field-odd"><p>A list containing the variables labels in the SAME order as the columns in<codeclass="docutils literal notranslate"><spanclass="pre">concatenated_samples</span></code></p>
</dd>
</dl>
<divclass="admonition warning">
<pclass="admonition-title">Warning</p>
<p>The class members <codeclass="docutils literal notranslate"><spanclass="pre">_df_variables</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">_df_structure</span></code> HAVE to be properly constructed
<p>The parameters <codeclass="docutils literal notranslate"><spanclass="pre">variables</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">prior_net_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>
<divclass="admonition note">
<pclass="admonition-title">Note</p>
<p>If you don’t have prior network structure just leave <codeclass="docutils literal notranslate"><spanclass="pre">_df_structure</span></code> set to None.</p>
Header of _df_variables = [Variable_Label | Variable_Cardinality]
See the tutorial on how to construct a correct <codeclass="docutils literal notranslate"><spanclass="pre">concatenated_samples</span></code> Dataframe/ndarray.</p>
<codeclass="sig-name descname">build_list_of_samples_array</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">data_frame</span><spanclass="p">:</span><spanclass="n">pandas.core.frame.DataFrame</span></em><spanclass="sig-paren">)</span>→ List<aclass="headerlink"href="#classes.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>
<codeclass="sig-name descname">build_list_of_samples_array</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">concatenated_sample</span><spanclass="p">:</span><spanclass="n">Union<spanclass="p">[</span>pandas.core.frame.DataFrame<spanclass="p">, </span>numpy.ndarray<spanclass="p">]</span></span></em><spanclass="sig-paren">)</span>→ List<aclass="headerlink"href="#classes.abstract_importer.AbstractImporter.build_list_of_samples_array"title="Permalink to this definition">¶</a></dt>
<dd><p>Builds a List containing the the delta times numpy array, and the complete transitions matrix</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><p><strong>data_frame</strong> (<em>pandas.Dataframe</em>) – the dataframe from which the columns have to be extracted and converted</p>
<ddclass="field-odd"><p><strong>concatenated_sample</strong> (<em>typing.Union</em><em>[</em><em>pandas.Dataframe</em><em>, </em><em>numpy.ndarray</em><em>]</em>) – the dataframe/array from which the time, and transitions matrix have to be extracted
and converted</p>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p>the resulting list of numpy arrays</p>
@ -981,6 +977,11 @@ contain the mentioned data.</p>
Clears all the unused dataframes in <codeclass="docutils literal notranslate"><spanclass="pre">_importer</span></code> Object</p>
<emclass="property">property </em><codeclass="sig-name descname">has_prior_net_structure</code><aclass="headerlink"href="#classes.sample_path.SamplePath.has_prior_net_structure"title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dlclass="py method">
<dtid="classes.sample_path.SamplePath.structure">
<emclass="property">property </em><codeclass="sig-name descname">structure</code><aclass="headerlink"href="#classes.sample_path.SamplePath.structure"title="Permalink to this definition">¶</a></dt>
@ -1228,7 +1229,7 @@ The class member <code class="docutils literal notranslate"><span class="pre">_t
<codeclass="sig-name descname">adjacency_matrix</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ numpy.ndarray<aclass="headerlink"href="#classes.structure_estimator.StructureEstimator.adjacency_matrix"title="Permalink to this definition">¶</a></dt>
<dd><p>Converts the estimated structrure <codeclass="docutils literal notranslate"><spanclass="pre">_complete_graph</span></code> to a boolean adjacency matrix representation.</p>
<dd><p>Converts the estimated structure <codeclass="docutils literal notranslate"><spanclass="pre">_complete_graph</span></code> to a boolean adjacency matrix representation.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>The adjacency matrix of the graph <codeclass="docutils literal notranslate"><spanclass="pre">_complete_graph</span></code></p>
@ -1343,6 +1344,13 @@ it is performed also the chi_test.</p>
<codeclass="sig-name descname">save_plot_estimated_structure_graph</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#classes.structure_estimator.StructureEstimator.save_plot_estimated_structure_graph"title="Permalink to this definition">¶</a></dt>
<dd><p>Plot the estimated structure in a graphical model style.
<codeclass="sig-name descname">save_results</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ None<aclass="headerlink"href="#classes.structure_estimator.StructureEstimator.save_results"title="Permalink to this definition">¶</a></dt>
@ -1350,6 +1358,23 @@ it is performed also the chi_test.</p>
The file is named as the input dataset but the <cite>results_</cite> word is appended to the results file.</p>
<codeclass="sig-name descname">spurious_edges</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span>→ List<aclass="headerlink"href="#classes.structure_estimator.StructureEstimator.spurious_edges"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="simple">
<dt>Return the spurious edges present in the estimated structure, if a prior net structure is present in</dt><dd><p><codeclass="docutils literal notranslate"><spanclass="pre">_sample_path.structure</span></code>.</p>
</dd>
</dl>
<dlclass="field-list simple">
<dtclass="field-odd">Returns</dt>
<ddclass="field-odd"><p>A list containing the spurious edges</p>