1
0
Fork 0
Old engine for Continuous Time Bayesian Networks. Superseded by reCTBN. 🐍 https://github.com/madlabunimib/PyCTBN
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
PyCTBN/docs/PyCTBN.PyCTBN.utility.html

739 lines
51 KiB

<!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.utility package &mdash; PyCTBN 2.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 2.0 documentation" href="index.html"/>
<link rel="up" title="PyCTBN.PyCTBN package" href="PyCTBN.PyCTBN.html"/>
<link rel="next" title="Examples" href="examples.html"/>
<link rel="prev" title="PyCTBN.PyCTBN.structure_graph package" href="PyCTBN.PyCTBN.structure_graph.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><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1 current"><a class="reference internal" href="PyCTBN.PyCTBN.html">PyCTBN.PyCTBN package</a><ul class="current">
<li class="toctree-l2 current"><a class="reference internal" href="PyCTBN.PyCTBN.html#subpackages">Subpackages</a></li>
<li class="toctree-l2"><a class="reference internal" href="PyCTBN.PyCTBN.html#module-PyCTBN.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>
&nbsp;
</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> &raquo;</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">
<section id="pyctbn-pyctbn-utility-package">
<h1>PyCTBN.PyCTBN.utility package<a class="headerlink" href="#pyctbn-pyctbn-utility-package" title="Permalink to this headline"></a></h1>
<section id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</section>
<section id="module-PyCTBN.PyCTBN.utility.abstract_exporter">
<span id="pyctbn-pyctbn-utility-abstract-exporter-module"></span><h2>PyCTBN.PyCTBN.utility.abstract_exporter module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.abstract_exporter" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter">
<em class="property">class </em><code class="sig-prename descclassname">PyCTBN.PyCTBN.utility.abstract_exporter.</code><code class="sig-name descname">AbstractExporter</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">variables</span><span class="p">:</span> <span class="n">pandas.core.frame.DataFrame</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">dyn_str</span><span class="p">:</span> <span class="n">pandas.core.frame.DataFrame</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">dyn_cims</span><span class="p">:</span> <span class="n">dict</span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">abc.ABC</span></code></p>
<p>Abstract class that exposes the methods to save in json format a network information
along with one or more trajectories generated basing on it</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>_variables</strong> (<em>pandas.DataFrame</em>) – Dataframe containing the nodes labels and cardinalities</p></li>
<li><p><strong>_dyn_str</strong> (<em>pandas.DataFrame</em>) – Dataframe containing the structure of the network (edges)</p></li>
<li><p><strong>_dyn_cims</strong> (<em>dict</em>) – It contains, for every variable (label is the key), the SetOfCims object related to it</p></li>
<li><p><strong>_trajectories</strong> (<em>List</em>) – List of trajectories, that can be added subsequently</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter.add_trajectory">
<code class="sig-name descname">add_trajectory</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">trajectory</span><span class="p">:</span> <span class="n">list</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter.add_trajectory" title="Permalink to this definition"></a></dt>
<dd><p>Add a new trajectory to the current list</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>trajectory</strong> (<em>pandas.DataFrame</em>) – The trajectory to add</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter.out_file">
<em class="property">abstract </em><code class="sig-name descname">out_file</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">filename</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter.out_file" title="Permalink to this definition"></a></dt>
<dd><dl class="simple">
<dt>Create a file in current directory and write on it the previously added data </dt><dd><p>(variables, dyn_str, dyn_cims and trajectories)</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>filename</strong> (<em>string</em>) – Name of the output file (it must include json extension)</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
3 years ago
</section>
<section id="module-PyCTBN.PyCTBN.utility.abstract_importer">
<span id="pyctbn-pyctbn-utility-abstract-importer-module"></span><h2>PyCTBN.PyCTBN.utility.abstract_importer module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.abstract_importer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter">
<em class="property">class </em><code class="sig-prename descclassname">PyCTBN.PyCTBN.utility.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> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">trajectory_list</span><span class="p">:</span> <span class="n">Union<span class="p">[</span>pandas.core.frame.DataFrame<span class="p">, </span>numpy.ndarray<span class="p">]</span></span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">variables</span><span class="p">:</span> <span class="n">pandas.core.frame.DataFrame</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">prior_net_structure</span><span class="p">:</span> <span class="n">pandas.core.frame.DataFrame</span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.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"><ul class="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>trajectory_list</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>
<dt class="field-even">Prior_net_structure</dt>
<dd class="field-even"><p>Dataframe containing the structure of the network (edges)</p>
</dd>
<dt class="field-odd">_sorter</dt>
<dd class="field-odd"><p>A list containing the variables labels in the SAME order as the columns in <code class="docutils literal notranslate"><span class="pre">concatenated_samples</span></code></p>
</dd>
</dl>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>The parameters <code class="docutils literal notranslate"><span class="pre">variables</span></code> and <code class="docutils literal notranslate"><span class="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]
See the tutorial on how to construct a correct <code class="docutils literal notranslate"><span class="pre">concatenated_samples</span></code> Dataframe/ndarray.</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 implementation</p>
</div>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.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">concatenated_sample</span><span class="p">:</span> <span class="n">pandas.core.frame.DataFrame</span></em><span class="sig-paren">)</span> &#x2192; List<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>concatenated_sample</strong> (<em>pandas.Dataframe</em>) – the dataframe/array from which the time, and transitions matrix 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="PyCTBN.PyCTBN.utility.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">trajecory_header</span><span class="p">:</span> <span class="n">object</span></em><span class="sig-paren">)</span> &#x2192; List<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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>trajecory_header</strong> (<em>object</em>) – an object that will be used to define 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="PyCTBN.PyCTBN.utility.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> &#x2192; None<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.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> &#x2192; None<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.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> &#x2192; pandas.core.frame.DataFrame<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter.concatenated_samples">
<em class="property">property </em><code class="sig-name descname">concatenated_samples</code><a class="headerlink" href="#PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter.concatenated_samples" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.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> &#x2192; object<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter.file_path">
<em class="property">property </em><code class="sig-name descname">file_path</code><a class="headerlink" href="#PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter.file_path" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter.sorter">
<em class="property">property </em><code class="sig-name descname">sorter</code><a class="headerlink" href="#PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter.sorter" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter.structure">
<em class="property">property </em><code class="sig-name descname">structure</code><a class="headerlink" href="#PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter.structure" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter.variables">
<em class="property">property </em><code class="sig-name descname">variables</code><a class="headerlink" href="#PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter.variables" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</section>
<section id="module-PyCTBN.PyCTBN.utility.cache">
<span id="pyctbn-pyctbn-utility-cache-module"></span><h2>PyCTBN.PyCTBN.utility.cache module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.cache" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.utility.cache.Cache">
<em class="property">class </em><code class="sig-prename descclassname">PyCTBN.PyCTBN.utility.cache.</code><code class="sig-name descname">Cache</code><a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.cache.Cache.clear">
<code class="sig-name descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.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="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.structure_graph.html#PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims" title="PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims">SetOfCims</a></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.structure_graph.html#PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims" title="PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims">PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims</a></span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.structure_graph.html#PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims" title="PyCTBN.PyCTBN.structure_graph.set_of_cims.SetOfCims"><em>SetOfCims</em></a>) – the related SetOfCims object</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</dd></dl>
</section>
<section id="module-PyCTBN.PyCTBN.utility.json_exporter">
<span id="pyctbn-pyctbn-utility-json-exporter-module"></span><h2>PyCTBN.PyCTBN.utility.json_exporter module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.json_exporter" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.utility.json_exporter.JsonExporter">
<em class="property">class </em><code class="sig-prename descclassname">PyCTBN.PyCTBN.utility.json_exporter.</code><code class="sig-name descname">JsonExporter</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">variables</span><span class="p">:</span> <span class="n">pandas.core.frame.DataFrame</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">dyn_str</span><span class="p">:</span> <span class="n">pandas.core.frame.DataFrame</span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">dyn_cims</span><span class="p">:</span> <span class="n">dict</span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.json_exporter.JsonExporter" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter" title="PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter"><code class="xref py py-class docutils literal notranslate"><span class="pre">PyCTBN.PyCTBN.utility.abstract_exporter.AbstractExporter</span></code></a></p>
<p>Provides the methods to save in json format a network information
along with one or more trajectories generated basing on it</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>_variables</strong> (<em>pandas.DataFrame</em>) – Dataframe containing the nodes labels and cardinalities</p></li>
<li><p><strong>_dyn_str</strong> (<em>pandas.DataFrame</em>) – Dataframe containing the structure of the network (edges)</p></li>
<li><p><strong>_dyn_cims</strong> (<em>dict</em>) – It contains, for every variable (label is the key), the SetOfCims object related to it</p></li>
<li><p><strong>_trajectories</strong> (<em>List</em>) – List of trajectories, that can be added subsequently</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.json_exporter.JsonExporter.cims_to_json">
<code class="sig-name descname">cims_to_json</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; dict<a class="headerlink" href="#PyCTBN.PyCTBN.utility.json_exporter.JsonExporter.cims_to_json" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.json_exporter.JsonExporter.out_file">
<code class="sig-name descname">out_file</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">filename</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.json_exporter.JsonExporter.out_file" title="Permalink to this definition"></a></dt>
<dd><dl class="simple">
<dt>Create a file in current directory and write on it the previously added data </dt><dd><p>(variables, dyn_str, dyn_cims and trajectories)</p>
</dd>
</dl>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>filename</strong> (<em>string</em>) – Name of the output file (it must include json extension)</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
3 years ago
</section>
<section id="module-PyCTBN.PyCTBN.utility.json_importer">
<span id="pyctbn-pyctbn-utility-json-importer-module"></span><h2>PyCTBN.PyCTBN.utility.json_importer module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.json_importer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.utility.json_importer.JsonImporter">
<em class="property">class </em><code class="sig-prename descclassname">PyCTBN.PyCTBN.utility.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">cims_label</span><span class="p">:</span> <span class="n">str</span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.json_importer.JsonImporter" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter" title="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter"><code class="xref py py-class docutils literal notranslate"><span class="pre">PyCTBN.PyCTBN.utility.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 extension.</p>
<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>
</ul>
</dd>
<dt class="field-even">_array_indx</dt>
<dd class="field-even"><p>the index of the outer JsonArray to extract the data from</p>
</dd>
<dt class="field-odd">_df_samples_list</dt>
<dd class="field-odd"><p>a Dataframe list in which every dataframe contains a trajectory</p>
</dd>
<dt class="field-even">_raw_data</dt>
<dd class="field-even"><p>The raw contents of the json file to import</p>
</dd>
</dl>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.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> &#x2192; List<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.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> &#x2192; None<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.json_importer.JsonImporter.dataset_id">
<code class="sig-name descname">dataset_id</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; object<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.json_importer.JsonImporter.import_data">
<code class="sig-name descname">import_data</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">indx</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">0</span></em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#PyCTBN.PyCTBN.utility.json_importer.JsonImporter.import_data" title="Permalink to this definition"></a></dt>
<dd><p>Implements the abstract method of <code class="xref py py-class docutils literal notranslate"><span class="pre">AbstractImporter</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>indx</strong> (<em>int</em>) – the index of the outer JsonArray to extract the data from, default to 0</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.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> &#x2192; Dict<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.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> &#x2192; pandas.core.frame.DataFrame<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.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> &#x2192; List<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.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> &#x2192; pandas.core.frame.DataFrame<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.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> &#x2192; List<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.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> &#x2192; pandas.core.frame.DataFrame<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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="PyCTBN.PyCTBN.utility.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> &#x2192; List<a class="headerlink" href="#PyCTBN.PyCTBN.utility.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>
</section>
<section id="module-PyCTBN.PyCTBN.utility.sample_importer">
<span id="pyctbn-pyctbn-utility-sample-importer-module"></span><h2>PyCTBN.PyCTBN.utility.sample_importer module<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility.sample_importer" title="Permalink to this headline"></a></h2>
<dl class="py class">
<dt id="PyCTBN.PyCTBN.utility.sample_importer.SampleImporter">
<em class="property">class </em><code class="sig-prename descclassname">PyCTBN.PyCTBN.utility.sample_importer.</code><code class="sig-name descname">SampleImporter</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">trajectory_list</span><span class="p">:</span> <span class="n">Union<span class="p">[</span>pandas.core.frame.DataFrame<span class="p">, </span>numpy.ndarray<span class="p">, </span>List<span class="p">]</span></span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">variables</span><span class="p">:</span> <span class="n">Union<span class="p">[</span>pandas.core.frame.DataFrame<span class="p">, </span>numpy.ndarray<span class="p">, </span>List<span class="p">]</span></span> <span class="o">=</span> <span class="default_value">None</span></em>, <em class="sig-param"><span class="n">prior_net_structure</span><span class="p">:</span> <span class="n">Union<span class="p">[</span>pandas.core.frame.DataFrame<span class="p">, </span>numpy.ndarray<span class="p">, </span>List<span class="p">]</span></span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.sample_importer.SampleImporter" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter" title="PyCTBN.PyCTBN.utility.abstract_importer.AbstractImporter"><code class="xref py py-class docutils literal notranslate"><span class="pre">PyCTBN.PyCTBN.utility.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 loaded directly by using DataFrame</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>trajectory_list</strong> (<em>typing.Union</em><em>[</em><em>pd.DataFrame</em><em>, </em><em>np.ndarray</em><em>, </em><em>typing.List</em><em>]</em>) – the data that describes the trajectories</p></li>
<li><p><strong>variables</strong> (<em>typing.Union</em><em>[</em><em>pd.DataFrame</em><em>, </em><em>np.ndarray</em><em>, </em><em>typing.List</em><em>]</em>) – the data that describes the variables with name and cardinality</p></li>
<li><p><strong>prior_net_structure</strong> (<em>typing.Union</em><em>[</em><em>pd.DataFrame</em><em>, </em><em>np.ndarray</em><em>, </em><em>typing.List</em><em>]</em>) – the data of the real structure, if it exists</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>
<dt class="field-odd">_raw_data</dt>
<dd class="field-odd"><p>The raw contents of the json file to import</p>
</dd>
</dl>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.sample_importer.SampleImporter.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> &#x2192; List<a class="headerlink" href="#PyCTBN.PyCTBN.utility.sample_importer.SampleImporter.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> in order to get the ordered variables list.</p>
</dd></dl>
<dl class="py method">
<dt id="PyCTBN.PyCTBN.utility.sample_importer.SampleImporter.dataset_id">
<code class="sig-name descname">dataset_id</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#PyCTBN.PyCTBN.utility.sample_importer.SampleImporter.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="PyCTBN.PyCTBN.utility.sample_importer.SampleImporter.import_data">
<code class="sig-name descname">import_data</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">header_column</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="headerlink" href="#PyCTBN.PyCTBN.utility.sample_importer.SampleImporter.import_data" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</section>
<section id="module-PyCTBN.PyCTBN.utility">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-PyCTBN.PyCTBN.utility" title="Permalink to this headline"></a></h2>
</section>
</section>
</div>
<footer>
<div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
<a href="examples.html" class="btn btn-neutral float-right" title="Examples">Next <span class="fa fa-arrow-circle-right"></span></a>
<a href="PyCTBN.PyCTBN.structure_graph.html" class="btn btn-neutral" title="PyCTBN.PyCTBN.structure_graph package"><span class="fa fa-arrow-circle-left"></span> Previous</a>
</div>
<hr/>
<div role="contentinfo">
<p>
&copy; Copyright 2021, Bregoli Alessandro, Martini Filippo, Moretti Luca.
</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:'2.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>