Updating the documentation

This commit is contained in:
Petrônio Cândido 2019-02-21 12:00:09 -03:00
parent 1211aa2be7
commit 934c744139
60 changed files with 2274 additions and 403 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -111,6 +111,7 @@
<li><a href="pyFTS/data/mackey_glass.html">pyFTS.data.mackey_glass</a></li>
<li><a href="pyFTS/data/rossler.html">pyFTS.data.rossler</a></li>
<li><a href="pyFTS/data/sunspots.html">pyFTS.data.sunspots</a></li>
<li><a href="pyFTS/distributed/spark.html">pyFTS.distributed.spark</a></li>
<li><a href="pyFTS/hyperparam/GridSearch.html">pyFTS.hyperparam.GridSearch</a></li>
<li><a href="pyFTS/hyperparam/Util.html">pyFTS.hyperparam.Util</a></li>
<li><a href="pyFTS/models/chen.html">pyFTS.models.chen</a></li>
@ -120,7 +121,8 @@
<li><a href="pyFTS/models/hofts.html">pyFTS.models.hofts</a></li>
<li><a href="pyFTS/models/hwang.html">pyFTS.models.hwang</a></li>
<li><a href="pyFTS/models/ifts.html">pyFTS.models.ifts</a></li>
<li><a href="pyFTS/models/incremental/Retrainer.html">pyFTS.models.incremental.Retrainer</a></li>
<li><a href="pyFTS/models/incremental/IncrementalEnsemble.html">pyFTS.models.incremental.IncrementalEnsemble</a></li>
<li><a href="pyFTS/models/incremental/TimeVariant.html">pyFTS.models.incremental.TimeVariant</a></li>
<li><a href="pyFTS/models/ismailefendi.html">pyFTS.models.ismailefendi</a></li>
<li><a href="pyFTS/models/multivariate/FLR.html">pyFTS.models.multivariate.FLR</a></li>
<li><a href="pyFTS/models/multivariate/cmvfts.html">pyFTS.models.multivariate.cmvfts</a></li>

View File

@ -93,7 +93,7 @@
<span class="sd"> :param k: </span>
<span class="sd"> :return: </span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">mu</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="n">mu</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">nanmean</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="n">sigma</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">var</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="n">n</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="n">s</span> <span class="o">=</span> <span class="mi">0</span>
@ -142,7 +142,7 @@
<span class="n">targets</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">targets</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">forecasts</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span>
<span class="n">forecasts</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">forecasts</span><span class="p">)</span>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">divide</span><span class="p">((</span><span class="n">targets</span> <span class="o">-</span> <span class="n">forecasts</span><span class="p">),</span> <span class="n">targets</span><span class="p">)))</span> <span class="o">*</span> <span class="mi">100</span></div>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">nanmean</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">divide</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">subtract</span><span class="p">(</span><span class="n">targets</span><span class="p">,</span> <span class="n">forecasts</span><span class="p">),</span> <span class="n">targets</span><span class="p">)))</span> <span class="o">*</span> <span class="mi">100</span></div>
<div class="viewcode-block" id="smape"><a class="viewcode-back" href="../../../pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.smape">[docs]</a><span class="k">def</span> <span class="nf">smape</span><span class="p">(</span><span class="n">targets</span><span class="p">,</span> <span class="n">forecasts</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="mi">2</span><span class="p">):</span>
@ -159,11 +159,11 @@
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">forecasts</span><span class="p">,</span> <span class="nb">list</span><span class="p">):</span>
<span class="n">forecasts</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">forecasts</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">type</span> <span class="o">==</span> <span class="mi">1</span><span class="p">:</span>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">forecasts</span> <span class="o">-</span> <span class="n">targets</span><span class="p">)</span> <span class="o">/</span> <span class="p">((</span><span class="n">forecasts</span> <span class="o">+</span> <span class="n">targets</span><span class="p">)</span> <span class="o">/</span> <span class="mi">2</span><span class="p">))</span>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">nanmean</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">forecasts</span> <span class="o">-</span> <span class="n">targets</span><span class="p">)</span> <span class="o">/</span> <span class="p">((</span><span class="n">forecasts</span> <span class="o">+</span> <span class="n">targets</span><span class="p">)</span> <span class="o">/</span> <span class="mi">2</span><span class="p">))</span>
<span class="k">elif</span> <span class="nb">type</span> <span class="o">==</span> <span class="mi">2</span><span class="p">:</span>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">forecasts</span> <span class="o">-</span> <span class="n">targets</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="nb">abs</span><span class="p">(</span><span class="n">forecasts</span><span class="p">)</span> <span class="o">+</span> <span class="nb">abs</span><span class="p">(</span><span class="n">targets</span><span class="p">)))</span> <span class="o">*</span> <span class="mi">100</span>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">nanmean</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">forecasts</span> <span class="o">-</span> <span class="n">targets</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">forecasts</span><span class="p">)</span> <span class="o">+</span> <span class="nb">abs</span><span class="p">(</span><span class="n">targets</span><span class="p">)))</span> <span class="o">*</span> <span class="mi">100</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="nb">sum</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">forecasts</span> <span class="o">-</span> <span class="n">targets</span><span class="p">))</span> <span class="o">/</span> <span class="nb">sum</span><span class="p">(</span><span class="n">forecasts</span> <span class="o">+</span> <span class="n">targets</span><span class="p">)</span></div>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">abs</span><span class="p">(</span><span class="n">forecasts</span> <span class="o">-</span> <span class="n">targets</span><span class="p">))</span> <span class="o">/</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">forecasts</span> <span class="o">+</span> <span class="n">targets</span><span class="p">)</span></div>
<div class="viewcode-block" id="mape_interval"><a class="viewcode-back" href="../../../pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.mape_interval">[docs]</a><span class="k">def</span> <span class="nf">mape_interval</span><span class="p">(</span><span class="n">targets</span><span class="p">,</span> <span class="n">forecasts</span><span class="p">):</span>
@ -188,9 +188,9 @@
<span class="n">naive</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">y</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">l</span> <span class="o">-</span> <span class="mi">1</span><span class="p">):</span>
<span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">forecasts</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">-</span> <span class="n">targets</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="o">**</span> <span class="mi">2</span><span class="p">)</span>
<span class="n">naive</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="n">targets</span><span class="p">[</span><span class="n">k</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]</span> <span class="o">-</span> <span class="n">targets</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="o">**</span> <span class="mi">2</span><span class="p">)</span>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="nb">sum</span><span class="p">(</span><span class="n">y</span><span class="p">)</span> <span class="o">/</span> <span class="nb">sum</span><span class="p">(</span><span class="n">naive</span><span class="p">))</span></div>
<span class="n">y</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">subtract</span><span class="p">(</span><span class="n">forecasts</span><span class="p">[</span><span class="n">k</span><span class="p">],</span> <span class="n">targets</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="o">**</span> <span class="mi">2</span><span class="p">)</span>
<span class="n">naive</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">subtract</span><span class="p">(</span><span class="n">targets</span><span class="p">[</span><span class="n">k</span> <span class="o">+</span> <span class="mi">1</span><span class="p">],</span> <span class="n">targets</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="o">**</span> <span class="mi">2</span><span class="p">)</span>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">sqrt</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">divide</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">y</span><span class="p">),</span> <span class="n">np</span><span class="o">.</span><span class="n">sum</span><span class="p">(</span><span class="n">naive</span><span class="p">)))</span></div>
<div class="viewcode-block" id="TheilsInequality"><a class="viewcode-back" href="../../../pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.TheilsInequality">[docs]</a><span class="k">def</span> <span class="nf">TheilsInequality</span><span class="p">(</span><span class="n">targets</span><span class="p">,</span> <span class="n">forecasts</span><span class="p">):</span>
@ -262,7 +262,7 @@
<span class="n">preds</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">preds</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">preds</span><span class="p">)</span></div>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">nanmean</span><span class="p">(</span><span class="n">preds</span><span class="p">)</span></div>
<div class="viewcode-block" id="pinball"><a class="viewcode-back" href="../../../pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.pinball">[docs]</a><span class="k">def</span> <span class="nf">pinball</span><span class="p">(</span><span class="n">tau</span><span class="p">,</span> <span class="n">target</span><span class="p">,</span> <span class="n">forecast</span><span class="p">):</span>
@ -275,9 +275,9 @@
<span class="sd"> :return: float, distance of forecast to the tau-quantile of the target</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">target</span> <span class="o">&gt;=</span> <span class="n">forecast</span><span class="p">:</span>
<span class="k">return</span> <span class="p">(</span><span class="n">target</span> <span class="o">-</span> <span class="n">forecast</span><span class="p">)</span> <span class="o">*</span> <span class="n">tau</span>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">subtract</span><span class="p">(</span><span class="n">target</span><span class="p">,</span> <span class="n">forecast</span><span class="p">)</span> <span class="o">*</span> <span class="n">tau</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="p">(</span><span class="n">forecast</span> <span class="o">-</span> <span class="n">target</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">tau</span><span class="p">)</span></div>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">subtract</span><span class="p">(</span><span class="n">forecast</span><span class="p">,</span> <span class="n">target</span><span class="p">)</span> <span class="o">*</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">tau</span><span class="p">)</span></div>
<div class="viewcode-block" id="pinball_mean"><a class="viewcode-back" href="../../../pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.pinball_mean">[docs]</a><span class="k">def</span> <span class="nf">pinball_mean</span><span class="p">(</span><span class="n">tau</span><span class="p">,</span> <span class="n">targets</span><span class="p">,</span> <span class="n">forecasts</span><span class="p">):</span>

View File

@ -148,7 +148,13 @@
<span class="bp">self</span><span class="o">.</span><span class="n">upper</span> <span class="o">=</span> <span class="nb">set</span><span class="o">.</span><span class="n">upper</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">centroid</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">centroid</span> <span class="o">&lt;</span> <span class="nb">set</span><span class="o">.</span><span class="n">centroid</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">centroid</span> <span class="o">=</span> <span class="nb">set</span><span class="o">.</span><span class="n">centroid</span></div></div>
<span class="bp">self</span><span class="o">.</span><span class="n">centroid</span> <span class="o">=</span> <span class="nb">set</span><span class="o">.</span><span class="n">centroid</span></div>
<span class="k">def</span> <span class="nf">__str__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="nb">str</span><span class="p">([</span><span class="nb">str</span><span class="p">(</span><span class="n">k</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">sets</span><span class="p">])</span>
<span class="k">return</span> <span class="s2">&quot;</span><span class="si">{}</span><span class="s2">: </span><span class="si">{}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">tmp</span><span class="p">)</span></div>
</pre></div>

View File

@ -251,8 +251,11 @@
<span class="sd"> :param obj: object on memory</span>
<span class="sd"> :param file: file name to store the object</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">file</span><span class="p">,</span> <span class="s1">&#39;wb&#39;</span><span class="p">)</span> <span class="k">as</span> <span class="n">_file</span><span class="p">:</span>
<span class="n">dill</span><span class="o">.</span><span class="n">dump</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">_file</span><span class="p">)</span></div>
<span class="n">dill</span><span class="o">.</span><span class="n">dump</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">_file</span><span class="p">)</span>
<span class="k">except</span> <span class="ne">Exception</span> <span class="k">as</span> <span class="n">ex</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;File </span><span class="si">{}</span><span class="s2"> could not be saved due exception </span><span class="si">{}</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">file</span><span class="p">,</span> <span class="n">ex</span><span class="p">))</span></div>
<div class="viewcode-block" id="load_obj"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.Util.load_obj">[docs]</a><span class="k">def</span> <span class="nf">load_obj</span><span class="p">(</span><span class="n">file</span><span class="p">):</span>

View File

@ -98,6 +98,8 @@
<span class="sd">&quot;&quot;&quot;A string with the model name&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">detail</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;name&#39;</span><span class="p">,</span><span class="s2">&quot;&quot;</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;A string with the model detailed information&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">is_wrapper</span> <span class="o">=</span> <span class="kc">False</span>
<span class="sd">&quot;&quot;&quot;Indicates that this model is a wrapper for other(s) method(s)&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">is_high_order</span> <span class="o">=</span> <span class="kc">False</span>
<span class="sd">&quot;&quot;&quot;A boolean value indicating if the model support orders greater than 1, default: False&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">min_order</span> <span class="o">=</span> <span class="mi">1</span>
@ -174,8 +176,9 @@
<span class="sd"> :keyword nodes: a list with the dispy cluster nodes addresses</span>
<span class="sd"> :keyword explain: try to explain, step by step, the one-step-ahead point forecasting result given the input data.</span>
<span class="sd"> :keyword generators: for multivariate methods on multi step ahead forecasting, generators is a dict where the keys</span>
<span class="sd"> are the variables names (except the target_variable) and the values are lambda functions that</span>
<span class="sd"> accept one value (the actual value of the variable) and return the next value.</span>
<span class="sd"> are the dataframe columun names (except the target_variable) and the values are lambda functions that</span>
<span class="sd"> accept one value (the actual value of the variable) and return the next value or trained FTS</span>
<span class="sd"> models that accept the actual values and forecast new ones.</span>
<span class="sd"> :return: a numpy array with the forecasted data</span>
<span class="sd"> &quot;&quot;&quot;</span>
@ -296,8 +299,6 @@
<span class="sd"> :return: a list with the forecasted values</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">):</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">tolist</span><span class="p">()</span>
@ -388,6 +389,7 @@
<span class="k">if</span> <span class="s1">&#39;partitioner&#39;</span> <span class="ow">in</span> <span class="n">kwargs</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s1">&#39;partitioner&#39;</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_wrapper</span><span class="p">:</span>
<span class="k">if</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sets</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sets</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">benchmark_only</span> <span class="ow">and</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_multivariate</span><span class="p">:</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">sets</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">sets</span>
@ -600,7 +602,7 @@
<span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="nb">sorted</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">key</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">[</span><span class="n">key</span><span class="p">]</span><span class="o">.</span><span class="n">get_midpoint</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">sets</span><span class="p">)):</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">{0}{1}</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">tmp</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">[</span><span class="n">r</span><span class="p">]))</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">flrgs</span><span class="p">:</span>
<span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="s2">&quot;</span><span class="si">{0}{1}</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">tmp</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">[</span><span class="n">r</span><span class="p">]))</span>
<span class="k">return</span> <span class="n">tmp</span>

View File

@ -79,6 +79,148 @@
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<div class="viewcode-block" id="SignalEmulator"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.artificial.SignalEmulator">[docs]</a><span class="k">class</span> <span class="nc">SignalEmulator</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Emulate a complex signal built from several additive and non-additive components</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="nb">super</span><span class="p">(</span><span class="n">SignalEmulator</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">components</span> <span class="o">=</span> <span class="p">[]</span>
<span class="sd">&quot;&quot;&quot;Components of the signal&quot;&quot;&quot;</span>
<div class="viewcode-block" id="SignalEmulator.stationary_gaussian"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.artificial.SignalEmulator.stationary_gaussian">[docs]</a> <span class="k">def</span> <span class="nf">stationary_gaussian</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">mu</span><span class="p">,</span> <span class="n">sigma</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Creates a continuous Gaussian signal with mean mu and variance sigma.</span>
<span class="sd"> :param mu: mean</span>
<span class="sd"> :param sigma: variance</span>
<span class="sd"> :keyword additive: If False it cancels the previous signal and start this one, if True</span>
<span class="sd"> this signal is added to the previous one</span>
<span class="sd"> :keyword start: lag index to start this signal, the default value is 0</span>
<span class="sd"> :keyword it: Number of iterations, the default value is 1</span>
<span class="sd"> :keyword length: Number of samples generated on each iteration, the default value is 100</span>
<span class="sd"> :keyword vmin: Lower bound value of generated data, the default value is None</span>
<span class="sd"> :keyword vmax: Upper bound value of generated data, the default value is None</span>
<span class="sd"> :return: the current SignalEmulator instance, for method chaining</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">parameters</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;mu&#39;</span><span class="p">:</span> <span class="n">mu</span><span class="p">,</span> <span class="s1">&#39;sigma&#39;</span><span class="p">:</span> <span class="n">sigma</span><span class="p">}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">components</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s1">&#39;dist&#39;</span><span class="p">:</span> <span class="s1">&#39;gaussian&#39;</span><span class="p">,</span> <span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="s1">&#39;constant&#39;</span><span class="p">,</span>
<span class="s1">&#39;parameters&#39;</span><span class="p">:</span> <span class="n">parameters</span><span class="p">,</span> <span class="s1">&#39;args&#39;</span><span class="p">:</span> <span class="n">kwargs</span><span class="p">})</span>
<span class="k">return</span> <span class="bp">self</span></div>
<div class="viewcode-block" id="SignalEmulator.incremental_gaussian"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.artificial.SignalEmulator.incremental_gaussian">[docs]</a> <span class="k">def</span> <span class="nf">incremental_gaussian</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">mu</span><span class="p">,</span> <span class="n">sigma</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Creates an additive gaussian interference on a previous signal</span>
<span class="sd"> :param mu: increment on mean</span>
<span class="sd"> :param sigma: increment on variance</span>
<span class="sd"> :keyword start: lag index to start this signal, the default value is 0</span>
<span class="sd"> :keyword it: Number of iterations, the default value is 1</span>
<span class="sd"> :keyword length: Number of samples generated on each iteration, the default value is 100</span>
<span class="sd"> :keyword vmin: Lower bound value of generated data, the default value is None</span>
<span class="sd"> :keyword vmax: Upper bound value of generated data, the default value is None</span>
<span class="sd"> :return: the current SignalEmulator instance, for method chaining</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">parameters</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;mu&#39;</span><span class="p">:</span> <span class="n">mu</span><span class="p">,</span> <span class="s1">&#39;sigma&#39;</span><span class="p">:</span> <span class="n">sigma</span><span class="p">}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">components</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s1">&#39;dist&#39;</span><span class="p">:</span> <span class="s1">&#39;gaussian&#39;</span><span class="p">,</span> <span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="s1">&#39;incremental&#39;</span><span class="p">,</span>
<span class="s1">&#39;parameters&#39;</span><span class="p">:</span> <span class="n">parameters</span><span class="p">,</span> <span class="s1">&#39;args&#39;</span><span class="p">:</span> <span class="n">kwargs</span><span class="p">})</span>
<span class="k">return</span> <span class="bp">self</span></div>
<div class="viewcode-block" id="SignalEmulator.periodic_gaussian"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.artificial.SignalEmulator.periodic_gaussian">[docs]</a> <span class="k">def</span> <span class="nf">periodic_gaussian</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="nb">type</span><span class="p">,</span> <span class="n">period</span><span class="p">,</span> <span class="n">mu_min</span><span class="p">,</span> <span class="n">sigma_min</span><span class="p">,</span> <span class="n">mu_max</span><span class="p">,</span> <span class="n">sigma_max</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Creates an additive periodic gaussian interference on a previous signal</span>
<span class="sd"> :param type: &#39;linear&#39; or &#39;sinoidal&#39;</span>
<span class="sd"> :param period: the period of recurrence</span>
<span class="sd"> :param mu: increment on mean</span>
<span class="sd"> :param sigma: increment on variance</span>
<span class="sd"> :keyword start: lag index to start this signal, the default value is 0</span>
<span class="sd"> :keyword it: Number of iterations, the default value is 1</span>
<span class="sd"> :keyword length: Number of samples generated on each iteration, the default value is 100</span>
<span class="sd"> :keyword vmin: Lower bound value of generated data, the default value is None</span>
<span class="sd"> :keyword vmax: Upper bound value of generated data, the default value is None</span>
<span class="sd"> :return: the current SignalEmulator instance, for method chaining</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">parameters</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span><span class="nb">type</span><span class="p">,</span> <span class="s1">&#39;period&#39;</span><span class="p">:</span><span class="n">period</span><span class="p">,</span>
<span class="s1">&#39;mu_min&#39;</span><span class="p">:</span> <span class="n">mu_min</span><span class="p">,</span> <span class="s1">&#39;sigma_min&#39;</span><span class="p">:</span> <span class="n">sigma_min</span><span class="p">,</span> <span class="s1">&#39;mu_max&#39;</span><span class="p">:</span> <span class="n">mu_max</span><span class="p">,</span> <span class="s1">&#39;sigma_max&#39;</span><span class="p">:</span> <span class="n">sigma_max</span><span class="p">}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">components</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s1">&#39;dist&#39;</span><span class="p">:</span> <span class="s1">&#39;gaussian&#39;</span><span class="p">,</span> <span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="s1">&#39;periodic&#39;</span><span class="p">,</span>
<span class="s1">&#39;parameters&#39;</span><span class="p">:</span> <span class="n">parameters</span><span class="p">,</span> <span class="s1">&#39;args&#39;</span><span class="p">:</span> <span class="n">kwargs</span><span class="p">})</span>
<span class="k">return</span> <span class="bp">self</span></div>
<div class="viewcode-block" id="SignalEmulator.blip"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.artificial.SignalEmulator.blip">[docs]</a> <span class="k">def</span> <span class="nf">blip</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Creates an outlier greater than the maximum or lower then the minimum previous values of the signal,</span>
<span class="sd"> and insert it on a random location of the signal.</span>
<span class="sd"> :return: the current SignalEmulator instance, for method chaining</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">parameters</span> <span class="o">=</span> <span class="p">{}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">components</span><span class="o">.</span><span class="n">append</span><span class="p">({</span><span class="s1">&#39;dist&#39;</span><span class="p">:</span> <span class="s1">&#39;blip&#39;</span><span class="p">,</span> <span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="s1">&#39;blip&#39;</span><span class="p">,</span>
<span class="s1">&#39;parameters&#39;</span><span class="p">:</span> <span class="n">parameters</span><span class="p">,</span> <span class="s1">&#39;args&#39;</span><span class="p">:</span><span class="n">kwargs</span><span class="p">})</span>
<span class="k">return</span> <span class="bp">self</span></div>
<div class="viewcode-block" id="SignalEmulator.run"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.artificial.SignalEmulator.run">[docs]</a> <span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Render the signal</span>
<span class="sd"> :return: a list of float values</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">signal</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">last_it</span> <span class="o">=</span> <span class="mi">10</span>
<span class="n">last_num</span> <span class="o">=</span> <span class="mi">10</span>
<span class="k">for</span> <span class="n">ct</span><span class="p">,</span> <span class="n">component</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">components</span><span class="p">):</span>
<span class="n">parameters</span> <span class="o">=</span> <span class="n">component</span><span class="p">[</span><span class="s1">&#39;parameters&#39;</span><span class="p">]</span>
<span class="n">kwargs</span> <span class="o">=</span> <span class="n">component</span><span class="p">[</span><span class="s1">&#39;args&#39;</span><span class="p">]</span>
<span class="n">additive</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;additive&#39;</span><span class="p">,</span> <span class="kc">True</span><span class="p">)</span>
<span class="n">start</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;start&#39;</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="n">it</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;it&#39;</span><span class="p">,</span> <span class="n">last_it</span><span class="p">)</span>
<span class="n">num</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;length&#39;</span><span class="p">,</span> <span class="n">last_num</span><span class="p">)</span>
<span class="n">vmin</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;vmin&#39;</span><span class="p">,</span><span class="kc">None</span><span class="p">)</span>
<span class="n">vmax</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;vmax&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="k">if</span> <span class="n">component</span><span class="p">[</span><span class="s1">&#39;type&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;constant&#39;</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">generate_gaussian_linear</span><span class="p">(</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;mu&#39;</span><span class="p">],</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;sigma&#39;</span><span class="p">],</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span>
<span class="n">it</span><span class="o">=</span><span class="n">it</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="n">num</span><span class="p">,</span> <span class="n">vmin</span><span class="o">=</span><span class="n">vmin</span><span class="p">,</span> <span class="n">vmax</span><span class="o">=</span><span class="n">vmax</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">component</span><span class="p">[</span><span class="s1">&#39;type&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;incremental&#39;</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">generate_gaussian_linear</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;mu&#39;</span><span class="p">],</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;sigma&#39;</span><span class="p">],</span>
<span class="n">it</span><span class="o">=</span><span class="n">num</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">vmin</span><span class="o">=</span><span class="n">vmin</span><span class="p">,</span> <span class="n">vmax</span><span class="o">=</span><span class="n">vmax</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">component</span><span class="p">[</span><span class="s1">&#39;type&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;periodic&#39;</span><span class="p">:</span>
<span class="n">period</span> <span class="o">=</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;period&#39;</span><span class="p">]</span>
<span class="n">mu_min</span><span class="p">,</span> <span class="n">sigma_min</span> <span class="o">=</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;mu_min&#39;</span><span class="p">],</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;sigma_min&#39;</span><span class="p">]</span>
<span class="n">mu_max</span><span class="p">,</span> <span class="n">sigma_max</span> <span class="o">=</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;mu_max&#39;</span><span class="p">],</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;sigma_max&#39;</span><span class="p">]</span>
<span class="k">if</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;type&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;sinoidal&#39;</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">generate_sinoidal_periodic_gaussian</span><span class="p">(</span><span class="n">period</span><span class="p">,</span> <span class="n">mu_min</span><span class="p">,</span> <span class="n">sigma_min</span><span class="p">,</span> <span class="n">mu_max</span><span class="p">,</span> <span class="n">sigma_max</span><span class="p">,</span>
<span class="n">it</span><span class="o">=</span><span class="n">num</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">vmin</span><span class="o">=</span><span class="n">vmin</span><span class="p">,</span> <span class="n">vmax</span><span class="o">=</span><span class="n">vmax</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">generate_linear_periodic_gaussian</span><span class="p">(</span><span class="n">period</span><span class="p">,</span> <span class="n">mu_min</span><span class="p">,</span> <span class="n">sigma_min</span><span class="p">,</span> <span class="n">mu_max</span><span class="p">,</span> <span class="n">sigma_max</span><span class="p">,</span>
<span class="n">it</span><span class="o">=</span><span class="n">num</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">vmin</span><span class="o">=</span><span class="n">vmin</span><span class="p">,</span> <span class="n">vmax</span><span class="o">=</span><span class="n">vmax</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">component</span><span class="p">[</span><span class="s1">&#39;type&#39;</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;blip&#39;</span><span class="p">:</span>
<span class="n">_mx</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">nanmax</span><span class="p">(</span><span class="n">signal</span><span class="p">)</span>
<span class="n">_mn</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">nanmin</span><span class="p">(</span><span class="n">signal</span><span class="p">)</span>
<span class="n">_mx</span> <span class="o">+=</span> <span class="mi">2</span><span class="o">*</span><span class="n">_mx</span> <span class="k">if</span> <span class="n">_mx</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">else</span> <span class="o">-</span><span class="mi">2</span><span class="o">*</span><span class="n">_mx</span>
<span class="n">_mn</span> <span class="o">+=</span> <span class="o">-</span><span class="mi">2</span><span class="o">*</span><span class="n">_mn</span> <span class="k">if</span> <span class="n">_mn</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">else</span> <span class="mi">2</span><span class="o">*</span><span class="n">_mn</span>
<span class="k">if</span> <span class="n">vmax</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">_mx</span> <span class="o">=</span> <span class="nb">min</span><span class="p">(</span><span class="n">_mx</span><span class="p">,</span> <span class="n">vmax</span><span class="p">)</span> <span class="k">if</span> <span class="n">vmax</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">else</span> <span class="nb">max</span><span class="p">(</span><span class="n">_mx</span><span class="p">,</span> <span class="n">vmax</span><span class="p">)</span>
<span class="k">if</span> <span class="n">vmin</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">_mn</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">_mn</span><span class="p">,</span> <span class="n">vmin</span><span class="p">)</span> <span class="k">if</span> <span class="n">vmin</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">else</span> <span class="nb">min</span><span class="p">(</span><span class="n">_mn</span><span class="p">,</span> <span class="n">vmin</span><span class="p">)</span>
<span class="n">start</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">signal</span><span class="p">))</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="p">[</span><span class="n">_mx</span><span class="p">]</span> <span class="k">if</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">rand</span><span class="p">()</span> <span class="o">&gt;=</span> <span class="o">.</span><span class="mi">5</span> <span class="k">else</span> <span class="p">[</span><span class="o">-</span><span class="n">_mn</span><span class="p">]</span>
<span class="n">last_num</span> <span class="o">=</span> <span class="n">num</span>
<span class="n">last_it</span> <span class="o">=</span> <span class="n">it</span>
<span class="n">signal</span> <span class="o">=</span> <span class="n">_append</span><span class="p">(</span><span class="n">additive</span><span class="p">,</span> <span class="n">start</span><span class="p">,</span> <span class="n">signal</span><span class="p">,</span> <span class="n">tmp</span><span class="p">)</span>
<span class="k">return</span> <span class="n">signal</span></div></div>
<div class="viewcode-block" id="generate_gaussian_linear"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.artificial.generate_gaussian_linear">[docs]</a><span class="k">def</span> <span class="nf">generate_gaussian_linear</span><span class="p">(</span><span class="n">mu_ini</span><span class="p">,</span> <span class="n">sigma_ini</span><span class="p">,</span> <span class="n">mu_inc</span><span class="p">,</span> <span class="n">sigma_inc</span><span class="p">,</span> <span class="n">it</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">vmin</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">vmax</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Generate data sampled from Gaussian distribution, with constant or linear changing parameters</span>
@ -108,6 +250,88 @@
<span class="k">return</span> <span class="n">ret</span></div>
<div class="viewcode-block" id="generate_linear_periodic_gaussian"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.artificial.generate_linear_periodic_gaussian">[docs]</a><span class="k">def</span> <span class="nf">generate_linear_periodic_gaussian</span><span class="p">(</span><span class="n">period</span><span class="p">,</span> <span class="n">mu_min</span><span class="p">,</span> <span class="n">sigma_min</span><span class="p">,</span> <span class="n">mu_max</span><span class="p">,</span> <span class="n">sigma_max</span><span class="p">,</span> <span class="n">it</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">vmin</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">vmax</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Generates a periodic linear variation on mean and variance</span>
<span class="sd"> :param period: the period of recurrence</span>
<span class="sd"> :param mu_min: initial (and minimum) mean of each period</span>
<span class="sd"> :param sigma_min: initial (and minimum) variance of each period</span>
<span class="sd"> :param mu_max: final (and maximum) mean of each period</span>
<span class="sd"> :param sigma_max: final (and maximum) variance of each period</span>
<span class="sd"> :param it: Number of iterations</span>
<span class="sd"> :param num: Number of samples generated on each iteration</span>
<span class="sd"> :param vmin: Lower bound value of generated data</span>
<span class="sd"> :param vmax: Upper bound value of generated data</span>
<span class="sd"> :return: A list of it*num float values</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">period</span> <span class="o">&gt;</span> <span class="n">it</span><span class="p">:</span>
<span class="k">raise</span><span class="p">(</span><span class="s2">&quot;The &#39;period&#39; parameter must be lesser than &#39;it&#39; parameter&quot;</span><span class="p">)</span>
<span class="n">mu_inc</span> <span class="o">=</span> <span class="p">(</span><span class="n">mu_max</span> <span class="o">-</span> <span class="n">mu_min</span><span class="p">)</span><span class="o">/</span><span class="n">period</span>
<span class="n">sigma_inc</span> <span class="o">=</span> <span class="p">(</span><span class="n">sigma_max</span> <span class="o">-</span> <span class="n">sigma_min</span><span class="p">)</span> <span class="o">/</span> <span class="n">period</span>
<span class="n">mu</span> <span class="o">=</span> <span class="n">mu_min</span>
<span class="n">sigma</span> <span class="o">=</span> <span class="n">sigma_min</span>
<span class="n">ret</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">signal</span> <span class="o">=</span> <span class="kc">True</span>
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">it</span><span class="p">):</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="n">mu</span><span class="p">,</span> <span class="n">sigma</span><span class="p">,</span> <span class="n">num</span><span class="p">)</span>
<span class="k">if</span> <span class="n">vmin</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">maximum</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">full</span><span class="p">(</span><span class="n">num</span><span class="p">,</span> <span class="n">vmin</span><span class="p">),</span> <span class="n">tmp</span><span class="p">)</span>
<span class="k">if</span> <span class="n">vmax</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">minimum</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">full</span><span class="p">(</span><span class="n">num</span><span class="p">,</span> <span class="n">vmax</span><span class="p">),</span> <span class="n">tmp</span><span class="p">)</span>
<span class="n">ret</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">tmp</span><span class="p">)</span>
<span class="k">if</span> <span class="n">k</span> <span class="o">%</span> <span class="n">period</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">signal</span> <span class="o">=</span> <span class="ow">not</span> <span class="n">signal</span>
<span class="n">mu</span> <span class="o">+=</span> <span class="p">(</span><span class="n">mu_inc</span> <span class="k">if</span> <span class="n">signal</span> <span class="k">else</span> <span class="o">-</span><span class="n">mu_inc</span><span class="p">)</span>
<span class="n">sigma</span> <span class="o">+=</span> <span class="p">(</span><span class="n">sigma_inc</span> <span class="k">if</span> <span class="n">signal</span> <span class="k">else</span> <span class="o">-</span><span class="n">sigma_inc</span><span class="p">)</span>
<span class="n">sigma</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">sigma</span><span class="p">,</span> <span class="mf">0.005</span><span class="p">)</span>
<span class="k">return</span> <span class="n">ret</span></div>
<div class="viewcode-block" id="generate_sinoidal_periodic_gaussian"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.artificial.generate_sinoidal_periodic_gaussian">[docs]</a><span class="k">def</span> <span class="nf">generate_sinoidal_periodic_gaussian</span><span class="p">(</span><span class="n">period</span><span class="p">,</span> <span class="n">mu_min</span><span class="p">,</span> <span class="n">sigma_min</span><span class="p">,</span> <span class="n">mu_max</span><span class="p">,</span> <span class="n">sigma_max</span><span class="p">,</span> <span class="n">it</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">vmin</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">vmax</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Generates a periodic sinoidal variation on mean and variance</span>
<span class="sd"> :param period: the period of recurrence</span>
<span class="sd"> :param mu_min: initial (and minimum) mean of each period</span>
<span class="sd"> :param sigma_min: initial (and minimum) variance of each period</span>
<span class="sd"> :param mu_max: final (and maximum) mean of each period</span>
<span class="sd"> :param sigma_max: final (and maximum) variance of each period</span>
<span class="sd"> :param it: Number of iterations</span>
<span class="sd"> :param num: Number of samples generated on each iteration</span>
<span class="sd"> :param vmin: Lower bound value of generated data</span>
<span class="sd"> :param vmax: Upper bound value of generated data</span>
<span class="sd"> :return: A list of it*num float values</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">mu_range</span> <span class="o">=</span> <span class="n">mu_max</span> <span class="o">-</span> <span class="n">mu_min</span>
<span class="n">sigma_range</span> <span class="o">=</span> <span class="n">sigma_max</span> <span class="o">-</span> <span class="n">sigma_min</span>
<span class="n">mu</span> <span class="o">=</span> <span class="n">mu_min</span>
<span class="n">sigma</span> <span class="o">=</span> <span class="n">sigma_min</span>
<span class="n">ret</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">it</span><span class="p">):</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="n">mu</span><span class="p">,</span> <span class="n">sigma</span><span class="p">,</span> <span class="n">num</span><span class="p">)</span>
<span class="k">if</span> <span class="n">vmin</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">maximum</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">full</span><span class="p">(</span><span class="n">num</span><span class="p">,</span> <span class="n">vmin</span><span class="p">),</span> <span class="n">tmp</span><span class="p">)</span>
<span class="k">if</span> <span class="n">vmax</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">minimum</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">full</span><span class="p">(</span><span class="n">num</span><span class="p">,</span> <span class="n">vmax</span><span class="p">),</span> <span class="n">tmp</span><span class="p">)</span>
<span class="n">ret</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">tmp</span><span class="p">)</span>
<span class="n">mu</span> <span class="o">+=</span> <span class="n">mu_range</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="n">period</span> <span class="o">*</span> <span class="n">k</span><span class="p">)</span>
<span class="n">sigma</span> <span class="o">+=</span> <span class="n">sigma_range</span> <span class="o">*</span> <span class="n">np</span><span class="o">.</span><span class="n">sin</span><span class="p">(</span><span class="n">period</span> <span class="o">*</span> <span class="n">k</span><span class="p">)</span>
<span class="n">sigma</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">sigma</span><span class="p">,</span> <span class="mf">0.005</span><span class="p">)</span>
<span class="k">return</span> <span class="n">ret</span></div>
<div class="viewcode-block" id="generate_uniform_linear"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.artificial.generate_uniform_linear">[docs]</a><span class="k">def</span> <span class="nf">generate_uniform_linear</span><span class="p">(</span><span class="n">min_ini</span><span class="p">,</span> <span class="n">max_ini</span><span class="p">,</span> <span class="n">min_inc</span><span class="p">,</span> <span class="n">max_inc</span><span class="p">,</span> <span class="n">it</span><span class="o">=</span><span class="mi">100</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="mi">10</span><span class="p">,</span> <span class="n">vmin</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">vmax</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Generate data sampled from Uniform distribution, with constant or linear changing bounds</span>
@ -138,10 +362,22 @@
<div class="viewcode-block" id="white_noise"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.artificial.white_noise">[docs]</a><span class="k">def</span> <span class="nf">white_noise</span><span class="p">(</span><span class="n">n</span><span class="o">=</span><span class="mi">500</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Simple Gaussian noise signal</span>
<span class="sd"> :param n: number of samples</span>
<span class="sd"> :return:</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">normal</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">n</span><span class="p">)</span></div>
<div class="viewcode-block" id="random_walk"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.artificial.random_walk">[docs]</a><span class="k">def</span> <span class="nf">random_walk</span><span class="p">(</span><span class="n">n</span><span class="o">=</span><span class="mi">500</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s1">&#39;gaussian&#39;</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Simple random walk</span>
<span class="sd"> </span>
<span class="sd"> :param n: number of samples</span>
<span class="sd"> :param type: &#39;gaussian&#39; or &#39;uniform&#39;</span>
<span class="sd"> :return:</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">type</span> <span class="o">==</span> <span class="s1">&#39;gaussian&#39;</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">generate_gaussian_linear</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">it</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">num</span><span class="o">=</span><span class="n">n</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
@ -152,6 +388,30 @@
<span class="k">return</span> <span class="n">ret</span></div>
<span class="k">def</span> <span class="nf">_append</span><span class="p">(</span><span class="n">additive</span><span class="p">,</span> <span class="n">start</span><span class="p">,</span> <span class="n">before</span><span class="p">,</span> <span class="n">new</span><span class="p">):</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">additive</span><span class="p">:</span>
<span class="n">before</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">new</span><span class="p">)</span>
<span class="k">return</span> <span class="n">before</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">start</span><span class="p">):</span>
<span class="n">new</span><span class="o">.</span><span class="n">insert</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span>
<span class="n">l1</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">before</span><span class="p">)</span>
<span class="n">l2</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">new</span><span class="p">)</span>
<span class="k">if</span> <span class="n">l2</span> <span class="o">&lt;</span> <span class="n">l1</span><span class="p">:</span>
<span class="n">new</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">zeros</span><span class="p">(</span><span class="n">l1</span> <span class="o">-</span> <span class="n">l2</span><span class="p">)</span><span class="o">.</span><span class="n">tolist</span><span class="p">())</span>
<span class="k">elif</span> <span class="mi">0</span> <span class="o">&lt;</span> <span class="n">l1</span> <span class="o">&lt;</span> <span class="n">l2</span><span class="p">:</span>
<span class="n">new</span> <span class="o">=</span> <span class="n">new</span><span class="p">[:</span><span class="n">l1</span><span class="p">]</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">before</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">new</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">before</span><span class="p">)</span> <span class="o">+</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">new</span><span class="p">)</span>
<span class="k">return</span> <span class="n">tmp</span><span class="o">.</span><span class="n">tolist</span><span class="p">()</span>
</pre></div>
</div>

View File

@ -0,0 +1,432 @@
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-55120145-3']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<title>pyFTS.distributed.spark &#8212; pyFTS 1.4 documentation</title>
<link rel="stylesheet" href="../../../_static/bizstyle.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../../_static/documentation_options.js"></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="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="../../../_static/bizstyle.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!--[if lt IE 9]>
<script type="text/javascript" src="_static/css3-mediaqueries.js"></script>
<![endif]-->
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">pyFTS 1.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../../index.html">
<img class="logo" src="../../../_static/logo_heading2.png" alt="Logo"/>
</a></p>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<h1>Source code for pyFTS.distributed.spark</h1><div class="highlight"><pre>
<span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
<span class="kn">from</span> <span class="nn">pyFTS.data</span> <span class="k">import</span> <span class="n">Enrollments</span><span class="p">,</span> <span class="n">TAIEX</span>
<span class="kn">from</span> <span class="nn">pyFTS.partitioners</span> <span class="k">import</span> <span class="n">Grid</span><span class="p">,</span> <span class="n">Simple</span>
<span class="kn">from</span> <span class="nn">pyFTS.models.multivariate</span> <span class="k">import</span> <span class="n">partitioner</span> <span class="k">as</span> <span class="n">mv_partitioner</span>
<span class="kn">from</span> <span class="nn">pyFTS.models</span> <span class="k">import</span> <span class="n">hofts</span>
<span class="kn">from</span> <span class="nn">pyspark</span> <span class="k">import</span> <span class="n">SparkConf</span>
<span class="kn">from</span> <span class="nn">pyspark</span> <span class="k">import</span> <span class="n">SparkContext</span>
<span class="kn">import</span> <span class="nn">os</span>
<span class="c1"># make sure pyspark tells workers to use python3 not 2 if both are installed</span>
<span class="n">SPARK_ADDR</span> <span class="o">=</span> <span class="s1">&#39;spark://192.168.0.110:7077&#39;</span>
<span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">&#39;PYSPARK_PYTHON&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;/usr/bin/python3&#39;</span>
<span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s1">&#39;PYSPARK_DRIVER_PYTHON&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="s1">&#39;/usr/bin/python3&#39;</span>
<div class="viewcode-block" id="create_spark_conf"><a class="viewcode-back" href="../../../pyFTS.distributed.html#pyFTS.distributed.spark.create_spark_conf">[docs]</a><span class="k">def</span> <span class="nf">create_spark_conf</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="n">spark_executor_memory</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;spark_executor_memory&quot;</span><span class="p">,</span> <span class="s2">&quot;2g&quot;</span><span class="p">)</span>
<span class="n">spark_driver_memory</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;spark_driver_memory&quot;</span><span class="p">,</span> <span class="s2">&quot;2g&quot;</span><span class="p">)</span>
<span class="n">url</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;url&quot;</span><span class="p">,</span> <span class="n">SPARK_ADDR</span><span class="p">)</span>
<span class="n">app</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;app&quot;</span><span class="p">,</span> <span class="s1">&#39;pyFTS&#39;</span><span class="p">)</span>
<span class="n">conf</span> <span class="o">=</span> <span class="n">SparkConf</span><span class="p">()</span>
<span class="n">conf</span><span class="o">.</span><span class="n">setMaster</span><span class="p">(</span><span class="n">url</span><span class="p">)</span>
<span class="n">conf</span><span class="o">.</span><span class="n">setAppName</span><span class="p">(</span><span class="n">app</span><span class="p">)</span>
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">&quot;spark.executor.memory&quot;</span><span class="p">,</span> <span class="n">spark_executor_memory</span><span class="p">)</span>
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">&quot;spark.driver.memory&quot;</span><span class="p">,</span> <span class="n">spark_driver_memory</span><span class="p">)</span>
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">&quot;spark.memory.offHeap.enabled&quot;</span><span class="p">,</span><span class="kc">True</span><span class="p">)</span>
<span class="n">conf</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s2">&quot;spark.memory.offHeap.size&quot;</span><span class="p">,</span><span class="s2">&quot;16g&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">conf</span></div>
<div class="viewcode-block" id="get_partitioner"><a class="viewcode-back" href="../../../pyFTS.distributed.html#pyFTS.distributed.spark.get_partitioner">[docs]</a><span class="k">def</span> <span class="nf">get_partitioner</span><span class="p">(</span><span class="n">shared_partitioner</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s1">&#39;common&#39;</span><span class="p">,</span> <span class="n">variables</span><span class="o">=</span><span class="p">[]):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> :param part:</span>
<span class="sd"> :return:</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">if</span> <span class="nb">type</span><span class="o">==</span><span class="s1">&#39;common&#39;</span><span class="p">:</span>
<span class="n">fs_tmp</span> <span class="o">=</span> <span class="n">Simple</span><span class="o">.</span><span class="n">SimplePartitioner</span><span class="p">()</span>
<span class="k">for</span> <span class="n">fset</span> <span class="ow">in</span> <span class="n">shared_partitioner</span><span class="o">.</span><span class="n">value</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
<span class="n">fz</span> <span class="o">=</span> <span class="n">shared_partitioner</span><span class="o">.</span><span class="n">value</span><span class="p">[</span><span class="n">fset</span><span class="p">]</span>
<span class="k">if</span> <span class="nb">type</span><span class="o">==</span><span class="s1">&#39;common&#39;</span><span class="p">:</span>
<span class="n">fs_tmp</span><span class="o">.</span><span class="n">append_complex</span><span class="p">(</span><span class="n">fz</span><span class="p">)</span>
<span class="k">elif</span> <span class="nb">type</span> <span class="o">==</span> <span class="s1">&#39;multivariate&#39;</span><span class="p">:</span>
<span class="n">fs_tmp</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">fz</span><span class="p">)</span>
<span class="k">return</span> <span class="n">fs_tmp</span></div>
<div class="viewcode-block" id="get_clustered_partitioner"><a class="viewcode-back" href="../../../pyFTS.distributed.html#pyFTS.distributed.spark.get_clustered_partitioner">[docs]</a><span class="k">def</span> <span class="nf">get_clustered_partitioner</span><span class="p">(</span><span class="n">explanatory_variables</span><span class="p">,</span> <span class="n">target_variable</span><span class="p">,</span> <span class="o">**</span><span class="n">parameters</span><span class="p">):</span>
<span class="kn">from</span> <span class="nn">pyFTS.models.multivariate.common</span> <span class="k">import</span> <span class="n">MultivariateFuzzySet</span>
<span class="n">fs_tmp</span> <span class="o">=</span> <span class="n">mv_partitioner</span><span class="o">.</span><span class="n">MultivariatePartitioner</span><span class="p">(</span><span class="n">explanatory_variables</span><span class="o">=</span><span class="n">explanatory_variables</span><span class="p">,</span>
<span class="n">target_variable</span><span class="o">=</span><span class="n">target_variable</span><span class="p">)</span>
<span class="k">for</span> <span class="n">tmp</span> <span class="ow">in</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;partitioner_names&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">:</span>
<span class="n">fs</span> <span class="o">=</span> <span class="n">MultivariateFuzzySet</span><span class="p">(</span><span class="n">target_variable</span><span class="o">=</span><span class="n">target_variable</span><span class="p">)</span>
<span class="k">for</span> <span class="n">var</span><span class="p">,</span> <span class="n">fset</span> <span class="ow">in</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;partitioner_</span><span class="si">{}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">tmp</span><span class="p">)]</span><span class="o">.</span><span class="n">value</span><span class="p">:</span>
<span class="n">fs</span><span class="o">.</span><span class="n">append_set</span><span class="p">(</span><span class="n">var</span><span class="p">,</span> <span class="n">fset</span><span class="p">)</span>
<span class="n">fs_tmp</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">fs</span><span class="p">)</span>
<span class="n">fs_tmp</span><span class="o">.</span><span class="n">build_index</span><span class="p">()</span>
<span class="k">return</span> <span class="n">fs_tmp</span></div>
<div class="viewcode-block" id="get_variables"><a class="viewcode-back" href="../../../pyFTS.distributed.html#pyFTS.distributed.spark.get_variables">[docs]</a><span class="k">def</span> <span class="nf">get_variables</span><span class="p">(</span><span class="o">**</span><span class="n">parameters</span><span class="p">):</span>
<span class="n">explanatory_variables</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">target_variable</span> <span class="o">=</span> <span class="kc">None</span>
<span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;variables&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">pyFTS.models.multivariate</span> <span class="k">import</span> <span class="n">common</span><span class="p">,</span> <span class="n">variable</span>
<span class="n">var</span> <span class="o">=</span> <span class="n">variable</span><span class="o">.</span><span class="n">Variable</span><span class="p">(</span><span class="n">name</span><span class="p">,</span>
<span class="nb">type</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;</span><span class="si">{}</span><span class="s1">_type&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">name</span><span class="p">)]</span><span class="o">.</span><span class="n">value</span><span class="p">,</span>
<span class="n">data_label</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;</span><span class="si">{}</span><span class="s1">_label&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">name</span><span class="p">)]</span><span class="o">.</span><span class="n">value</span><span class="p">,</span>
<span class="n">alpha_cut</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;</span><span class="si">{}</span><span class="s1">_alpha&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">name</span><span class="p">)]</span><span class="o">.</span><span class="n">value</span><span class="p">,</span>
<span class="c1">#data_type=parameters[&#39;{}_data_type&#39;.format(name)].value,</span>
<span class="c1">#mask=parameters[&#39;{}_mask&#39;.format(name)].value,</span>
<span class="p">)</span>
<span class="n">var</span><span class="o">.</span><span class="n">partitioner</span> <span class="o">=</span> <span class="n">get_partitioner</span><span class="p">(</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;</span><span class="si">{}</span><span class="s1">_partitioner&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">name</span><span class="p">)])</span>
<span class="n">var</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">type</span> <span class="o">=</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;</span><span class="si">{}</span><span class="s1">_partitioner_type&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">name</span><span class="p">)]</span><span class="o">.</span><span class="n">value</span>
<span class="n">explanatory_variables</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">var</span><span class="p">)</span>
<span class="k">if</span> <span class="n">var</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;target&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">:</span>
<span class="n">target_variable</span> <span class="o">=</span> <span class="n">var</span>
<span class="k">return</span> <span class="p">(</span><span class="n">explanatory_variables</span><span class="p">,</span> <span class="n">target_variable</span><span class="p">)</span></div>
<div class="viewcode-block" id="create_univariate_model"><a class="viewcode-back" href="../../../pyFTS.distributed.html#pyFTS.distributed.spark.create_univariate_model">[docs]</a><span class="k">def</span> <span class="nf">create_univariate_model</span><span class="p">(</span><span class="o">**</span><span class="n">parameters</span><span class="p">):</span>
<span class="k">if</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;order&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
<span class="n">model</span> <span class="o">=</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;method&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">(</span><span class="n">partitioner</span><span class="o">=</span><span class="n">get_partitioner</span><span class="p">(</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;partitioner&#39;</span><span class="p">]),</span>
<span class="n">order</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;order&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">,</span> <span class="n">alpha_cut</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;alpha_cut&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">,</span>
<span class="n">lags</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;lags&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">model</span> <span class="o">=</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;method&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">(</span><span class="n">partitioner</span><span class="o">=</span><span class="n">get_partitioner</span><span class="p">(</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;partitioner&#39;</span><span class="p">]),</span>
<span class="n">alpha_cut</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;alpha_cut&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">)</span>
<span class="k">return</span> <span class="n">model</span></div>
<div class="viewcode-block" id="slave_train_univariate"><a class="viewcode-back" href="../../../pyFTS.distributed.html#pyFTS.distributed.spark.slave_train_univariate">[docs]</a><span class="k">def</span> <span class="nf">slave_train_univariate</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="n">parameters</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> :param data:</span>
<span class="sd"> :return:</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">model</span> <span class="o">=</span> <span class="n">create_univariate_model</span><span class="p">(</span><span class="o">**</span><span class="n">parameters</span><span class="p">)</span>
<span class="n">ndata</span> <span class="o">=</span> <span class="p">[</span><span class="n">k</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">data</span><span class="p">]</span>
<span class="n">model</span><span class="o">.</span><span class="n">train</span><span class="p">(</span><span class="n">ndata</span><span class="p">)</span>
<span class="k">return</span> <span class="p">[(</span><span class="n">k</span><span class="p">,</span> <span class="n">model</span><span class="o">.</span><span class="n">flrgs</span><span class="p">[</span><span class="n">k</span><span class="p">])</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">model</span><span class="o">.</span><span class="n">flrgs</span><span class="o">.</span><span class="n">keys</span><span class="p">()]</span></div>
<div class="viewcode-block" id="slave_forecast_univariate"><a class="viewcode-back" href="../../../pyFTS.distributed.html#pyFTS.distributed.spark.slave_forecast_univariate">[docs]</a><span class="k">def</span> <span class="nf">slave_forecast_univariate</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="n">parameters</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> :param data:</span>
<span class="sd"> :return:</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">model</span> <span class="o">=</span> <span class="n">create_univariate_model</span><span class="p">(</span><span class="o">**</span><span class="n">parameters</span><span class="p">)</span>
<span class="n">ndata</span> <span class="o">=</span> <span class="p">[</span><span class="n">k</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">data</span><span class="p">]</span>
<span class="n">forecasts</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">ndata</span><span class="p">)</span>
<span class="k">return</span> <span class="p">[(</span><span class="n">k</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">forecasts</span><span class="p">]</span></div>
<div class="viewcode-block" id="create_multivariate_model"><a class="viewcode-back" href="../../../pyFTS.distributed.html#pyFTS.distributed.spark.create_multivariate_model">[docs]</a><span class="k">def</span> <span class="nf">create_multivariate_model</span><span class="p">(</span><span class="o">**</span><span class="n">parameters</span><span class="p">):</span>
<span class="n">explanatory_variables</span><span class="p">,</span> <span class="n">target_variable</span> <span class="o">=</span> <span class="n">get_variables</span><span class="p">(</span><span class="o">**</span><span class="n">parameters</span><span class="p">)</span>
<span class="c1">#vars = [(v.name, v.name) for v in explanatory_variables]</span>
<span class="c1">#return [(&#39;vars&#39;, vars), (&#39;target&#39;,[target_variable.name])]</span>
<span class="k">if</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;type&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span> <span class="o">==</span> <span class="s1">&#39;clustered&#39;</span><span class="p">:</span>
<span class="n">fs</span> <span class="o">=</span> <span class="n">get_clustered_partitioner</span><span class="p">(</span><span class="n">explanatory_variables</span><span class="p">,</span> <span class="n">target_variable</span><span class="p">,</span> <span class="o">**</span><span class="n">parameters</span><span class="p">)</span>
<span class="n">model</span> <span class="o">=</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;method&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">(</span><span class="n">explanatory_variables</span><span class="o">=</span><span class="n">explanatory_variables</span><span class="p">,</span>
<span class="n">target_variable</span><span class="o">=</span><span class="n">target_variable</span><span class="p">,</span>
<span class="n">partitioner</span><span class="o">=</span><span class="n">fs</span><span class="p">,</span>
<span class="n">order</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;order&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">,</span>
<span class="n">alpha_cut</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;alpha_cut&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">,</span>
<span class="n">lags</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;lags&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;order&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
<span class="n">model</span> <span class="o">=</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;method&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">(</span><span class="n">explanatory_variables</span><span class="o">=</span><span class="n">explanatory_variables</span><span class="p">,</span>
<span class="n">target_variable</span><span class="o">=</span><span class="n">target_variable</span><span class="p">,</span>
<span class="n">order</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;order&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">,</span>
<span class="n">alpha_cut</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;alpha_cut&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">,</span>
<span class="n">lags</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;lags&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">model</span> <span class="o">=</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;method&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">(</span><span class="n">explanatory_variables</span><span class="o">=</span><span class="n">explanatory_variables</span><span class="p">,</span>
<span class="n">target_variable</span><span class="o">=</span><span class="n">target_variable</span><span class="p">,</span>
<span class="n">alpha_cut</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;alpha_cut&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">)</span>
<span class="k">return</span> <span class="n">model</span></div>
<div class="viewcode-block" id="slave_train_multivariate"><a class="viewcode-back" href="../../../pyFTS.distributed.html#pyFTS.distributed.spark.slave_train_multivariate">[docs]</a><span class="k">def</span> <span class="nf">slave_train_multivariate</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="n">parameters</span><span class="p">):</span>
<span class="n">model</span> <span class="o">=</span> <span class="n">create_multivariate_model</span><span class="p">(</span><span class="o">**</span><span class="n">parameters</span><span class="p">)</span>
<span class="n">rows</span> <span class="o">=</span> <span class="p">[</span><span class="n">k</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">data</span><span class="p">]</span>
<span class="n">ndata</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="o">.</span><span class="n">from_records</span><span class="p">(</span><span class="n">rows</span><span class="p">,</span> <span class="n">columns</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;columns&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">)</span>
<span class="n">model</span><span class="o">.</span><span class="n">train</span><span class="p">(</span><span class="n">ndata</span><span class="p">)</span>
<span class="k">if</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;type&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span> <span class="o">==</span> <span class="s1">&#39;clustered&#39;</span><span class="p">:</span>
<span class="n">counts</span> <span class="o">=</span> <span class="p">[(</span><span class="n">fset</span><span class="p">,</span> <span class="n">count</span><span class="p">)</span> <span class="k">for</span> <span class="n">fset</span><span class="p">,</span><span class="n">count</span> <span class="ow">in</span> <span class="n">model</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">count</span><span class="o">.</span><span class="n">items</span><span class="p">()]</span>
<span class="n">flrgs</span> <span class="o">=</span> <span class="p">[(</span><span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span><span class="n">v</span> <span class="ow">in</span> <span class="n">model</span><span class="o">.</span><span class="n">flrgs</span><span class="o">.</span><span class="n">items</span><span class="p">()]</span>
<span class="k">return</span> <span class="p">[(</span><span class="s1">&#39;counts&#39;</span><span class="p">,</span> <span class="n">counts</span><span class="p">),</span> <span class="p">(</span><span class="s1">&#39;flrgs&#39;</span><span class="p">,</span> <span class="n">flrgs</span><span class="p">)]</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="p">[(</span><span class="n">k</span><span class="p">,</span> <span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span><span class="n">v</span> <span class="ow">in</span> <span class="n">model</span><span class="o">.</span><span class="n">flrgs</span><span class="o">.</span><span class="n">items</span><span class="p">()]</span></div>
<div class="viewcode-block" id="slave_forecast_multivariate"><a class="viewcode-back" href="../../../pyFTS.distributed.html#pyFTS.distributed.spark.slave_forecast_multivariate">[docs]</a><span class="k">def</span> <span class="nf">slave_forecast_multivariate</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="n">parameters</span><span class="p">):</span>
<span class="n">model</span> <span class="o">=</span> <span class="n">create_multivariate_model</span><span class="p">(</span><span class="o">**</span><span class="n">parameters</span><span class="p">)</span>
<span class="n">rows</span> <span class="o">=</span> <span class="p">[</span><span class="n">k</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">data</span><span class="p">]</span>
<span class="n">ndata</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="o">.</span><span class="n">from_records</span><span class="p">(</span><span class="n">rows</span><span class="p">,</span> <span class="n">columns</span><span class="o">=</span><span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;columns&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span><span class="p">)</span>
<span class="n">forecasts</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">ndata</span><span class="p">)</span>
<span class="k">return</span> <span class="p">[(</span><span class="n">k</span><span class="p">,</span> <span class="n">k</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">forecasts</span><span class="p">]</span></div>
<div class="viewcode-block" id="share_parameters"><a class="viewcode-back" href="../../../pyFTS.distributed.html#pyFTS.distributed.spark.share_parameters">[docs]</a><span class="k">def</span> <span class="nf">share_parameters</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">context</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="n">parameters</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">model</span><span class="o">.</span><span class="n">is_multivariate</span><span class="p">:</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;type&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="s1">&#39;common&#39;</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;partitioner&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">sets</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;alpha_cut&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">alpha_cut</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;order&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">order</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;method&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">model</span><span class="p">))</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;lags&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">lags</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;max_lag&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">max_lag</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">if</span> <span class="n">model</span><span class="o">.</span><span class="n">is_clustered</span><span class="p">:</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;type&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="s1">&#39;clustered&#39;</span><span class="p">)</span>
<span class="n">names</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">fset</span> <span class="ow">in</span> <span class="n">model</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">sets</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="n">names</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">name</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;partitioner_</span><span class="si">{}</span><span class="s1">&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">name</span><span class="p">)]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">([(</span><span class="n">k</span><span class="p">,</span><span class="n">v</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span><span class="p">,</span><span class="n">v</span> <span class="ow">in</span> <span class="n">fset</span><span class="o">.</span><span class="n">sets</span><span class="o">.</span><span class="n">items</span><span class="p">()])</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;partitioner_names&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">names</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;type&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="s1">&#39;multivariate&#39;</span><span class="p">)</span>
<span class="n">names</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">var</span> <span class="ow">in</span> <span class="n">model</span><span class="o">.</span><span class="n">explanatory_variables</span><span class="p">:</span>
<span class="c1">#if var.data_type is None:</span>
<span class="c1"># raise Exception(&quot;It is mandatory to inform the data_type parameter for each variable when the training is distributed! &quot;)</span>
<span class="n">names</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">var</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;</span><span class="si">{}</span><span class="s1">_type&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">var</span><span class="o">.</span><span class="n">name</span><span class="p">)]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">var</span><span class="o">.</span><span class="n">type</span><span class="p">)</span>
<span class="c1">#parameters[&#39;{}_data_type&#39;.format(var.name)] = context.broadcast(var.data_type)</span>
<span class="c1">#parameters[&#39;{}_mask&#39;.format(var.name)] = context.broadcast(var.mask)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;</span><span class="si">{}</span><span class="s1">_label&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">var</span><span class="o">.</span><span class="n">name</span><span class="p">)]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">var</span><span class="o">.</span><span class="n">data_label</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;</span><span class="si">{}</span><span class="s1">_alpha&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">var</span><span class="o">.</span><span class="n">name</span><span class="p">)]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">var</span><span class="o">.</span><span class="n">alpha_cut</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;</span><span class="si">{}</span><span class="s1">_partitioner&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">var</span><span class="o">.</span><span class="n">name</span><span class="p">)]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">var</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">sets</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;</span><span class="si">{}</span><span class="s1">_partitioner_type&#39;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">var</span><span class="o">.</span><span class="n">name</span><span class="p">)]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">var</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">type</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;variables&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">names</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;target&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">target_variable</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;columns&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">columns</span><span class="o">.</span><span class="n">values</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;alpha_cut&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">alpha_cut</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;order&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">order</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;method&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">model</span><span class="p">))</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;lags&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">lags</span><span class="p">)</span>
<span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;max_lag&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">broadcast</span><span class="p">(</span><span class="n">model</span><span class="o">.</span><span class="n">max_lag</span><span class="p">)</span>
<span class="k">return</span> <span class="n">parameters</span></div>
<div class="viewcode-block" id="distributed_train"><a class="viewcode-back" href="../../../pyFTS.distributed.html#pyFTS.distributed.spark.distributed_train">[docs]</a><span class="k">def</span> <span class="nf">distributed_train</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> :param model:</span>
<span class="sd"> :param data:</span>
<span class="sd"> :param url:</span>
<span class="sd"> :param app:</span>
<span class="sd"> :return:</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">num_batches</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;num_batches&quot;</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="n">conf</span> <span class="o">=</span> <span class="n">create_spark_conf</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">with</span> <span class="n">SparkContext</span><span class="p">(</span><span class="n">conf</span><span class="o">=</span><span class="n">conf</span><span class="p">)</span> <span class="k">as</span> <span class="n">context</span><span class="p">:</span>
<span class="n">nodes</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">defaultParallelism</span>
<span class="n">parameters</span> <span class="o">=</span> <span class="n">share_parameters</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">context</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">model</span><span class="o">.</span><span class="n">is_multivariate</span><span class="p">:</span>
<span class="n">func</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">slave_train_univariate</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="o">**</span><span class="n">parameters</span><span class="p">)</span>
<span class="n">flrgs</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">parallelize</span><span class="p">(</span><span class="n">data</span><span class="p">)</span><span class="o">.</span><span class="n">repartition</span><span class="p">(</span><span class="n">nodes</span><span class="o">*</span><span class="n">num_batches</span><span class="p">)</span><span class="o">.</span><span class="n">mapPartitions</span><span class="p">(</span><span class="n">func</span><span class="p">)</span>
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">flrgs</span><span class="o">.</span><span class="n">collect</span><span class="p">():</span>
<span class="n">model</span><span class="o">.</span><span class="n">append_rule</span><span class="p">(</span><span class="n">k</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">to_dict</span><span class="p">(</span><span class="n">orient</span><span class="o">=</span><span class="s1">&#39;records&#39;</span><span class="p">)</span>
<span class="n">func</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">slave_train_multivariate</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="o">**</span><span class="n">parameters</span><span class="p">)</span>
<span class="n">flrgs</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">parallelize</span><span class="p">(</span><span class="n">data</span><span class="p">)</span><span class="o">.</span><span class="n">mapPartitions</span><span class="p">(</span><span class="n">func</span><span class="p">)</span>
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">flrgs</span><span class="o">.</span><span class="n">collect</span><span class="p">():</span>
<span class="k">if</span> <span class="n">parameters</span><span class="p">[</span><span class="s1">&#39;type&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">value</span> <span class="o">==</span> <span class="s1">&#39;clustered&#39;</span><span class="p">:</span>
<span class="k">if</span> <span class="n">k</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;counts&#39;</span><span class="p">:</span>
<span class="k">for</span> <span class="n">fset</span><span class="p">,</span> <span class="n">count</span> <span class="ow">in</span> <span class="n">k</span><span class="p">[</span><span class="mi">1</span><span class="p">]:</span>
<span class="n">model</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">count</span><span class="p">[</span><span class="n">fset</span><span class="p">]</span> <span class="o">=</span> <span class="n">count</span>
<span class="k">elif</span> <span class="n">k</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s1">&#39;flrgs&#39;</span><span class="p">:</span>
<span class="n">model</span><span class="o">.</span><span class="n">append_rule</span><span class="p">(</span><span class="n">k</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">model</span><span class="o">.</span><span class="n">append_rule</span><span class="p">(</span><span class="n">k</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span>
<span class="k">return</span> <span class="n">model</span></div>
<div class="viewcode-block" id="distributed_predict"><a class="viewcode-back" href="../../../pyFTS.distributed.html#pyFTS.distributed.spark.distributed_predict">[docs]</a><span class="k">def</span> <span class="nf">distributed_predict</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">model</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> :param model:</span>
<span class="sd"> :param data:</span>
<span class="sd"> :param url:</span>
<span class="sd"> :param app:</span>
<span class="sd"> :return:</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">num_batches</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;num_batches&quot;</span><span class="p">,</span> <span class="mi">4</span><span class="p">)</span>
<span class="n">conf</span> <span class="o">=</span> <span class="n">create_spark_conf</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">with</span> <span class="n">SparkContext</span><span class="p">(</span><span class="n">conf</span><span class="o">=</span><span class="n">conf</span><span class="p">)</span> <span class="k">as</span> <span class="n">context</span><span class="p">:</span>
<span class="n">nodes</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">defaultParallelism</span>
<span class="n">parameters</span> <span class="o">=</span> <span class="n">share_parameters</span><span class="p">(</span><span class="n">model</span><span class="p">,</span> <span class="n">context</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">model</span><span class="o">.</span><span class="n">is_multivariate</span><span class="p">:</span>
<span class="n">func</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">slave_forecast_univariate</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="o">**</span><span class="n">parameters</span><span class="p">)</span>
<span class="n">forecasts</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">parallelize</span><span class="p">(</span><span class="n">data</span><span class="p">)</span><span class="o">.</span><span class="n">repartition</span><span class="p">(</span><span class="n">nodes</span> <span class="o">*</span> <span class="n">num_batches</span><span class="p">)</span><span class="o">.</span><span class="n">mapPartitions</span><span class="p">(</span><span class="n">func</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">to_dict</span><span class="p">(</span><span class="n">orient</span><span class="o">=</span><span class="s1">&#39;records&#39;</span><span class="p">)</span>
<span class="n">func</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">slave_forecast_multivariate</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="o">**</span><span class="n">parameters</span><span class="p">)</span>
<span class="n">forecasts</span> <span class="o">=</span> <span class="n">context</span><span class="o">.</span><span class="n">parallelize</span><span class="p">(</span><span class="n">data</span><span class="p">)</span><span class="o">.</span><span class="n">repartition</span><span class="p">(</span><span class="n">nodes</span> <span class="o">*</span> <span class="n">num_batches</span><span class="p">)</span><span class="o">.</span><span class="n">mapPartitions</span><span class="p">(</span><span class="n">func</span><span class="p">)</span>
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">forecasts</span><span class="o">.</span><span class="n">collect</span><span class="p">():</span>
<span class="n">ret</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">k</span><span class="p">)</span>
<span class="k">return</span> <span class="n">ret</span></div>
</pre></div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">pyFTS 1.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2018, Machine Intelligence and Data Science Laboratory - UFMG - Brazil.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.2.
</div>
</body>
</html>

View File

@ -105,6 +105,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">shortname</span> <span class="o">=</span> <span class="s2">&quot;EnsembleFTS&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;Ensemble FTS&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span> <span class="o">=</span> <span class="p">{}</span>
<span class="bp">self</span><span class="o">.</span><span class="n">is_wrapper</span> <span class="o">=</span> <span class="kc">True</span>
<span class="bp">self</span><span class="o">.</span><span class="n">has_point_forecasting</span> <span class="o">=</span> <span class="kc">True</span>
<span class="bp">self</span><span class="o">.</span><span class="n">has_interval_forecasting</span> <span class="o">=</span> <span class="kc">True</span>
<span class="bp">self</span><span class="o">.</span><span class="n">has_probability_forecasting</span> <span class="o">=</span> <span class="kc">True</span>
@ -209,7 +210,7 @@
<span class="n">ret</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">order</span><span class="p">,</span> <span class="n">l</span><span class="o">+</span><span class="mi">1</span><span class="p">):</span>
<span class="n">sample</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="n">k</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">order</span> <span class="p">:</span> <span class="n">k</span><span class="p">]</span>
<span class="n">sample</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="n">k</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span> <span class="p">:</span> <span class="n">k</span><span class="p">]</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_models_forecasts</span><span class="p">(</span><span class="n">sample</span><span class="p">)</span>
<span class="n">point</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_point</span><span class="p">(</span><span class="n">tmp</span><span class="p">)</span>
<span class="n">ret</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">point</span><span class="p">)</span>

View File

@ -83,6 +83,7 @@
<span class="kn">from</span> <span class="nn">pyFTS.common</span> <span class="k">import</span> <span class="n">FuzzySet</span><span class="p">,</span> <span class="n">FLR</span><span class="p">,</span> <span class="n">fts</span><span class="p">,</span> <span class="n">flrg</span>
<span class="kn">from</span> <span class="nn">itertools</span> <span class="k">import</span> <span class="n">product</span>
<div class="viewcode-block" id="HighOrderFLRG"><a class="viewcode-back" href="../../../pyFTS.models.html#pyFTS.models.hofts.HighOrderFLRG">[docs]</a><span class="k">class</span> <span class="nc">HighOrderFLRG</span><span class="p">(</span><span class="n">flrg</span><span class="o">.</span><span class="n">FLRG</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;Conventional High Order Fuzzy Logical Relationship Group&quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">order</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
@ -258,33 +259,44 @@
<span class="n">explain</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;explain&#39;</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span>
<span class="n">fuzzyfied</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;fuzzyfied&#39;</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span>
<span class="n">mode</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;mode&#39;</span><span class="p">,</span> <span class="s1">&#39;mean&#39;</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">l</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">ndata</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">explain</span> <span class="k">else</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span> <span class="o">+</span> <span class="mi">1</span>
<span class="k">if</span> <span class="n">l</span> <span class="o">&lt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">:</span>
<span class="k">return</span> <span class="n">ndata</span>
<span class="k">elif</span> <span class="n">l</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">:</span>
<span class="n">l</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">,</span> <span class="n">l</span><span class="o">+</span><span class="mi">1</span><span class="p">):</span>
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">,</span> <span class="n">l</span><span class="p">):</span>
<span class="n">sample</span> <span class="o">=</span> <span class="n">ndata</span><span class="p">[</span><span class="n">k</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">:</span> <span class="n">k</span><span class="p">]</span>
<span class="k">if</span> <span class="n">explain</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Fuzzyfication </span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;fuzzyfied&#39;</span><span class="p">,</span> <span class="kc">False</span><span class="p">):</span>
<span class="n">flrgs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_lhs_flrg</span><span class="p">(</span><span class="n">ndata</span><span class="p">[</span><span class="n">k</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">:</span> <span class="n">k</span><span class="p">],</span> <span class="n">explain</span><span class="p">)</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">fuzzyfied</span><span class="p">:</span>
<span class="n">flrgs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_lhs_flrg</span><span class="p">(</span><span class="n">sample</span><span class="p">,</span> <span class="n">explain</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">flrgs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_lhs_flrg_fuzzyfied</span><span class="p">(</span><span class="n">ndata</span><span class="p">[</span><span class="n">k</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">:</span> <span class="n">k</span><span class="p">],</span> <span class="n">explain</span><span class="p">)</span>
<span class="n">flrgs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_lhs_flrg_fuzzyfied</span><span class="p">(</span><span class="n">sample</span><span class="p">,</span> <span class="n">explain</span><span class="p">)</span>
<span class="k">if</span> <span class="n">explain</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Rules:</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">midpoints</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">memberships</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">flrg</span> <span class="ow">in</span> <span class="n">flrgs</span><span class="p">:</span>
<span class="k">if</span> <span class="n">flrg</span><span class="o">.</span><span class="n">get_key</span><span class="p">()</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">:</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">flrg</span><span class="o">.</span><span class="n">LHS</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">mp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="n">flrg</span><span class="o">.</span><span class="n">LHS</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]]</span><span class="o">.</span><span class="n">centroid</span>
<span class="n">tmp</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mp</span><span class="p">)</span>
<span class="n">mv</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="n">flrg</span><span class="o">.</span><span class="n">LHS</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]]</span><span class="o">.</span><span class="n">membership</span><span class="p">(</span><span class="n">sample</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">])</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">fuzzyfied</span> <span class="k">else</span> <span class="kc">None</span>
<span class="n">midpoints</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mp</span><span class="p">)</span>
<span class="n">memberships</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mv</span><span class="p">)</span>
<span class="k">if</span> <span class="n">explain</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;</span><span class="se">\t</span><span class="s2"> </span><span class="si">{}</span><span class="s2"> -&gt; </span><span class="si">{}</span><span class="s2"> (Naïve)</span><span class="se">\t</span><span class="s2"> Midpoint: </span><span class="si">{}</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">flrg</span><span class="o">.</span><span class="n">LHS</span><span class="p">),</span> <span class="n">flrg</span><span class="o">.</span><span class="n">LHS</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span>
@ -292,12 +304,19 @@
<span class="k">else</span><span class="p">:</span>
<span class="n">flrg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">[</span><span class="n">flrg</span><span class="o">.</span><span class="n">get_key</span><span class="p">()]</span>
<span class="n">mp</span> <span class="o">=</span> <span class="n">flrg</span><span class="o">.</span><span class="n">get_midpoint</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">sets</span><span class="p">)</span>
<span class="n">tmp</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mp</span><span class="p">)</span>
<span class="n">mv</span> <span class="o">=</span> <span class="n">flrg</span><span class="o">.</span><span class="n">get_membership</span><span class="p">(</span><span class="n">sample</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">sets</span><span class="p">)</span> <span class="k">if</span> <span class="ow">not</span> <span class="n">fuzzyfied</span> <span class="k">else</span> <span class="kc">None</span>
<span class="n">midpoints</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mp</span><span class="p">)</span>
<span class="n">memberships</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mv</span><span class="p">)</span>
<span class="k">if</span> <span class="n">explain</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;</span><span class="se">\t</span><span class="s2"> </span><span class="si">{}</span><span class="s2"> </span><span class="se">\t</span><span class="s2"> Midpoint: </span><span class="si">{}</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">flrg</span><span class="p">),</span> <span class="n">mp</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;</span><span class="se">\t</span><span class="s2"> </span><span class="si">{}</span><span class="s2"> </span><span class="se">\t</span><span class="s2"> Membership: </span><span class="si">{}</span><span class="se">\n</span><span class="s2">&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">flrg</span><span class="p">),</span> <span class="n">mv</span><span class="p">))</span>
<span class="k">if</span> <span class="n">mode</span> <span class="o">==</span> <span class="s2">&quot;mean&quot;</span> <span class="ow">or</span> <span class="n">fuzzyfied</span><span class="p">:</span>
<span class="n">final</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">nanmean</span><span class="p">(</span><span class="n">midpoints</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">final</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">dot</span><span class="p">(</span><span class="n">midpoints</span><span class="p">,</span> <span class="n">memberships</span><span class="p">)</span>
<span class="n">final</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">nanmean</span><span class="p">(</span><span class="n">tmp</span><span class="p">)</span>
<span class="n">ret</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">final</span><span class="p">)</span>
<span class="k">if</span> <span class="n">explain</span><span class="p">:</span>

View File

@ -0,0 +1,191 @@
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-55120145-3']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<title>pyFTS.models.incremental.IncrementalEnsemble &#8212; pyFTS 1.4 documentation</title>
<link rel="stylesheet" href="../../../../_static/bizstyle.css" type="text/css" />
<link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../../../_static/documentation_options.js"></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="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="../../../../_static/bizstyle.js"></script>
<link rel="index" title="Index" href="../../../../genindex.html" />
<link rel="search" title="Search" href="../../../../search.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!--[if lt IE 9]>
<script type="text/javascript" src="_static/css3-mediaqueries.js"></script>
<![endif]-->
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../../index.html">pyFTS 1.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../../index.html" accesskey="U">Module code</a> &#187;</li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../../../index.html">
<img class="logo" src="../../../../_static/logo_heading2.png" alt="Logo"/>
</a></p>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<h1>Source code for pyFTS.models.incremental.IncrementalEnsemble</h1><div class="highlight"><pre>
<span></span><span class="sd">&#39;&#39;&#39;</span>
<span class="sd">Time Variant/Incremental Ensemble of FTS methods</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
<span class="kn">from</span> <span class="nn">pyFTS.common</span> <span class="k">import</span> <span class="n">FuzzySet</span><span class="p">,</span> <span class="n">FLR</span><span class="p">,</span> <span class="n">fts</span><span class="p">,</span> <span class="n">flrg</span>
<span class="kn">from</span> <span class="nn">pyFTS.partitioners</span> <span class="k">import</span> <span class="n">Grid</span>
<span class="kn">from</span> <span class="nn">pyFTS.models</span> <span class="k">import</span> <span class="n">hofts</span>
<span class="kn">from</span> <span class="nn">pyFTS.models.ensemble</span> <span class="k">import</span> <span class="n">ensemble</span>
<div class="viewcode-block" id="IncrementalEnsembleFTS"><a class="viewcode-back" href="../../../../pyFTS.models.incremental.html#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS">[docs]</a><span class="k">class</span> <span class="nc">IncrementalEnsembleFTS</span><span class="p">(</span><span class="n">ensemble</span><span class="o">.</span><span class="n">EnsembleFTS</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Time Variant/Incremental Ensemble of FTS methods</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="nb">super</span><span class="p">(</span><span class="n">IncrementalEnsembleFTS</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">shortname</span> <span class="o">=</span> <span class="s2">&quot;IncrementalEnsembleFTS&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;Incremental Ensemble FTS&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">order</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;order&#39;</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">partitioner_method</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;partitioner_method&#39;</span><span class="p">,</span> <span class="n">Grid</span><span class="o">.</span><span class="n">GridPartitioner</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;The partitioner method to be called when a new model is build&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">partitioner_params</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;partitioner_params&#39;</span><span class="p">,</span> <span class="p">{</span><span class="s1">&#39;npart&#39;</span><span class="p">:</span> <span class="mi">10</span><span class="p">})</span>
<span class="sd">&quot;&quot;&quot;The partitioner method parameters&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">fts_method</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;fts_method&#39;</span><span class="p">,</span> <span class="n">hofts</span><span class="o">.</span><span class="n">WeightedHighOrderFTS</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;The FTS method to be called when a new model is build&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">fts_params</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;fts_params&#39;</span><span class="p">,</span> <span class="p">{})</span>
<span class="sd">&quot;&quot;&quot;The FTS method specific parameters&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">window_length</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;window_length&#39;</span><span class="p">,</span> <span class="mi">100</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;The memory window length&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">batch_size</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;batch_size&#39;</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;The batch interval between each retraining&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">is_high_order</span> <span class="o">=</span> <span class="kc">True</span>
<span class="bp">self</span><span class="o">.</span><span class="n">uod_clip</span> <span class="o">=</span> <span class="kc">False</span>
<span class="c1">#self.max_lag = self.window_length + self.max_lag</span>
<div class="viewcode-block" id="IncrementalEnsembleFTS.train"><a class="viewcode-back" href="../../../../pyFTS.models.incremental.html#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.train">[docs]</a> <span class="k">def</span> <span class="nf">train</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="n">partitioner</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitioner_method</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="bp">self</span><span class="o">.</span><span class="n">partitioner_params</span><span class="p">)</span>
<span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fts_method</span><span class="p">(</span><span class="n">partitioner</span><span class="o">=</span><span class="n">partitioner</span><span class="p">,</span> <span class="o">**</span><span class="bp">self</span><span class="o">.</span><span class="n">fts_params</span><span class="p">)</span>
<span class="k">if</span> <span class="n">model</span><span class="o">.</span><span class="n">is_high_order</span><span class="p">:</span>
<span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fts_method</span><span class="p">(</span><span class="n">partitioner</span><span class="o">=</span><span class="n">partitioner</span><span class="p">,</span> <span class="n">order</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">order</span><span class="p">,</span> <span class="o">**</span><span class="bp">self</span><span class="o">.</span><span class="n">fts_params</span><span class="p">)</span>
<span class="n">model</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">models</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">models</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">models</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">model</span><span class="p">)</span></div>
<span class="k">def</span> <span class="nf">_point_smoothing</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">forecasts</span><span class="p">):</span>
<span class="n">l</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">models</span><span class="p">)</span>
<span class="n">ret</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">nansum</span><span class="p">([</span><span class="n">np</span><span class="o">.</span><span class="n">exp</span><span class="p">(</span><span class="o">-</span><span class="p">(</span><span class="n">l</span><span class="o">-</span><span class="n">k</span><span class="p">))</span> <span class="o">*</span> <span class="n">forecasts</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="n">l</span><span class="p">)])</span>
<span class="k">return</span> <span class="n">ret</span>
<div class="viewcode-block" id="IncrementalEnsembleFTS.forecast"><a class="viewcode-back" href="../../../../pyFTS.models.incremental.html#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.forecast">[docs]</a> <span class="k">def</span> <span class="nf">forecast</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="n">l</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="n">data_window</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">ret</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">,</span> <span class="n">l</span><span class="p">):</span>
<span class="n">data_window</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">k</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">])</span>
<span class="k">if</span> <span class="n">k</span> <span class="o">&gt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">window_length</span><span class="p">:</span>
<span class="n">data_window</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span>
<span class="k">if</span> <span class="n">k</span> <span class="o">%</span> <span class="bp">self</span><span class="o">.</span><span class="n">batch_size</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">and</span> <span class="n">k</span> <span class="o">&gt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">window_length</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">train</span><span class="p">(</span><span class="n">data_window</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="n">sample</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="n">k</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">:</span> <span class="n">k</span><span class="p">]</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_models_forecasts</span><span class="p">(</span><span class="n">sample</span><span class="p">)</span>
<span class="n">point</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_point_smoothing</span><span class="p">(</span><span class="n">tmp</span><span class="p">)</span>
<span class="n">ret</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">point</span><span class="p">)</span>
<span class="k">return</span> <span class="n">ret</span></div></div>
</pre></div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../../index.html">pyFTS 1.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../../index.html" >Module code</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2018, Machine Intelligence and Data Science Laboratory - UFMG - Brazil.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.2.
</div>
</body>
</html>

View File

@ -17,7 +17,7 @@
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<title>pyFTS.models.incremental.Retrainer &#8212; pyFTS 1.4 documentation</title>
<title>pyFTS.models.incremental.TimeVariant &#8212; pyFTS 1.4 documentation</title>
<link rel="stylesheet" href="../../../../_static/bizstyle.css" type="text/css" />
<link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
<script type="text/javascript" src="../../../../_static/documentation_options.js"></script>
@ -71,7 +71,7 @@
<div class="bodywrapper">
<div class="body" role="main">
<h1>Source code for pyFTS.models.incremental.Retrainer</h1><div class="highlight"><pre>
<h1>Source code for pyFTS.models.incremental.TimeVariant</h1><div class="highlight"><pre>
<span></span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Meta model that wraps another FTS method and continously retrain it using a data window with the most recent data</span>
<span class="sd">&quot;&quot;&quot;</span>
@ -81,7 +81,7 @@
<span class="kn">from</span> <span class="nn">pyFTS.partitioners</span> <span class="k">import</span> <span class="n">Grid</span>
<div class="viewcode-block" id="Retrainer"><a class="viewcode-back" href="../../../../pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer">[docs]</a><span class="k">class</span> <span class="nc">Retrainer</span><span class="p">(</span><span class="n">fts</span><span class="o">.</span><span class="n">FTS</span><span class="p">):</span>
<div class="viewcode-block" id="Retrainer"><a class="viewcode-back" href="../../../../pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer">[docs]</a><span class="k">class</span> <span class="nc">Retrainer</span><span class="p">(</span><span class="n">fts</span><span class="o">.</span><span class="n">FTS</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Meta model for incremental/online learning</span>
<span class="sd"> &quot;&quot;&quot;</span>
@ -112,7 +112,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">uod_clip</span> <span class="o">=</span> <span class="kc">False</span>
<span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">window_length</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">order</span>
<div class="viewcode-block" id="Retrainer.train"><a class="viewcode-back" href="../../../../pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.train">[docs]</a> <span class="k">def</span> <span class="nf">train</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<div class="viewcode-block" id="Retrainer.train"><a class="viewcode-back" href="../../../../pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer.train">[docs]</a> <span class="k">def</span> <span class="nf">train</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitioner_method</span><span class="p">(</span><span class="n">data</span><span class="o">=</span><span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="bp">self</span><span class="o">.</span><span class="n">partitioner_params</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">model</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">fts_method</span><span class="p">(</span><span class="n">partitioner</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span><span class="p">,</span> <span class="o">**</span><span class="bp">self</span><span class="o">.</span><span class="n">fts_params</span><span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">is_high_order</span><span class="p">:</span>
@ -121,7 +121,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">shortname</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">shortname</span></div>
<div class="viewcode-block" id="Retrainer.forecast"><a class="viewcode-back" href="../../../../pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.forecast">[docs]</a> <span class="k">def</span> <span class="nf">forecast</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<div class="viewcode-block" id="Retrainer.forecast"><a class="viewcode-back" href="../../../../pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer.forecast">[docs]</a> <span class="k">def</span> <span class="nf">forecast</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="n">l</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="n">horizon</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">window_length</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">order</span>

View File

@ -101,7 +101,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">order</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;order&quot;</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">lags</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;lags&quot;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">alpha_cut</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;alpha_cut&#39;</span><span class="p">,</span> <span class="mf">0.25</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">alpha_cut</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;alpha_cut&#39;</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">shortname</span> <span class="o">=</span> <span class="s2">&quot;ClusteredMVFTS&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="s2">&quot;Clustered Multivariate FTS&quot;</span>
@ -112,7 +112,8 @@
<span class="n">ndata</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">index</span><span class="p">,</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">data</span><span class="o">.</span><span class="n">iterrows</span><span class="p">():</span>
<span class="n">data_point</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_data</span><span class="p">(</span><span class="n">row</span><span class="p">)</span>
<span class="n">ndata</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">common</span><span class="o">.</span><span class="n">fuzzyfy_instance_clustered</span><span class="p">(</span><span class="n">data_point</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span><span class="p">,</span> <span class="n">alpha_cut</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">alpha_cut</span><span class="p">))</span>
<span class="n">ndata</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">common</span><span class="o">.</span><span class="n">fuzzyfy_instance_clustered</span><span class="p">(</span><span class="n">data_point</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span><span class="p">,</span>
<span class="n">alpha_cut</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">alpha_cut</span><span class="p">))</span>
<span class="k">return</span> <span class="n">ndata</span></div>

View File

@ -116,9 +116,12 @@
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">nanmin</span><span class="p">(</span><span class="n">mv</span><span class="p">)</span></div></div>
<div class="viewcode-block" id="fuzzyfy_instance"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.common.fuzzyfy_instance">[docs]</a><span class="k">def</span> <span class="nf">fuzzyfy_instance</span><span class="p">(</span><span class="n">data_point</span><span class="p">,</span> <span class="n">var</span><span class="p">):</span>
<div class="viewcode-block" id="fuzzyfy_instance"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.common.fuzzyfy_instance">[docs]</a><span class="k">def</span> <span class="nf">fuzzyfy_instance</span><span class="p">(</span><span class="n">data_point</span><span class="p">,</span> <span class="n">var</span><span class="p">,</span> <span class="n">tuples</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
<span class="n">fsets</span> <span class="o">=</span> <span class="n">FuzzySet</span><span class="o">.</span><span class="n">fuzzyfy</span><span class="p">(</span><span class="n">data_point</span><span class="p">,</span> <span class="n">var</span><span class="o">.</span><span class="n">partitioner</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s1">&#39;sets&#39;</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;fuzzy&#39;</span><span class="p">,</span> <span class="n">alpha_cut</span><span class="o">=</span><span class="n">var</span><span class="o">.</span><span class="n">alpha_cut</span><span class="p">)</span>
<span class="k">return</span> <span class="p">[(</span><span class="n">var</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">fs</span><span class="p">)</span> <span class="k">for</span> <span class="n">fs</span> <span class="ow">in</span> <span class="n">fsets</span><span class="p">]</span></div>
<span class="k">if</span> <span class="n">tuples</span><span class="p">:</span>
<span class="k">return</span> <span class="p">[(</span><span class="n">var</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">fs</span><span class="p">)</span> <span class="k">for</span> <span class="n">fs</span> <span class="ow">in</span> <span class="n">fsets</span><span class="p">]</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="n">fsets</span></div>
<div class="viewcode-block" id="fuzzyfy_instance_clustered"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.common.fuzzyfy_instance_clustered">[docs]</a><span class="k">def</span> <span class="nf">fuzzyfy_instance_clustered</span><span class="p">(</span><span class="n">data_point</span><span class="p">,</span> <span class="n">cluster</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>

View File

@ -72,14 +72,28 @@
<div class="body" role="main">
<h1>Source code for pyFTS.models.multivariate.mvfts</h1><div class="highlight"><pre>
<span></span><span class="kn">from</span> <span class="nn">pyFTS.common</span> <span class="k">import</span> <span class="n">fts</span><span class="p">,</span> <span class="n">FuzzySet</span><span class="p">,</span> <span class="n">FLR</span><span class="p">,</span> <span class="n">Membership</span><span class="p">,</span> <span class="n">tree</span>
<span></span><span class="kn">from</span> <span class="nn">pyFTS.common</span> <span class="k">import</span> <span class="n">fts</span><span class="p">,</span> <span class="n">FuzzySet</span><span class="p">,</span> <span class="n">FLR</span><span class="p">,</span> <span class="n">Membership</span>
<span class="kn">from</span> <span class="nn">pyFTS.partitioners</span> <span class="k">import</span> <span class="n">Grid</span>
<span class="kn">from</span> <span class="nn">pyFTS.models.multivariate</span> <span class="k">import</span> <span class="n">FLR</span> <span class="k">as</span> <span class="n">MVFLR</span><span class="p">,</span> <span class="n">common</span><span class="p">,</span> <span class="n">flrg</span> <span class="k">as</span> <span class="n">mvflrg</span>
<span class="kn">from</span> <span class="nn">itertools</span> <span class="k">import</span> <span class="n">product</span>
<span class="kn">from</span> <span class="nn">types</span> <span class="k">import</span> <span class="n">LambdaType</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
<div class="viewcode-block" id="product_dict"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.product_dict">[docs]</a><span class="k">def</span> <span class="nf">product_dict</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="sd">&#39;&#39;&#39;</span>
<span class="sd"> Code by Seth Johnson</span>
<span class="sd"> :param kwargs:</span>
<span class="sd"> :return:</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="n">keys</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
<span class="n">vals</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">values</span><span class="p">()</span>
<span class="k">for</span> <span class="n">instance</span> <span class="ow">in</span> <span class="n">product</span><span class="p">(</span><span class="o">*</span><span class="n">vals</span><span class="p">):</span>
<span class="k">yield</span> <span class="nb">dict</span><span class="p">(</span><span class="nb">zip</span><span class="p">(</span><span class="n">keys</span><span class="p">,</span> <span class="n">instance</span><span class="p">))</span></div>
<div class="viewcode-block" id="MVFTS"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS">[docs]</a><span class="k">class</span> <span class="nc">MVFTS</span><span class="p">(</span><span class="n">fts</span><span class="o">.</span><span class="n">FTS</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Multivariate extension of Chen&#39;s ConventionalFTS method</span>
@ -113,11 +127,15 @@
<div class="viewcode-block" id="MVFTS.apply_transformations"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.apply_transformations">[docs]</a> <span class="k">def</span> <span class="nf">apply_transformations</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">params</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">updateUoD</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="n">ndata</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">deep</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="k">for</span> <span class="n">var</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">explanatory_variables</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">values</span> <span class="o">=</span> <span class="n">ndata</span><span class="p">[</span><span class="n">var</span><span class="o">.</span><span class="n">data_label</span><span class="p">]</span><span class="o">.</span><span class="n">values</span> <span class="c1">#if isinstance(ndata, pd.DataFrame) else ndata[var.data_label]</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">uod_clip</span> <span class="ow">and</span> <span class="n">var</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">type</span> <span class="o">==</span> <span class="s1">&#39;common&#39;</span><span class="p">:</span>
<span class="n">ndata</span><span class="p">[</span><span class="n">var</span><span class="o">.</span><span class="n">data_label</span><span class="p">]</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">clip</span><span class="p">(</span><span class="n">ndata</span><span class="p">[</span><span class="n">var</span><span class="o">.</span><span class="n">data_label</span><span class="p">]</span><span class="o">.</span><span class="n">values</span><span class="p">,</span>
<span class="n">ndata</span><span class="p">[</span><span class="n">var</span><span class="o">.</span><span class="n">data_label</span><span class="p">]</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">clip</span><span class="p">(</span><span class="n">values</span><span class="p">,</span>
<span class="n">var</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">min</span><span class="p">,</span> <span class="n">var</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">max</span><span class="p">)</span>
<span class="n">ndata</span><span class="p">[</span><span class="n">var</span><span class="o">.</span><span class="n">data_label</span><span class="p">]</span> <span class="o">=</span> <span class="n">var</span><span class="o">.</span><span class="n">apply_transformations</span><span class="p">(</span><span class="n">ndata</span><span class="p">[</span><span class="n">var</span><span class="o">.</span><span class="n">data_label</span><span class="p">]</span><span class="o">.</span><span class="n">values</span><span class="p">)</span>
<span class="n">ndata</span><span class="p">[</span><span class="n">var</span><span class="o">.</span><span class="n">data_label</span><span class="p">]</span> <span class="o">=</span> <span class="n">var</span><span class="o">.</span><span class="n">apply_transformations</span><span class="p">(</span><span class="n">values</span><span class="p">)</span>
<span class="k">except</span><span class="p">:</span>
<span class="k">pass</span>
<span class="k">return</span> <span class="n">ndata</span></div>
@ -125,23 +143,19 @@
<span class="n">flrs</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">lags</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">vc</span><span class="p">,</span> <span class="n">var</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">explanatory_variables</span><span class="p">):</span>
<span class="n">data_point</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="n">var</span><span class="o">.</span><span class="n">data_label</span><span class="p">]</span>
<span class="n">lags</span><span class="p">[</span><span class="n">vc</span><span class="p">]</span> <span class="o">=</span> <span class="n">common</span><span class="o">.</span><span class="n">fuzzyfy_instance</span><span class="p">(</span><span class="n">data_point</span><span class="p">,</span> <span class="n">var</span><span class="p">)</span>
<span class="n">root</span> <span class="o">=</span> <span class="n">tree</span><span class="o">.</span><span class="n">FLRGTreeNode</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span>
<span class="n">tree</span><span class="o">.</span><span class="n">build_tree_without_order</span><span class="p">(</span><span class="n">root</span><span class="p">,</span> <span class="n">lags</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
<span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="n">root</span><span class="o">.</span><span class="n">paths</span><span class="p">():</span>
<span class="n">path</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">reversed</span><span class="p">(</span><span class="nb">list</span><span class="p">(</span><span class="nb">filter</span><span class="p">(</span><span class="kc">None</span><span class="o">.</span><span class="fm">__ne__</span><span class="p">,</span> <span class="n">p</span><span class="p">))))</span>
<span class="n">data_point</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="n">var</span><span class="o">.</span><span class="n">name</span><span class="p">]</span>
<span class="n">lags</span><span class="p">[</span><span class="n">var</span><span class="o">.</span><span class="n">name</span><span class="p">]</span> <span class="o">=</span> <span class="n">common</span><span class="o">.</span><span class="n">fuzzyfy_instance</span><span class="p">(</span><span class="n">data_point</span><span class="p">,</span> <span class="n">var</span><span class="p">,</span> <span class="n">tuples</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="k">for</span> <span class="n">path</span> <span class="ow">in</span> <span class="n">product_dict</span><span class="p">(</span><span class="o">**</span><span class="n">lags</span><span class="p">):</span>
<span class="n">flr</span> <span class="o">=</span> <span class="n">MVFLR</span><span class="o">.</span><span class="n">FLR</span><span class="p">()</span>
<span class="k">for</span> <span class="n">v</span><span class="p">,</span> <span class="n">s</span> <span class="ow">in</span> <span class="n">path</span><span class="p">:</span>
<span class="n">flr</span><span class="o">.</span><span class="n">set_lhs</span><span class="p">(</span><span class="n">v</span><span class="p">,</span> <span class="n">s</span><span class="p">)</span>
<span class="k">for</span> <span class="n">var</span><span class="p">,</span> <span class="n">fset</span> <span class="ow">in</span> <span class="n">path</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="n">flr</span><span class="o">.</span><span class="n">set_lhs</span><span class="p">(</span><span class="n">var</span><span class="p">,</span> <span class="n">fset</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">flr</span><span class="o">.</span><span class="n">LHS</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span> <span class="o">==</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">explanatory_variables</span><span class="p">):</span>
<span class="n">flrs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">flr</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="n">flr</span><span class="p">)</span>
<span class="k">return</span> <span class="n">flrs</span></div>
@ -149,7 +163,7 @@
<span class="n">flrs</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">ct</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="o">.</span><span class="n">index</span><span class="p">)):</span>
<span class="n">ix</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">index</span><span class="p">[</span><span class="n">ct</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
<span class="n">data_point</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">loc</span><span class="p">[</span><span class="n">ix</span><span class="p">]</span>
<span class="n">data_point</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_data</span><span class="p">(</span> <span class="n">data</span><span class="o">.</span><span class="n">loc</span><span class="p">[</span><span class="n">ix</span><span class="p">]</span> <span class="p">)</span>
<span class="n">tmp_flrs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_lhs_flrs</span><span class="p">(</span><span class="n">data_point</span><span class="p">)</span>
@ -184,17 +198,28 @@
<div class="viewcode-block" id="MVFTS.forecast"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.forecast">[docs]</a> <span class="k">def</span> <span class="nf">forecast</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="n">ret</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">ndata</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">apply_transformations</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="k">for</span> <span class="n">index</span><span class="p">,</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">ndata</span><span class="o">.</span><span class="n">iterrows</span><span class="p">():</span>
<span class="n">flrs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_lhs_flrs</span><span class="p">(</span><span class="n">row</span><span class="p">)</span>
<span class="n">c</span> <span class="o">=</span> <span class="mi">0</span>
<span class="k">for</span> <span class="n">index</span><span class="p">,</span> <span class="n">row</span> <span class="ow">in</span> <span class="n">ndata</span><span class="o">.</span><span class="n">iterrows</span><span class="p">()</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ndata</span><span class="p">,</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">)</span> <span class="k">else</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">ndata</span><span class="p">):</span>
<span class="n">data_point</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">format_data</span><span class="p">(</span><span class="n">row</span><span class="p">)</span>
<span class="n">flrs</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">generate_lhs_flrs</span><span class="p">(</span><span class="n">data_point</span><span class="p">)</span>
<span class="n">mvs</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">mps</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">flr</span> <span class="ow">in</span> <span class="n">flrs</span><span class="p">:</span>
<span class="n">flrg</span> <span class="o">=</span> <span class="n">mvflrg</span><span class="o">.</span><span class="n">FLRG</span><span class="p">(</span><span class="n">lhs</span><span class="o">=</span><span class="n">flr</span><span class="o">.</span><span class="n">LHS</span><span class="p">)</span>
<span class="k">if</span> <span class="n">flrg</span><span class="o">.</span><span class="n">get_key</span><span class="p">()</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">:</span>
<span class="c1">#Naïve approach is applied when no rules were found</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">target_variable</span><span class="o">.</span><span class="n">name</span> <span class="ow">in</span> <span class="n">flrg</span><span class="o">.</span><span class="n">LHS</span><span class="p">:</span>
<span class="n">fs</span> <span class="o">=</span> <span class="n">flrg</span><span class="o">.</span><span class="n">LHS</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">target_variable</span><span class="o">.</span><span class="n">name</span><span class="p">]</span>
<span class="n">fset</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">target_variable</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="n">fs</span><span class="p">]</span>
<span class="n">mp</span> <span class="o">=</span> <span class="n">fset</span><span class="o">.</span><span class="n">centroid</span>
<span class="n">mv</span> <span class="o">=</span> <span class="n">fset</span><span class="o">.</span><span class="n">membership</span><span class="p">(</span><span class="n">data_point</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">target_variable</span><span class="o">.</span><span class="n">name</span><span class="p">])</span>
<span class="n">mvs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mv</span><span class="p">)</span>
<span class="n">mps</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">mp</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">mvs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mf">0.</span><span class="p">)</span>
<span class="n">mps</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="mf">0.</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">mvs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">[</span><span class="n">flrg</span><span class="o">.</span><span class="n">get_key</span><span class="p">()]</span><span class="o">.</span><span class="n">get_membership</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">format_data</span><span class="p">(</span><span class="n">row</span><span class="p">),</span> <span class="bp">self</span><span class="o">.</span><span class="n">explanatory_variables</span><span class="p">))</span>
<span class="n">mvs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">[</span><span class="n">flrg</span><span class="o">.</span><span class="n">get_key</span><span class="p">()]</span><span class="o">.</span><span class="n">get_membership</span><span class="p">(</span><span class="n">data_point</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">explanatory_variables</span><span class="p">))</span>
<span class="n">mps</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">[</span><span class="n">flrg</span><span class="o">.</span><span class="n">get_key</span><span class="p">()]</span><span class="o">.</span><span class="n">get_midpoint</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">target_variable</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">sets</span><span class="p">))</span>
<span class="n">mv</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">mvs</span><span class="p">)</span>
@ -211,9 +236,10 @@
<span class="k">if</span> <span class="n">generators</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s1">&#39;You must provide parameter </span><span class="se">\&#39;</span><span class="s1">generators</span><span class="se">\&#39;</span><span class="s1">! generators is a dict where the keys&#39;</span> <span class="o">+</span>
<span class="s1">&#39; are the variables names (except the target_variable) and the values are &#39;</span> <span class="o">+</span>
<span class="s1">&#39; are the dataframe column names (except the target_variable) and the values are &#39;</span> <span class="o">+</span>
<span class="s1">&#39;lambda functions that accept one value (the actual value of the variable) &#39;</span>
<span class="s1">&#39; and return the next value.&#39;</span><span class="p">)</span>
<span class="s1">&#39; and return the next value or trained FTS models that accept the actual values and &#39;</span>
<span class="s1">&#39;forecast new ones.&#39;</span><span class="p">)</span>
<span class="n">ndata</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">apply_transformations</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
@ -228,13 +254,20 @@
<span class="n">ret</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">tmp</span><span class="p">)</span>
<span class="n">last_data_point</span> <span class="o">=</span> <span class="n">sample</span><span class="o">.</span><span class="n">loc</span><span class="p">[</span><span class="n">sample</span><span class="o">.</span><span class="n">index</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]]</span>
<span class="n">new_data_point</span> <span class="o">=</span> <span class="p">{}</span>
<span class="k">for</span> <span class="n">var</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">explanatory_variables</span><span class="p">:</span>
<span class="k">if</span> <span class="n">var</span><span class="o">.</span><span class="n">name</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">target_variable</span><span class="o">.</span><span class="n">name</span><span class="p">:</span>
<span class="n">new_data_point</span><span class="p">[</span><span class="n">var</span><span class="o">.</span><span class="n">data_label</span><span class="p">]</span> <span class="o">=</span> <span class="n">generators</span><span class="p">[</span><span class="n">var</span><span class="o">.</span><span class="n">name</span><span class="p">](</span><span class="n">last_data_point</span><span class="p">[</span><span class="n">var</span><span class="o">.</span><span class="n">data_label</span><span class="p">])</span>
<span class="k">for</span> <span class="n">data_label</span> <span class="ow">in</span> <span class="n">generators</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span>
<span class="k">if</span> <span class="n">data_label</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">target_variable</span><span class="o">.</span><span class="n">data_label</span><span class="p">:</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">generators</span><span class="p">[</span><span class="n">data_label</span><span class="p">],</span> <span class="n">LambdaType</span><span class="p">):</span>
<span class="n">last_data_point</span> <span class="o">=</span> <span class="n">ndata</span><span class="o">.</span><span class="n">loc</span><span class="p">[</span><span class="n">sample</span><span class="o">.</span><span class="n">index</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]]</span>
<span class="n">new_data_point</span><span class="p">[</span><span class="n">data_label</span><span class="p">]</span> <span class="o">=</span> <span class="n">generators</span><span class="p">[</span><span class="n">data_label</span><span class="p">](</span><span class="n">last_data_point</span><span class="p">[</span><span class="n">data_label</span><span class="p">])</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">generators</span><span class="p">[</span><span class="n">data_label</span><span class="p">],</span> <span class="n">fts</span><span class="o">.</span><span class="n">FTS</span><span class="p">):</span>
<span class="n">model</span> <span class="o">=</span> <span class="n">generators</span><span class="p">[</span><span class="n">data_label</span><span class="p">]</span>
<span class="n">last_data_point</span> <span class="o">=</span> <span class="n">ndata</span><span class="o">.</span><span class="n">loc</span><span class="p">[[</span><span class="n">sample</span><span class="o">.</span><span class="n">index</span><span class="p">[</span><span class="o">-</span><span class="n">model</span><span class="o">.</span><span class="n">order</span><span class="p">]]]</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">model</span><span class="o">.</span><span class="n">is_multivariate</span><span class="p">:</span>
<span class="n">last_data_point</span> <span class="o">=</span> <span class="n">last_data_point</span><span class="p">[</span><span class="n">data_label</span><span class="p">]</span><span class="o">.</span><span class="n">values</span>
<span class="n">new_data_point</span><span class="p">[</span><span class="n">data_label</span><span class="p">]</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">forecast</span><span class="p">(</span><span class="n">last_data_point</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
<span class="n">new_data_point</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">target_variable</span><span class="o">.</span><span class="n">data_label</span><span class="p">]</span> <span class="o">=</span> <span class="n">tmp</span>

View File

@ -104,9 +104,13 @@
<span class="bp">self</span><span class="o">.</span><span class="n">mask</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;mask&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;The mask for format the data column on Pandas Dataframe&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">transformation</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;transformation&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;Pre processing transformation for the variable&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">transformation_params</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;transformation_params&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span> <span class="o">=</span> <span class="kc">None</span>
<span class="sd">&quot;&quot;&quot;UoD partitioner for the variable data&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">alpha_cut</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;alpha_cut&#39;</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;Minimal membership value to be considered on fuzzyfication process&quot;&quot;&quot;</span>
<span class="k">if</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;data&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>

View File

@ -77,12 +77,18 @@
<span class="kn">from</span> <span class="nn">enum</span> <span class="k">import</span> <span class="n">Enum</span>
<span class="kn">from</span> <span class="nn">pyFTS.common</span> <span class="k">import</span> <span class="n">FuzzySet</span><span class="p">,</span> <span class="n">Membership</span>
<span class="kn">from</span> <span class="nn">pyFTS.partitioners</span> <span class="k">import</span> <span class="n">partitioner</span><span class="p">,</span> <span class="n">Grid</span>
<span class="kn">from</span> <span class="nn">datetime</span> <span class="k">import</span> <span class="n">date</span> <span class="k">as</span> <span class="n">dt</span>
<span class="kn">from</span> <span class="nn">datetime</span> <span class="k">import</span> <span class="n">date</span> <span class="k">as</span> <span class="n">dt</span><span class="p">,</span> <span class="n">datetime</span> <span class="k">as</span> <span class="n">dtm</span>
<div class="viewcode-block" id="DateTime"><a class="viewcode-back" href="../../../../pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime">[docs]</a><span class="k">class</span> <span class="nc">DateTime</span><span class="p">(</span><span class="n">Enum</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Data and Time granularity for time granularity and seasonality identification</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">year</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">half</span> <span class="o">=</span> <span class="mi">2</span> <span class="c1"># six months</span>
<span class="n">third</span> <span class="o">=</span> <span class="mi">3</span> <span class="c1"># four months</span>
<span class="n">quarter</span> <span class="o">=</span> <span class="mi">4</span> <span class="c1"># three months</span>
<span class="n">sixth</span> <span class="o">=</span> <span class="mi">6</span> <span class="c1"># two months</span>
<span class="n">month</span> <span class="o">=</span> <span class="mi">12</span>
<span class="n">day_of_month</span> <span class="o">=</span> <span class="mi">30</span>
<span class="n">day_of_year</span> <span class="o">=</span> <span class="mi">364</span>
@ -104,11 +110,15 @@
<span class="n">second_of_day</span> <span class="o">=</span> <span class="mi">86400</span></div>
<div class="viewcode-block" id="strip_datepart"><a class="viewcode-back" href="../../../../pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.strip_datepart">[docs]</a><span class="k">def</span> <span class="nf">strip_datepart</span><span class="p">(</span><span class="n">date</span><span class="p">,</span> <span class="n">date_part</span><span class="p">):</span>
<div class="viewcode-block" id="strip_datepart"><a class="viewcode-back" href="../../../../pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.strip_datepart">[docs]</a><span class="k">def</span> <span class="nf">strip_datepart</span><span class="p">(</span><span class="n">date</span><span class="p">,</span> <span class="n">date_part</span><span class="p">,</span> <span class="n">mask</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">):</span>
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">date</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
<span class="n">date</span> <span class="o">=</span> <span class="n">dtm</span><span class="o">.</span><span class="n">strptime</span><span class="p">(</span><span class="n">date</span><span class="p">,</span> <span class="n">mask</span><span class="p">)</span>
<span class="k">if</span> <span class="n">date_part</span> <span class="o">==</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">year</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">date</span><span class="o">.</span><span class="n">year</span>
<span class="k">elif</span> <span class="n">date_part</span> <span class="o">==</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">month</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">date</span><span class="o">.</span><span class="n">month</span>
<span class="k">elif</span> <span class="n">date_part</span> <span class="ow">in</span> <span class="p">(</span><span class="n">DateTime</span><span class="o">.</span><span class="n">half</span><span class="p">,</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">third</span><span class="p">,</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">quarter</span><span class="p">,</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">sixth</span><span class="p">):</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="p">(</span><span class="n">date</span><span class="o">.</span><span class="n">month</span> <span class="o">//</span> <span class="n">date_part</span><span class="o">.</span><span class="n">value</span><span class="p">)</span> <span class="o">+</span> <span class="mi">1</span>
<span class="k">elif</span> <span class="n">date_part</span> <span class="o">==</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">day_of_year</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">date</span><span class="o">.</span><span class="n">timetuple</span><span class="p">()</span><span class="o">.</span><span class="n">tm_yday</span>
<span class="k">elif</span> <span class="n">date_part</span> <span class="o">==</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">day_of_month</span><span class="p">:</span>

View File

@ -94,6 +94,10 @@
<span class="nb">super</span><span class="p">(</span><span class="n">TimeGridPartitioner</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;TimeGrid&quot;</span><span class="p">,</span> <span class="n">preprocess</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">season</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;seasonality&#39;</span><span class="p">,</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">day_of_year</span><span class="p">)</span>
<span class="sd">&#39;&#39;&#39;Seasonality, a pyFTS.models.seasonal.common.DateTime object&#39;&#39;&#39;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">mask</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;mask&#39;</span><span class="p">,</span> <span class="s1">&#39;%Y-%m-</span><span class="si">%d</span><span class="s1"> %H:%M:%S&#39;</span><span class="p">)</span>
<span class="sd">&#39;&#39;&#39;A string with datetime formating mask&#39;&#39;&#39;</span>
<span class="n">data</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;data&#39;</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">season</span> <span class="o">==</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">year</span><span class="p">:</span>
<span class="n">ndata</span> <span class="o">=</span> <span class="p">[</span><span class="n">strip_datepart</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">season</span><span class="p">)</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">data</span><span class="p">]</span>
@ -114,7 +118,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span> <span class="o">=</span> <span class="n">FS</span><span class="o">.</span><span class="n">set_ordered</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sets</span><span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">type</span> <span class="o">==</span> <span class="s1">&#39;seasonal&#39;</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">extractor</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">strip_datepart</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">season</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">extractor</span> <span class="o">=</span> <span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">strip_datepart</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">season</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">mask</span><span class="p">)</span>
<div class="viewcode-block" id="TimeGridPartitioner.build"><a class="viewcode-back" href="../../../../pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.build">[docs]</a> <span class="k">def</span> <span class="nf">build</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="n">sets</span> <span class="o">=</span> <span class="p">{}</span>
@ -124,6 +128,14 @@
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">season</span> <span class="o">==</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">year</span><span class="p">:</span>
<span class="n">dlen</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">max</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">min</span><span class="p">)</span>
<span class="n">partlen</span> <span class="o">=</span> <span class="n">dlen</span> <span class="o">/</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitions</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">season</span> <span class="o">==</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">day_of_week</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">min</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">max</span><span class="p">,</span> <span class="n">partlen</span><span class="p">,</span> <span class="n">pl2</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">season</span> <span class="o">==</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">hour</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">min</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">max</span><span class="p">,</span> <span class="n">partlen</span><span class="p">,</span> <span class="n">pl2</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">24</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">season</span> <span class="o">==</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">month</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">min</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">max</span><span class="p">,</span> <span class="n">partlen</span><span class="p">,</span> <span class="n">pl2</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">13</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">season</span> <span class="ow">in</span> <span class="p">(</span><span class="n">DateTime</span><span class="o">.</span><span class="n">half</span><span class="p">,</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">third</span><span class="p">,</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">quarter</span><span class="p">,</span> <span class="n">DateTime</span><span class="o">.</span><span class="n">sixth</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">min</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">max</span><span class="p">,</span> <span class="n">partlen</span><span class="p">,</span> <span class="n">pl2</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">season</span><span class="o">.</span><span class="n">value</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">partlen</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">season</span><span class="o">.</span><span class="n">value</span> <span class="o">/</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitions</span>
<span class="n">pl2</span> <span class="o">=</span> <span class="n">partlen</span> <span class="o">/</span> <span class="mi">2</span>

View File

@ -157,6 +157,9 @@
<div class="viewcode-block" id="CMeansPartitioner.build"><a class="viewcode-back" href="../../../pyFTS.partitioners.html#pyFTS.partitioners.CMeans.CMeansPartitioner.build">[docs]</a> <span class="k">def</span> <span class="nf">build</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="n">sets</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">type</span><span class="p">,</span> <span class="s1">&#39;variable&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">variable</span><span class="p">}</span>
<span class="n">centroides</span> <span class="o">=</span> <span class="n">c_means</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">partitions</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
<span class="n">centroides</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">max</span><span class="p">)</span>
<span class="n">centroides</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">min</span><span class="p">)</span>
@ -166,7 +169,7 @@
<span class="n">_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_name</span><span class="p">(</span><span class="n">c</span><span class="p">)</span>
<span class="n">sets</span><span class="p">[</span><span class="n">_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">FuzzySet</span><span class="o">.</span><span class="n">FuzzySet</span><span class="p">(</span><span class="n">_name</span><span class="p">,</span> <span class="n">Membership</span><span class="o">.</span><span class="n">trimf</span><span class="p">,</span>
<span class="p">[</span><span class="nb">round</span><span class="p">(</span><span class="n">centroides</span><span class="p">[</span><span class="n">c</span> <span class="o">-</span> <span class="mi">1</span><span class="p">],</span> <span class="mi">3</span><span class="p">),</span> <span class="nb">round</span><span class="p">(</span><span class="n">centroides</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="mi">3</span><span class="p">),</span> <span class="nb">round</span><span class="p">(</span><span class="n">centroides</span><span class="p">[</span><span class="n">c</span> <span class="o">+</span> <span class="mi">1</span><span class="p">],</span> <span class="mi">3</span><span class="p">)],</span>
<span class="nb">round</span><span class="p">(</span><span class="n">centroides</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="mi">3</span><span class="p">))</span>
<span class="nb">round</span><span class="p">(</span><span class="n">centroides</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="mi">3</span><span class="p">),</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">return</span> <span class="n">sets</span></div></div>
</pre></div>

View File

@ -161,23 +161,25 @@
<div class="viewcode-block" id="EntropyPartitioner.build"><a class="viewcode-back" href="../../../pyFTS.partitioners.html#pyFTS.partitioners.Entropy.EntropyPartitioner.build">[docs]</a> <span class="k">def</span> <span class="nf">build</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="n">sets</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">type</span><span class="p">,</span> <span class="s1">&#39;variable&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">variable</span><span class="p">}</span>
<span class="n">partitions</span> <span class="o">=</span> <span class="n">bestSplit</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitions</span><span class="p">)</span>
<span class="n">partitions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">min</span><span class="p">)</span>
<span class="n">partitions</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">max</span><span class="p">)</span>
<span class="n">partitions</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="nb">set</span><span class="p">(</span><span class="n">partitions</span><span class="p">))</span>
<span class="n">partitions</span><span class="o">.</span><span class="n">sort</span><span class="p">()</span>
<span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="nb">len</span><span class="p">(</span><span class="n">partitions</span><span class="p">)</span><span class="o">-</span><span class="mi">1</span><span class="p">):</span>
<span class="n">_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_name</span><span class="p">(</span><span class="n">c</span><span class="p">)</span>
<span class="n">_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_name</span><span class="p">(</span><span class="n">c</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">membership_function</span> <span class="o">==</span> <span class="n">Membership</span><span class="o">.</span><span class="n">trimf</span><span class="p">:</span>
<span class="n">sets</span><span class="p">[</span><span class="n">_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">FuzzySet</span><span class="o">.</span><span class="n">FuzzySet</span><span class="p">(</span><span class="n">_name</span><span class="p">,</span> <span class="n">Membership</span><span class="o">.</span><span class="n">trimf</span><span class="p">,</span>
<span class="p">[</span><span class="n">partitions</span><span class="p">[</span><span class="n">c</span> <span class="o">-</span> <span class="mi">1</span><span class="p">],</span> <span class="n">partitions</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="n">partitions</span><span class="p">[</span><span class="n">c</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]],</span><span class="n">partitions</span><span class="p">[</span><span class="n">c</span><span class="p">])</span>
<span class="p">[</span><span class="n">partitions</span><span class="p">[</span><span class="n">c</span> <span class="o">-</span> <span class="mi">1</span><span class="p">],</span> <span class="n">partitions</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="n">partitions</span><span class="p">[</span><span class="n">c</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]],</span><span class="n">partitions</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">membership_function</span> <span class="o">==</span> <span class="n">Membership</span><span class="o">.</span><span class="n">trapmf</span><span class="p">:</span>
<span class="n">b1</span> <span class="o">=</span> <span class="p">(</span><span class="n">partitions</span><span class="p">[</span><span class="n">c</span><span class="p">]</span> <span class="o">-</span> <span class="n">partitions</span><span class="p">[</span><span class="n">c</span> <span class="o">-</span> <span class="mi">1</span><span class="p">])</span><span class="o">/</span><span class="mi">2</span>
<span class="n">b2</span> <span class="o">=</span> <span class="p">(</span><span class="n">partitions</span><span class="p">[</span><span class="n">c</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]</span> <span class="o">-</span> <span class="n">partitions</span><span class="p">[</span><span class="n">c</span><span class="p">])</span> <span class="o">/</span> <span class="mi">2</span>
<span class="n">sets</span><span class="p">[</span><span class="n">_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">FuzzySet</span><span class="o">.</span><span class="n">FuzzySet</span><span class="p">(</span><span class="n">_name</span><span class="p">,</span> <span class="n">Membership</span><span class="o">.</span><span class="n">trapmf</span><span class="p">,</span>
<span class="p">[</span><span class="n">partitions</span><span class="p">[</span><span class="n">c</span> <span class="o">-</span> <span class="mi">1</span><span class="p">],</span> <span class="n">partitions</span><span class="p">[</span><span class="n">c</span><span class="p">]</span> <span class="o">-</span> <span class="n">b1</span><span class="p">,</span>
<span class="n">partitions</span><span class="p">[</span><span class="n">c</span><span class="p">]</span> <span class="o">+</span> <span class="n">b2</span><span class="p">,</span> <span class="n">partitions</span><span class="p">[</span><span class="n">c</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]],</span>
<span class="n">partitions</span><span class="p">[</span><span class="n">c</span><span class="p">])</span>
<span class="n">partitions</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">return</span> <span class="n">sets</span></div></div>
</pre></div>

View File

@ -187,6 +187,8 @@
<div class="viewcode-block" id="FCMPartitioner.build"><a class="viewcode-back" href="../../../pyFTS.partitioners.html#pyFTS.partitioners.FCM.FCMPartitioner.build">[docs]</a> <span class="k">def</span> <span class="nf">build</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="n">sets</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">type</span><span class="p">,</span> <span class="s1">&#39;variable&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">variable</span><span class="p">}</span>
<span class="n">centroids</span> <span class="o">=</span> <span class="n">fuzzy_cmeans</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">partitions</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="n">centroids</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">max</span><span class="p">)</span>
<span class="n">centroids</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">min</span><span class="p">)</span>
@ -198,14 +200,14 @@
<span class="n">sets</span><span class="p">[</span><span class="n">_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">FuzzySet</span><span class="o">.</span><span class="n">FuzzySet</span><span class="p">(</span><span class="n">_name</span><span class="p">,</span> <span class="n">Membership</span><span class="o">.</span><span class="n">trimf</span><span class="p">,</span>
<span class="p">[</span><span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span> <span class="o">-</span> <span class="mi">1</span><span class="p">],</span> <span class="mi">3</span><span class="p">),</span> <span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="mi">3</span><span class="p">),</span>
<span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span> <span class="o">+</span> <span class="mi">1</span><span class="p">],</span> <span class="mi">3</span><span class="p">)],</span>
<span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="mi">3</span><span class="p">))</span>
<span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="mi">3</span><span class="p">),</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">membership_function</span> <span class="o">==</span> <span class="n">Membership</span><span class="o">.</span><span class="n">trapmf</span><span class="p">:</span>
<span class="n">q1</span> <span class="o">=</span> <span class="p">(</span><span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="mi">3</span><span class="p">)</span> <span class="o">-</span> <span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span> <span class="o">-</span> <span class="mi">1</span><span class="p">],</span> <span class="mi">3</span><span class="p">))</span> <span class="o">/</span> <span class="mi">2</span>
<span class="n">q2</span> <span class="o">=</span> <span class="p">(</span><span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span> <span class="o">+</span> <span class="mi">1</span><span class="p">],</span> <span class="mi">3</span><span class="p">)</span> <span class="o">-</span> <span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="mi">3</span><span class="p">))</span> <span class="o">/</span> <span class="mi">2</span>
<span class="n">sets</span><span class="p">[</span><span class="n">_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">FuzzySet</span><span class="o">.</span><span class="n">FuzzySet</span><span class="p">(</span><span class="n">_name</span><span class="p">,</span> <span class="n">Membership</span><span class="o">.</span><span class="n">trimf</span><span class="p">,</span>
<span class="p">[</span><span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span> <span class="o">-</span> <span class="mi">1</span><span class="p">],</span> <span class="mi">3</span><span class="p">),</span> <span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="mi">3</span><span class="p">)</span> <span class="o">-</span> <span class="n">q1</span><span class="p">,</span>
<span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="mi">3</span><span class="p">)</span> <span class="o">+</span> <span class="n">q2</span><span class="p">,</span> <span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span> <span class="o">+</span> <span class="mi">1</span><span class="p">],</span> <span class="mi">3</span><span class="p">)],</span>
<span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="mi">3</span><span class="p">))</span>
<span class="nb">round</span><span class="p">(</span><span class="n">centroids</span><span class="p">[</span><span class="n">c</span><span class="p">],</span> <span class="mi">3</span><span class="p">),</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">return</span> <span class="n">sets</span></div></div>
</pre></div>

View File

@ -106,6 +106,8 @@
<span class="n">sets</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">type</span><span class="p">,</span> <span class="s1">&#39;variable&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">variable</span><span class="p">}</span>
<span class="n">dlen</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">max</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">min</span>
<span class="n">npart</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">ceil</span><span class="p">(</span><span class="n">dlen</span> <span class="o">/</span> <span class="n">base</span><span class="p">)</span>
<span class="n">partition</span> <span class="o">=</span> <span class="n">math</span><span class="o">.</span><span class="n">ceil</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">min</span><span class="p">)</span>
@ -113,14 +115,14 @@
<span class="n">_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_name</span><span class="p">(</span><span class="n">c</span><span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">membership_function</span> <span class="o">==</span> <span class="n">Membership</span><span class="o">.</span><span class="n">trimf</span><span class="p">:</span>
<span class="n">sets</span><span class="p">[</span><span class="n">_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">FuzzySet</span><span class="o">.</span><span class="n">FuzzySet</span><span class="p">(</span><span class="n">_name</span><span class="p">,</span> <span class="n">Membership</span><span class="o">.</span><span class="n">trimf</span><span class="p">,</span>
<span class="p">[</span><span class="n">partition</span> <span class="o">-</span> <span class="n">base</span><span class="p">,</span> <span class="n">partition</span><span class="p">,</span> <span class="n">partition</span> <span class="o">+</span> <span class="n">base</span><span class="p">],</span> <span class="n">partition</span><span class="p">)</span>
<span class="p">[</span><span class="n">partition</span> <span class="o">-</span> <span class="n">base</span><span class="p">,</span> <span class="n">partition</span><span class="p">,</span> <span class="n">partition</span> <span class="o">+</span> <span class="n">base</span><span class="p">],</span> <span class="n">partition</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">membership_function</span> <span class="o">==</span> <span class="n">Membership</span><span class="o">.</span><span class="n">gaussmf</span><span class="p">:</span>
<span class="n">sets</span><span class="p">[</span><span class="n">_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">FuzzySet</span><span class="o">.</span><span class="n">FuzzySet</span><span class="p">(</span><span class="n">_name</span><span class="p">,</span> <span class="n">Membership</span><span class="o">.</span><span class="n">gaussmf</span><span class="p">,</span>
<span class="p">[</span><span class="n">partition</span><span class="p">,</span> <span class="n">base</span><span class="o">/</span><span class="mi">2</span><span class="p">],</span> <span class="n">partition</span><span class="p">)</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">membership_function</span> <span class="o">==</span> <span class="n">Membership</span><span class="o">.</span><span class="n">trapmf</span><span class="p">:</span>
<span class="n">sets</span><span class="p">[</span><span class="n">_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">FuzzySet</span><span class="o">.</span><span class="n">FuzzySet</span><span class="p">(</span><span class="n">_name</span><span class="p">,</span> <span class="n">Membership</span><span class="o">.</span><span class="n">trapmf</span><span class="p">,</span>
<span class="p">[</span><span class="n">partition</span> <span class="o">-</span> <span class="n">base</span><span class="p">,</span> <span class="n">partition</span> <span class="o">-</span> <span class="p">(</span><span class="n">base</span><span class="o">/</span><span class="mi">2</span><span class="p">),</span>
<span class="n">partition</span> <span class="o">+</span> <span class="p">(</span><span class="n">base</span> <span class="o">/</span> <span class="mi">2</span><span class="p">),</span> <span class="n">partition</span> <span class="o">+</span> <span class="n">base</span><span class="p">],</span> <span class="n">partition</span><span class="p">)</span>
<span class="n">partition</span> <span class="o">+</span> <span class="p">(</span><span class="n">base</span> <span class="o">/</span> <span class="mi">2</span><span class="p">),</span> <span class="n">partition</span> <span class="o">+</span> <span class="n">base</span><span class="p">],</span> <span class="n">partition</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="n">partition</span> <span class="o">+=</span> <span class="n">base</span>

View File

@ -94,11 +94,11 @@
<div class="viewcode-block" id="SingletonPartitioner.build"><a class="viewcode-back" href="../../../pyFTS.partitioners.html#pyFTS.partitioners.Singleton.SingletonPartitioner.build">[docs]</a> <span class="k">def</span> <span class="nf">build</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span>
<span class="n">sets</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">type</span><span class="p">,</span> <span class="s1">&#39;variable&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">variable</span><span class="p">}</span>
<span class="k">for</span> <span class="n">count</span><span class="p">,</span> <span class="n">instance</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">data</span><span class="p">):</span>
<span class="n">_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_name</span><span class="p">(</span><span class="n">count</span><span class="p">)</span>
<span class="n">sets</span><span class="p">[</span><span class="n">_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">FuzzySet</span><span class="o">.</span><span class="n">FuzzySet</span><span class="p">(</span><span class="n">_name</span><span class="p">,</span> <span class="n">Membership</span><span class="o">.</span><span class="n">singleton</span><span class="p">,</span> <span class="p">[</span><span class="n">instance</span><span class="p">],</span> <span class="n">instance</span><span class="p">)</span>
<span class="n">kwargs</span> <span class="o">=</span> <span class="p">{</span><span class="s1">&#39;type&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">type</span><span class="p">,</span> <span class="s1">&#39;variable&#39;</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">variable</span><span class="p">}</span>
<span class="n">sets</span><span class="p">[</span><span class="n">_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">FuzzySet</span><span class="o">.</span><span class="n">FuzzySet</span><span class="p">(</span><span class="n">_name</span><span class="p">,</span> <span class="n">Membership</span><span class="o">.</span><span class="n">singleton</span><span class="p">,</span> <span class="p">[</span><span class="n">instance</span><span class="p">],</span> <span class="n">instance</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="k">return</span> <span class="n">sets</span></div></div>
</pre></div>

View File

@ -139,7 +139,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">sets</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">ndata</span><span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">setnames</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">setnames</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">setnames</span><span class="p">[:</span><span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sets</span><span class="p">)]</span>
<span class="k">else</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span> <span class="o">=</span> <span class="n">FuzzySet</span><span class="o">.</span><span class="n">set_ordered</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">sets</span><span class="p">)</span>

View File

@ -2,6 +2,6 @@ pyFTS
=====
.. toctree::
:maxdepth: 4
:maxdepth: 5
pyFTS

View File

@ -29,6 +29,14 @@ pyFTS.data.common module
Datasets
--------
Artificial and synthetic data generators
----------------------------------------
.. automodule:: pyFTS.data.artificial
:members:
:undoc-members:
:show-inheritance:
AirPassengers dataset
-------------------------------
@ -143,14 +151,6 @@ TAIEX dataset
:undoc-members:
:show-inheritance:
pyFTS.data.artificial module
----------------------------
.. automodule:: pyFTS.data.artificial
:members:
:undoc-members:
:show-inheritance:
Henon chaotic time series
-------------------------

View File

@ -0,0 +1,32 @@
pyFTS.distributed package
=========================
Module contents
---------------
.. automodule:: pyFTS.distributed
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
pyFTS.distributed.dispy module
------------------------------
.. automodule:: pyFTS.distributed.dispy
:members:
:undoc-members:
:show-inheritance:
pyFTS.distributed.spark module
----------------------------------
.. automodule:: pyFTS.distributed.spark
:members:
:undoc-members:
:show-inheritance:

View File

@ -28,4 +28,12 @@ pyFTS.hyperparam.GridSearch module
:undoc-members:
:show-inheritance:
pyFTS.hyperparam.Evolutionary module
------------------------------------
.. automodule:: pyFTS.hyperparam.Evolutionary
:members:
:undoc-members:
:show-inheritance:

View File

@ -1,5 +1,5 @@
pyFTS.models.incremental package
=============================
================================
Module contents
---------------
@ -13,10 +13,19 @@ Module contents
Submodules
----------
pyFTS.models.incremental.Retrainer module
-------------------------------------
pyFTS.models.incremental.TimeVariant module
-------------------------------------------
.. automodule:: pyFTS.models.incremental.Retrainer
.. automodule:: pyFTS.models.incremental.TimeVariant
:members:
:undoc-members:
:show-inheritance:
pyFTS.models.incremental.IncrementalEnsemble module
---------------------------------------------------
.. automodule:: pyFTS.models.incremental.IncrementalEnsemble
:members:
:undoc-members:
:show-inheritance:

View File

@ -9,6 +9,7 @@ Subpackages
pyFTS.benchmarks
pyFTS.common
pyFTS.data
pyFTS.distributed
pyFTS.hyperparam
pyFTS.models
pyFTS.partitioners

View File

@ -123,7 +123,11 @@
</li>
</ul></li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.alpha_cut">alpha_cut (pyFTS.common.fts.FTS attribute)</a>
<ul>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.variable.Variable.alpha_cut">(pyFTS.models.multivariate.variable.Variable attribute)</a>
</li>
</ul></li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Util.analytic_tabular_dataframe">analytic_tabular_dataframe() (in module pyFTS.benchmarks.Util)</a>
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Util.analytical_data_columns">analytical_data_columns() (in module pyFTS.benchmarks.Util)</a>
@ -235,7 +239,7 @@
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.auto_update">auto_update (pyFTS.common.fts.FTS attribute)</a>
<ul>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.auto_update">(pyFTS.models.incremental.Retrainer.Retrainer attribute)</a>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer.auto_update">(pyFTS.models.incremental.TimeVariant.Retrainer attribute)</a>
</li>
</ul></li>
<li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.averageloglikelihood">averageloglikelihood() (pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution method)</a>
@ -248,8 +252,12 @@
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Util.base_dataframe_columns">base_dataframe_columns() (in module pyFTS.benchmarks.Util)</a>
</li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.batch_size">batch_size (pyFTS.models.incremental.Retrainer.Retrainer attribute)</a>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.batch_size">batch_size (pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS attribute)</a>
<ul>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer.batch_size">(pyFTS.models.incremental.TimeVariant.Retrainer attribute)</a>
</li>
</ul></li>
<li><a href="pyFTS.common.html#pyFTS.common.Membership.bellmf">bellmf() (in module pyFTS.common.Membership)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.benchmark_only">benchmark_only (pyFTS.common.fts.FTS attribute)</a>
@ -259,6 +267,8 @@
<li><a href="pyFTS.common.html#pyFTS.common.SortedCollection.SortedCollection.between">between() (pyFTS.common.SortedCollection.SortedCollection method)</a>
</li>
<li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.bins">bins (pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution attribute)</a>
</li>
<li><a href="pyFTS.data.html#pyFTS.data.artificial.SignalEmulator.blip">blip() (pyFTS.data.artificial.SignalEmulator method)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.Transformations.BoxCox">BoxCox (class in pyFTS.common.Transformations)</a>
</li>
@ -268,6 +278,8 @@
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.brier_score">brier_score() (in module pyFTS.benchmarks.Measures)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.variable.Variable.build">build() (pyFTS.models.multivariate.variable.Variable method)</a>
<ul>
@ -292,8 +304,6 @@
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.build">(pyFTS.partitioners.partitioner.Partitioner method)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.build_cdf_qtl">build_cdf_qtl() (pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution method)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.tree.build_tree_without_order">build_tree_without_order() (in module pyFTS.common.tree)</a>
@ -352,11 +362,13 @@
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.ResidualAnalysis.compare_residuals">compare_residuals() (in module pyFTS.benchmarks.ResidualAnalysis)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.benchmarks.compareModelsPlot">compareModelsPlot() (in module pyFTS.benchmarks.benchmarks)</a>
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.benchmarks.compareModelsTable">compareModelsTable() (in module pyFTS.benchmarks.benchmarks)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.data.html#pyFTS.data.artificial.SignalEmulator.components">components (pyFTS.data.artificial.SignalEmulator attribute)</a>
</li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.nsfts.NonStationaryFTS.conditional_perturbation_factors">conditional_perturbation_factors() (pyFTS.models.nonstationary.nsfts.NonStationaryFTS method)</a>
</li>
@ -391,6 +403,12 @@
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Util.create_benchmark_tables">create_benchmark_tables() (in module pyFTS.benchmarks.Util)</a>
</li>
<li><a href="pyFTS.hyperparam.html#pyFTS.hyperparam.Util.create_hyperparam_tables">create_hyperparam_tables() (in module pyFTS.hyperparam.Util)</a>
</li>
<li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.create_multivariate_model">create_multivariate_model() (in module pyFTS.distributed.spark)</a>
</li>
<li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.create_spark_conf">create_spark_conf() (in module pyFTS.distributed.spark)</a>
</li>
<li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.create_univariate_model">create_univariate_model() (in module pyFTS.distributed.spark)</a>
</li>
<li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.crossentropy">crossentropy() (pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution method)</a>
</li>
@ -420,10 +438,10 @@
</li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.day_of_week">day_of_week (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.day_of_year">day_of_year (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.density">density() (pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution method)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.detail">detail (pyFTS.common.fts.FTS attribute)</a>
@ -435,6 +453,10 @@
<li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.differential_offset">differential_offset() (pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution method)</a>
</li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.CMeans.distance">distance() (in module pyFTS.partitioners.CMeans)</a>
</li>
<li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.distributed_predict">distributed_predict() (in module pyFTS.distributed.spark)</a>
</li>
<li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.distributed_train">distributed_train() (in module pyFTS.distributed.spark)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.Util.draw_sets_on_axis">draw_sets_on_axis() (in module pyFTS.common.Util)</a>
</li>
@ -547,7 +569,9 @@
</li>
<li><a href="pyFTS.models.html#pyFTS.models.hwang.HighOrderFTS.forecast">(pyFTS.models.hwang.HighOrderFTS method)</a>
</li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.forecast">(pyFTS.models.incremental.Retrainer.Retrainer method)</a>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.forecast">(pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS method)</a>
</li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer.forecast">(pyFTS.models.incremental.TimeVariant.Retrainer method)</a>
</li>
<li><a href="pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFTS.forecast">(pyFTS.models.ismailefendi.ImprovedWeightedFTS method)</a>
</li>
@ -662,15 +686,19 @@
</li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS">FTS (class in pyFTS.common.fts)</a>
</li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.fts_method">fts_method (pyFTS.models.incremental.Retrainer.Retrainer attribute)</a>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.fts_method">fts_method (pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS attribute)</a>
<ul>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer.fts_method">(pyFTS.models.incremental.TimeVariant.Retrainer attribute)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.fts_method">(pyFTS.models.multivariate.cmvfts.ClusteredMVFTS attribute)</a>
</li>
</ul></li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.fts_params">fts_params (pyFTS.models.incremental.Retrainer.Retrainer attribute)</a>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.fts_params">fts_params (pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS attribute)</a>
<ul>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer.fts_params">(pyFTS.models.incremental.TimeVariant.Retrainer attribute)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.fts_params">(pyFTS.models.multivariate.cmvfts.ClusteredMVFTS attribute)</a>
</li>
</ul></li>
@ -781,10 +809,14 @@
</li>
</ul></li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.generate_lhs_flrs">generate_lhs_flrs() (pyFTS.models.multivariate.mvfts.MVFTS method)</a>
</li>
<li><a href="pyFTS.data.html#pyFTS.data.artificial.generate_linear_periodic_gaussian">generate_linear_periodic_gaussian() (in module pyFTS.data.artificial)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.FLR.generate_non_recurrent_flrs">generate_non_recurrent_flrs() (in module pyFTS.common.FLR)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.FLR.generate_recurrent_flrs">generate_recurrent_flrs() (in module pyFTS.common.FLR)</a>
</li>
<li><a href="pyFTS.data.html#pyFTS.data.artificial.generate_sinoidal_periodic_gaussian">generate_sinoidal_periodic_gaussian() (in module pyFTS.data.artificial)</a>
</li>
<li><a href="pyFTS.data.html#pyFTS.data.artificial.generate_uniform_linear">generate_uniform_linear() (in module pyFTS.data.artificial)</a>
</li>
@ -793,6 +825,8 @@
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.benchmarks.get_benchmark_point_methods">get_benchmark_point_methods() (in module pyFTS.benchmarks.benchmarks)</a>
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.benchmarks.get_benchmark_probabilistic_methods">get_benchmark_probabilistic_methods() (in module pyFTS.benchmarks.benchmarks)</a>
</li>
<li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.get_clustered_partitioner">get_clustered_partitioner() (in module pyFTS.distributed.spark)</a>
</li>
<li><a href="pyFTS.data.html#pyFTS.data.AirPassengers.get_data">get_data() (in module pyFTS.data.AirPassengers)</a>
@ -989,6 +1023,8 @@
<li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.EnsembleFTS.get_models_forecasts">get_models_forecasts() (pyFTS.models.ensemble.ensemble.EnsembleFTS method)</a>
</li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.get_name">get_name() (pyFTS.partitioners.partitioner.Partitioner method)</a>
</li>
<li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.get_partitioner">get_partitioner() (in module pyFTS.distributed.spark)</a>
</li>
<li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.EnsembleFTS.get_point">get_point() (pyFTS.models.ensemble.ensemble.EnsembleFTS method)</a>
</li>
@ -1040,6 +1076,8 @@
<li><a href="pyFTS.models.html#pyFTS.models.pwfts.ProbabilisticWeightedFTS.get_upper">(pyFTS.models.pwfts.ProbabilisticWeightedFTS method)</a>
</li>
</ul></li>
<li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.get_variables">get_variables() (in module pyFTS.distributed.spark)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.tree.FLRGTreeNode.getChildren">getChildren() (pyFTS.common.tree.FLRGTreeNode method)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.tree.FLRGTreeNode.getStr">getStr() (pyFTS.common.tree.FLRGTreeNode method)</a>
@ -1055,6 +1093,8 @@
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.kde.KernelSmoothing.h">h (pyFTS.probabilistic.kde.KernelSmoothing attribute)</a>
</li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.half">half (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.has_interval_forecasting">has_interval_forecasting (pyFTS.common.fts.FTS attribute)</a>
</li>
@ -1070,21 +1110,19 @@
</li>
<li><a href="pyFTS.models.html#pyFTS.models.hofts.HighOrderFLRG">HighOrderFLRG (class in pyFTS.models.hofts)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.models.html#pyFTS.models.hofts.HighOrderFTS">HighOrderFTS (class in pyFTS.models.hofts)</a>
<ul>
<li><a href="pyFTS.models.html#pyFTS.models.hwang.HighOrderFTS">(class in pyFTS.models.hwang)</a>
</li>
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.cvfts.HighOrderNonstationaryFLRG">HighOrderNonstationaryFLRG (class in pyFTS.models.nonstationary.cvfts)</a>
</li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.honsfts.HighOrderNonStationaryFLRG">HighOrderNonStationaryFLRG (class in pyFTS.models.nonstationary.honsfts)</a>
</li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.honsfts.HighOrderNonStationaryFTS">HighOrderNonStationaryFTS (class in pyFTS.models.nonstationary.honsfts)</a>
</li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.hour">hour (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.hour_of_day">hour_of_day (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li>
@ -1105,6 +1143,10 @@
<li><a href="pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFLRG">ImprovedWeightedFLRG (class in pyFTS.models.ismailefendi)</a>
</li>
<li><a href="pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFTS">ImprovedWeightedFTS (class in pyFTS.models.ismailefendi)</a>
</li>
<li><a href="pyFTS.data.html#pyFTS.data.artificial.SignalEmulator.incremental_gaussian">incremental_gaussian() (pyFTS.data.artificial.SignalEmulator method)</a>
</li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS">IncrementalEnsembleFTS (class in pyFTS.models.incremental.IncrementalEnsemble)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.FLR.IndexedFLR.index">index (pyFTS.common.FLR.IndexedFLR attribute)</a>
</li>
@ -1159,6 +1201,8 @@
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.is_high_order">is_high_order (pyFTS.common.fts.FTS attribute)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.is_multivariate">is_multivariate (pyFTS.common.fts.FTS attribute)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.is_wrapper">is_wrapper (pyFTS.common.fts.FTS attribute)</a>
</li>
</ul></td>
</tr></table>
@ -1233,7 +1277,11 @@
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.mape_interval">mape_interval() (in module pyFTS.benchmarks.Measures)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.variable.Variable.mask">mask (pyFTS.models.multivariate.variable.Variable attribute)</a>
<ul>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.mask">(pyFTS.models.seasonal.partitioner.TimeGridPartitioner attribute)</a>
</li>
</ul></li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.max_lag">max_lag (pyFTS.common.fts.FTS attribute)</a>
</li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.FCM.membership">membership() (in module pyFTS.partitioners.FCM)</a>
@ -1251,11 +1299,11 @@
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.membership_function">membership_function (pyFTS.partitioners.partitioner.Partitioner attribute)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.merge">merge() (pyFTS.common.fts.FTS method)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.FuzzySet.FuzzySet.mf">mf (pyFTS.common.FuzzySet.FuzzySet attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.common.html#pyFTS.common.FuzzySet.FuzzySet.mf">mf (pyFTS.common.FuzzySet.FuzzySet attribute)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.min_order">min_order (pyFTS.common.fts.FTS attribute)</a>
</li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.minute_of_day">minute_of_day (pyFTS.models.seasonal.common.DateTime attribute)</a>
@ -1268,7 +1316,7 @@
</li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.minute_of_year">minute_of_year (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.model">model (pyFTS.models.incremental.Retrainer.Retrainer attribute)</a>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer.model">model (pyFTS.models.incremental.TimeVariant.Retrainer attribute)</a>
<ul>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.model">(pyFTS.models.multivariate.cmvfts.ClusteredMVFTS attribute)</a>
@ -1369,13 +1417,23 @@
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.partitioner">partitioner (pyFTS.common.fts.FTS attribute)</a>
<ul>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.partitioner">(pyFTS.models.incremental.Retrainer.Retrainer attribute)</a>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer.partitioner">(pyFTS.models.incremental.TimeVariant.Retrainer attribute)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.variable.Variable.partitioner">(pyFTS.models.multivariate.variable.Variable attribute)</a>
</li>
</ul></li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.partitioner_method">partitioner_method (pyFTS.models.incremental.Retrainer.Retrainer attribute)</a>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.partitioner_method">partitioner_method (pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS attribute)</a>
<ul>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer.partitioner_method">(pyFTS.models.incremental.TimeVariant.Retrainer attribute)</a>
</li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.partitioner_params">partitioner_params (pyFTS.models.incremental.Retrainer.Retrainer attribute)</a>
</ul></li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.partitioner_params">partitioner_params (pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS attribute)</a>
<ul>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer.partitioner_params">(pyFTS.models.incremental.TimeVariant.Retrainer attribute)</a>
</li>
</ul></li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.partitions">partitions (pyFTS.partitioners.partitioner.Partitioner attribute)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.tree.FLRGTreeNode.paths">paths() (pyFTS.common.tree.FLRGTreeNode method)</a>
@ -1385,6 +1443,8 @@
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.common.FuzzySet.perform_width">perform_width() (pyFTS.models.nonstationary.common.FuzzySet method)</a>
</li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.perturbation.periodic">periodic() (in module pyFTS.models.nonstationary.perturbation)</a>
</li>
<li><a href="pyFTS.data.html#pyFTS.data.artificial.SignalEmulator.periodic_gaussian">periodic_gaussian() (pyFTS.data.artificial.SignalEmulator method)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.Util.persist_env">persist_env() (in module pyFTS.common.Util)</a>
</li>
@ -1505,6 +1565,8 @@
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.benchmarks.process_point_jobs">process_point_jobs() (in module pyFTS.benchmarks.benchmarks)</a>
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.benchmarks.process_probabilistic_jobs">process_probabilistic_jobs() (in module pyFTS.benchmarks.benchmarks)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.product_dict">product_dict() (in module pyFTS.models.multivariate.mvfts)</a>
</li>
<li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.pseudologlikelihood">pseudologlikelihood() (pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution method)</a>
</li>
@ -1529,11 +1591,11 @@
<li><a href="pyFTS.benchmarks.html#module-pyFTS.benchmarks.Util">pyFTS.benchmarks.Util (module)</a>
</li>
<li><a href="pyFTS.common.html#module-pyFTS.common">pyFTS.common (module)</a>
</li>
<li><a href="pyFTS.common.html#module-pyFTS.common.Composite">pyFTS.common.Composite (module)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.common.html#module-pyFTS.common.Composite">pyFTS.common.Composite (module)</a>
</li>
<li><a href="pyFTS.common.html#module-pyFTS.common.FLR">pyFTS.common.FLR (module)</a>
</li>
<li><a href="pyFTS.common.html#module-pyFTS.common.flrg">pyFTS.common.flrg (module)</a>
@ -1599,6 +1661,10 @@
<li><a href="pyFTS.data.html#module-pyFTS.data.sunspots">pyFTS.data.sunspots (module)</a>
</li>
<li><a href="pyFTS.data.html#module-pyFTS.data.TAIEX">pyFTS.data.TAIEX (module)</a>
</li>
<li><a href="pyFTS.distributed.html#module-pyFTS.distributed">pyFTS.distributed (module)</a>
</li>
<li><a href="pyFTS.distributed.html#module-pyFTS.distributed.spark">pyFTS.distributed.spark (module)</a>
</li>
<li><a href="pyFTS.hyperparam.html#module-pyFTS.hyperparam">pyFTS.hyperparam (module)</a>
</li>
@ -1626,7 +1692,9 @@
</li>
<li><a href="pyFTS.models.incremental.html#module-pyFTS.models.incremental">pyFTS.models.incremental (module)</a>
</li>
<li><a href="pyFTS.models.incremental.html#module-pyFTS.models.incremental.Retrainer">pyFTS.models.incremental.Retrainer (module)</a>
<li><a href="pyFTS.models.incremental.html#module-pyFTS.models.incremental.IncrementalEnsemble">pyFTS.models.incremental.IncrementalEnsemble (module)</a>
</li>
<li><a href="pyFTS.models.incremental.html#module-pyFTS.models.incremental.TimeVariant">pyFTS.models.incremental.TimeVariant (module)</a>
</li>
<li><a href="pyFTS.models.html#module-pyFTS.models.ismailefendi">pyFTS.models.ismailefendi (module)</a>
</li>
@ -1725,6 +1793,8 @@
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.quantreg.QuantileRegression">QuantileRegression (class in pyFTS.benchmarks.quantreg)</a>
</li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.quarter">quarter (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li>
</ul></td>
</tr></table>
@ -1746,7 +1816,7 @@
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.resolution">resolution() (in module pyFTS.benchmarks.Measures)</a>
</li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer">Retrainer (class in pyFTS.models.incremental.Retrainer)</a>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer">Retrainer (class in pyFTS.models.incremental.TimeVariant)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.FLR.FLR.RHS">RHS (pyFTS.common.FLR.FLR attribute)</a>
@ -1765,6 +1835,8 @@
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.rmse_interval">rmse_interval() (in module pyFTS.benchmarks.Measures)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.Transformations.roi">roi() (in module pyFTS.common.Transformations)</a>
</li>
<li><a href="pyFTS.data.html#pyFTS.data.artificial.SignalEmulator.run">run() (pyFTS.data.artificial.SignalEmulator method)</a>
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.benchmarks.run_interval">run_interval() (in module pyFTS.benchmarks.benchmarks)</a>
</li>
@ -1795,6 +1867,8 @@
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Util.scale_params">scale_params() (in module pyFTS.benchmarks.Util)</a>
</li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.partitioners.PolynomialNonStationaryPartitioner.scale_up">scale_up() (pyFTS.models.nonstationary.partitioners.PolynomialNonStationaryPartitioner method)</a>
</li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.season">season (pyFTS.models.seasonal.partitioner.TimeGridPartitioner attribute)</a>
</li>
<li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.multiseasonal.SeasonalEnsembleFTS">SeasonalEnsembleFTS (class in pyFTS.models.ensemble.multiseasonal)</a>
</li>
@ -1830,8 +1904,6 @@
</ul></li>
<li><a href="pyFTS.common.html#pyFTS.common.FuzzySet.set_ordered">set_ordered() (in module pyFTS.common.FuzzySet)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.FLR.FLR.set_rhs">set_rhs() (pyFTS.models.multivariate.FLR.FLR method)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.common.MultivariateFuzzySet.set_target_variable">set_target_variable() (pyFTS.models.multivariate.common.MultivariateFuzzySet method)</a>
@ -1840,7 +1912,11 @@
</li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.setnames">setnames (pyFTS.partitioners.partitioner.Partitioner attribute)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.sets">sets (pyFTS.common.fts.FTS attribute)</a>
</li>
<li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.share_parameters">share_parameters() (in module pyFTS.distributed.spark)</a>
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.sharpness">sharpness() (in module pyFTS.benchmarks.Measures)</a>
</li>
@ -1849,6 +1925,8 @@
<li><a href="pyFTS.common.html#pyFTS.common.Util.show_and_save_image">show_and_save_image() (in module pyFTS.common.Util)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.Membership.sigmf">sigmf() (in module pyFTS.common.Membership)</a>
</li>
<li><a href="pyFTS.data.html#pyFTS.data.artificial.SignalEmulator">SignalEmulator (class in pyFTS.data.artificial)</a>
</li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.partitioners.simplenonstationary_gridpartitioner_builder">simplenonstationary_gridpartitioner_builder() (in module pyFTS.models.nonstationary.partitioners)</a>
</li>
@ -1863,6 +1941,16 @@
<li><a href="pyFTS.common.html#pyFTS.common.Membership.singleton">singleton() (in module pyFTS.common.Membership)</a>
</li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.Singleton.SingletonPartitioner">SingletonPartitioner (class in pyFTS.partitioners.Singleton)</a>
</li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.sixth">sixth (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li>
<li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.slave_forecast_multivariate">slave_forecast_multivariate() (in module pyFTS.distributed.spark)</a>
</li>
<li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.slave_forecast_univariate">slave_forecast_univariate() (in module pyFTS.distributed.spark)</a>
</li>
<li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.slave_train_multivariate">slave_train_multivariate() (in module pyFTS.distributed.spark)</a>
</li>
<li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.slave_train_univariate">slave_train_univariate() (in module pyFTS.distributed.spark)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.Util.sliding_window">sliding_window() (in module pyFTS.common.Util)</a>
</li>
@ -1877,6 +1965,8 @@
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.Entropy.splitAbove">splitAbove() (in module pyFTS.partitioners.Entropy)</a>
</li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.Entropy.splitBelow">splitBelow() (in module pyFTS.partitioners.Entropy)</a>
</li>
<li><a href="pyFTS.data.html#pyFTS.data.artificial.SignalEmulator.stationary_gaussian">stationary_gaussian() (pyFTS.data.artificial.SignalEmulator method)</a>
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Util.stats">stats() (in module pyFTS.benchmarks.Util)</a>
</li>
@ -1891,6 +1981,8 @@
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Util.tabular_dataframe_columns">tabular_dataframe_columns() (in module pyFTS.benchmarks.Util)</a>
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.TheilsInequality">TheilsInequality() (in module pyFTS.benchmarks.Measures)</a>
</li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.third">third (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner">TimeGridPartitioner (class in pyFTS.models.seasonal.partitioner)</a>
</li>
@ -1915,7 +2007,9 @@
</li>
<li><a href="pyFTS.models.html#pyFTS.models.hwang.HighOrderFTS.train">(pyFTS.models.hwang.HighOrderFTS method)</a>
</li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.train">(pyFTS.models.incremental.Retrainer.Retrainer method)</a>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.train">(pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS method)</a>
</li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer.train">(pyFTS.models.incremental.TimeVariant.Retrainer method)</a>
</li>
<li><a href="pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFTS.train">(pyFTS.models.ismailefendi.ImprovedWeightedFTS method)</a>
</li>
@ -1958,8 +2052,12 @@
</ul></li>
<li><a href="pyFTS.common.html#pyFTS.common.Transformations.Transformation">Transformation (class in pyFTS.common.Transformations)</a>
</li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.transformation">transformation (pyFTS.partitioners.partitioner.Partitioner attribute)</a>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.variable.Variable.transformation">transformation (pyFTS.models.multivariate.variable.Variable attribute)</a>
<ul>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.transformation">(pyFTS.partitioners.partitioner.Partitioner attribute)</a>
</li>
</ul></li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.transformations">transformations (pyFTS.common.fts.FTS attribute)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.transformations_param">transformations_param (pyFTS.common.fts.FTS attribute)</a>
@ -2074,8 +2172,12 @@
</li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.common.window_index">window_index() (in module pyFTS.models.nonstationary.common)</a>
</li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.window_length">window_length (pyFTS.models.incremental.Retrainer.Retrainer attribute)</a>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.window_length">window_length (pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS attribute)</a>
<ul>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.TimeVariant.Retrainer.window_length">(pyFTS.models.incremental.TimeVariant.Retrainer attribute)</a>
</li>
</ul></li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.winkler_mean">winkler_mean() (in module pyFTS.benchmarks.Measures)</a>
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.winkler_score">winkler_score() (in module pyFTS.benchmarks.Measures)</a>

View File

@ -130,6 +130,7 @@
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.common">pyFTS.data.common module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#datasets">Datasets</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.artificial">Artificial and synthetic data generators</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.AirPassengers">AirPassengers dataset</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.Bitcoin">Bitcoin dataset</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.DowJones">DowJones dataset</a></li>
@ -144,7 +145,6 @@
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.SONDA">SONDA dataset</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.SP500">S&amp;P 500 dataset</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.TAIEX">TAIEX dataset</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.artificial">pyFTS.data.artificial module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.henon">Henon chaotic time series</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.logistic_map">Logistic_map chaotic time series</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.lorentz">Lorentz chaotic time series</a></li>
@ -153,16 +153,31 @@
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.sunspots">Sunspots dataset</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="pyFTS.distributed.html">pyFTS.distributed package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.distributed.html#module-pyFTS.distributed">Module contents</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.distributed.html#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.distributed.html#pyfts-distributed-dispy-module">pyFTS.distributed.dispy module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.distributed.html#module-pyFTS.distributed.spark">pyFTS.distributed.spark module</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="pyFTS.hyperparam.html">pyFTS.hyperparam package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.hyperparam.html#module-pyFTS.hyperparam">Module contents</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.hyperparam.html#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.hyperparam.html#module-pyFTS.hyperparam.Util">pyFTS.hyperparam.Util module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.hyperparam.html#module-pyFTS.hyperparam.GridSearch">pyFTS.hyperparam.GridSearch module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.hyperparam.html#pyfts-hyperparam-evolutionary-module">pyFTS.hyperparam.Evolutionary module</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="pyFTS.models.html">pyFTS.models package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.html#module-pyFTS.models">Module contents</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.html#subpackages">Subpackages</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.html#subpackages">Subpackages</a><ul>
<li class="toctree-l5"><a class="reference internal" href="pyFTS.models.ensemble.html">pyFTS.models.ensemble package</a></li>
<li class="toctree-l5"><a class="reference internal" href="pyFTS.models.incremental.html">pyFTS.models.incremental package</a></li>
<li class="toctree-l5"><a class="reference internal" href="pyFTS.models.multivariate.html">pyFTS.models.multivariate package</a></li>
<li class="toctree-l5"><a class="reference internal" href="pyFTS.models.nonstationary.html">pyFTS.models.nonstationary package</a></li>
<li class="toctree-l5"><a class="reference internal" href="pyFTS.models.seasonal.html">pyFTS.models.seasonal package</a></li>
</ul>
</li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.html#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.html#module-pyFTS.models.song">pyFTS.models.song module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.html#module-pyFTS.models.chen">pyFTS.models.chen module</a></li>
@ -186,6 +201,7 @@
<li class="toctree-l4"><a class="reference internal" href="pyFTS.partitioners.html#module-pyFTS.partitioners.Grid">pyFTS.partitioners.Grid module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.partitioners.html#module-pyFTS.partitioners.Huarng">pyFTS.partitioners.Huarng module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.partitioners.html#module-pyFTS.partitioners.Singleton">pyFTS.partitioners.Singleton module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.partitioners.html#module-pyFTS.partitioners.Simple">pyFTS.partitioners.Simple module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.partitioners.html#module-pyFTS.partitioners.Util">pyFTS.partitioners.Util module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.partitioners.html#module-pyFTS.partitioners.parallel_util">pyFTS.partitioners.parallel_util module</a></li>
</ul>

Binary file not shown.

View File

@ -310,6 +310,16 @@
<td>&#160;&#160;&#160;
<a href="pyFTS.data.html#module-pyFTS.data.TAIEX"><code class="xref">pyFTS.data.TAIEX</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="pyFTS.distributed.html#module-pyFTS.distributed"><code class="xref">pyFTS.distributed</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="pyFTS.distributed.html#module-pyFTS.distributed.spark"><code class="xref">pyFTS.distributed.spark</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
@ -378,7 +388,12 @@
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="pyFTS.models.incremental.html#module-pyFTS.models.incremental.Retrainer"><code class="xref">pyFTS.models.incremental.Retrainer</code></a></td><td>
<a href="pyFTS.models.incremental.html#module-pyFTS.models.incremental.IncrementalEnsemble"><code class="xref">pyFTS.models.incremental.IncrementalEnsemble</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="pyFTS.models.incremental.html#module-pyFTS.models.incremental.TimeVariant"><code class="xref">pyFTS.models.incremental.TimeVariant</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>

View File

@ -1811,6 +1811,12 @@ a monovariate method, default: False</p>
<dd><p>A boolean value indicating if the model support multivariate time series (Pandas DataFrame), default: False</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.common.fts.FTS.is_wrapper">
<code class="descname">is_wrapper</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.common.fts.FTS.is_wrapper" title="Permalink to this definition"></a></dt>
<dd><p>Indicates that this model is a wrapper for other(s) method(s)</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.common.fts.FTS.lags">
<code class="descname">lags</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.common.fts.FTS.lags" title="Permalink to this definition"></a></dt>
@ -1907,8 +1913,9 @@ needed to forecast a single step ahead</p>
<li><strong>nodes</strong> a list with the dispy cluster nodes addresses</li>
<li><strong>explain</strong> try to explain, step by step, the one-step-ahead point forecasting result given the input data.</li>
<li><strong>generators</strong> for multivariate methods on multi step ahead forecasting, generators is a dict where the keys
are the variables names (except the target_variable) and the values are lambda functions that
accept one value (the actual value of the variable) and return the next value.</li>
are the dataframe columun names (except the target_variable) and the values are lambda functions that
accept one value (the actual value of the variable) and return the next value or trained FTS
models that accept the actual values and forecast new ones.</li>
</ul>
</td>
</tr>

View File

@ -28,7 +28,7 @@
<script type="text/javascript" src="_static/bizstyle.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="pyFTS.hyperparam package" href="pyFTS.hyperparam.html" />
<link rel="next" title="pyFTS.distributed package" href="pyFTS.distributed.html" />
<link rel="prev" title="pyFTS.common package" href="pyFTS.common.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!--[if lt IE 9]>
@ -45,7 +45,7 @@
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="pyFTS.hyperparam.html" title="pyFTS.hyperparam package"
<a href="pyFTS.distributed.html" title="pyFTS.distributed package"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="pyFTS.common.html" title="pyFTS.common package"
@ -67,6 +67,7 @@
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#module-pyFTS.data.common">pyFTS.data.common module</a></li>
<li><a class="reference internal" href="#datasets">Datasets</a></li>
<li><a class="reference internal" href="#module-pyFTS.data.artificial">Artificial and synthetic data generators</a></li>
<li><a class="reference internal" href="#module-pyFTS.data.AirPassengers">AirPassengers dataset</a></li>
<li><a class="reference internal" href="#module-pyFTS.data.Bitcoin">Bitcoin dataset</a></li>
<li><a class="reference internal" href="#module-pyFTS.data.DowJones">DowJones dataset</a></li>
@ -81,7 +82,6 @@
<li><a class="reference internal" href="#module-pyFTS.data.SONDA">SONDA dataset</a></li>
<li><a class="reference internal" href="#module-pyFTS.data.SP500">S&amp;P 500 dataset</a></li>
<li><a class="reference internal" href="#module-pyFTS.data.TAIEX">TAIEX dataset</a></li>
<li><a class="reference internal" href="#module-pyFTS.data.artificial">pyFTS.data.artificial module</a></li>
<li><a class="reference internal" href="#module-pyFTS.data.henon">Henon chaotic time series</a></li>
<li><a class="reference internal" href="#module-pyFTS.data.logistic_map">Logistic_map chaotic time series</a></li>
<li><a class="reference internal" href="#module-pyFTS.data.lorentz">Lorentz chaotic time series</a></li>
@ -96,8 +96,8 @@
<p class="topless"><a href="pyFTS.common.html"
title="previous chapter">pyFTS.common package</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="pyFTS.hyperparam.html"
title="next chapter">pyFTS.hyperparam package</a></p>
<p class="topless"><a href="pyFTS.distributed.html"
title="next chapter">pyFTS.distributed package</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
@ -165,6 +165,273 @@ If the file dont already exists, it will be downloaded and decompressed.</p>
</div>
<div class="section" id="datasets">
<h2>Datasets<a class="headerlink" href="#datasets" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-pyFTS.data.artificial">
<span id="artificial-and-synthetic-data-generators"></span><h2>Artificial and synthetic data generators<a class="headerlink" href="#module-pyFTS.data.artificial" title="Permalink to this headline"></a></h2>
<p>Facilities to generate synthetic stochastic processes</p>
<dl class="class">
<dt id="pyFTS.data.artificial.SignalEmulator">
<em class="property">class </em><code class="descclassname">pyFTS.data.artificial.</code><code class="descname">SignalEmulator</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#SignalEmulator"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.SignalEmulator" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<p>Emulate a complex signal built from several additive and non-additive components</p>
<dl class="method">
<dt id="pyFTS.data.artificial.SignalEmulator.blip">
<code class="descname">blip</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#SignalEmulator.blip"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.SignalEmulator.blip" title="Permalink to this definition"></a></dt>
<dd><p>Creates an outlier greater than the maximum or lower then the minimum previous values of the signal,
and insert it on a random location of the signal.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">the current SignalEmulator instance, for method chaining</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.data.artificial.SignalEmulator.components">
<code class="descname">components</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.data.artificial.SignalEmulator.components" title="Permalink to this definition"></a></dt>
<dd><p>Components of the signal</p>
</dd></dl>
<dl class="method">
<dt id="pyFTS.data.artificial.SignalEmulator.incremental_gaussian">
<code class="descname">incremental_gaussian</code><span class="sig-paren">(</span><em>mu</em>, <em>sigma</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#SignalEmulator.incremental_gaussian"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.SignalEmulator.incremental_gaussian" title="Permalink to this definition"></a></dt>
<dd><p>Creates an additive gaussian interference on a previous signal</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>mu</strong> increment on mean</li>
<li><strong>sigma</strong> increment on variance</li>
<li><strong>start</strong> lag index to start this signal, the default value is 0</li>
<li><strong>it</strong> Number of iterations, the default value is 1</li>
<li><strong>length</strong> Number of samples generated on each iteration, the default value is 100</li>
<li><strong>vmin</strong> Lower bound value of generated data, the default value is None</li>
<li><strong>vmax</strong> Upper bound value of generated data, the default value is None</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the current SignalEmulator instance, for method chaining</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pyFTS.data.artificial.SignalEmulator.periodic_gaussian">
<code class="descname">periodic_gaussian</code><span class="sig-paren">(</span><em>type</em>, <em>period</em>, <em>mu_min</em>, <em>sigma_min</em>, <em>mu_max</em>, <em>sigma_max</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#SignalEmulator.periodic_gaussian"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.SignalEmulator.periodic_gaussian" title="Permalink to this definition"></a></dt>
<dd><p>Creates an additive periodic gaussian interference on a previous signal</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>type</strong> linear or sinoidal</li>
<li><strong>period</strong> the period of recurrence</li>
<li><strong>mu</strong> increment on mean</li>
<li><strong>sigma</strong> increment on variance</li>
<li><strong>start</strong> lag index to start this signal, the default value is 0</li>
<li><strong>it</strong> Number of iterations, the default value is 1</li>
<li><strong>length</strong> Number of samples generated on each iteration, the default value is 100</li>
<li><strong>vmin</strong> Lower bound value of generated data, the default value is None</li>
<li><strong>vmax</strong> Upper bound value of generated data, the default value is None</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the current SignalEmulator instance, for method chaining</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pyFTS.data.artificial.SignalEmulator.run">
<code class="descname">run</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#SignalEmulator.run"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.SignalEmulator.run" title="Permalink to this definition"></a></dt>
<dd><p>Render the signal</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">a list of float values</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pyFTS.data.artificial.SignalEmulator.stationary_gaussian">
<code class="descname">stationary_gaussian</code><span class="sig-paren">(</span><em>mu</em>, <em>sigma</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#SignalEmulator.stationary_gaussian"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.SignalEmulator.stationary_gaussian" title="Permalink to this definition"></a></dt>
<dd><p>Creates a continuous Gaussian signal with mean mu and variance sigma.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>mu</strong> mean</li>
<li><strong>sigma</strong> variance</li>
<li><strong>additive</strong> If False it cancels the previous signal and start this one, if True
this signal is added to the previous one</li>
<li><strong>start</strong> lag index to start this signal, the default value is 0</li>
<li><strong>it</strong> Number of iterations, the default value is 1</li>
<li><strong>length</strong> Number of samples generated on each iteration, the default value is 100</li>
<li><strong>vmin</strong> Lower bound value of generated data, the default value is None</li>
<li><strong>vmax</strong> Upper bound value of generated data, the default value is None</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">the current SignalEmulator instance, for method chaining</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="pyFTS.data.artificial.generate_gaussian_linear">
<code class="descclassname">pyFTS.data.artificial.</code><code class="descname">generate_gaussian_linear</code><span class="sig-paren">(</span><em>mu_ini</em>, <em>sigma_ini</em>, <em>mu_inc</em>, <em>sigma_inc</em>, <em>it=100</em>, <em>num=10</em>, <em>vmin=None</em>, <em>vmax=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#generate_gaussian_linear"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.generate_gaussian_linear" title="Permalink to this definition"></a></dt>
<dd><p>Generate data sampled from Gaussian distribution, with constant or linear changing parameters</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>mu_ini</strong> Initial mean</li>
<li><strong>sigma_ini</strong> Initial variance</li>
<li><strong>mu_inc</strong> Mean increment after num samples</li>
<li><strong>sigma_inc</strong> Variance increment after num samples</li>
<li><strong>it</strong> Number of iterations</li>
<li><strong>num</strong> Number of samples generated on each iteration</li>
<li><strong>vmin</strong> Lower bound value of generated data</li>
<li><strong>vmax</strong> Upper bound value of generated data</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A list of it*num float values</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pyFTS.data.artificial.generate_linear_periodic_gaussian">
<code class="descclassname">pyFTS.data.artificial.</code><code class="descname">generate_linear_periodic_gaussian</code><span class="sig-paren">(</span><em>period</em>, <em>mu_min</em>, <em>sigma_min</em>, <em>mu_max</em>, <em>sigma_max</em>, <em>it=100</em>, <em>num=10</em>, <em>vmin=None</em>, <em>vmax=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#generate_linear_periodic_gaussian"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.generate_linear_periodic_gaussian" title="Permalink to this definition"></a></dt>
<dd><p>Generates a periodic linear variation on mean and variance</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>period</strong> the period of recurrence</li>
<li><strong>mu_min</strong> initial (and minimum) mean of each period</li>
<li><strong>sigma_min</strong> initial (and minimum) variance of each period</li>
<li><strong>mu_max</strong> final (and maximum) mean of each period</li>
<li><strong>sigma_max</strong> final (and maximum) variance of each period</li>
<li><strong>it</strong> Number of iterations</li>
<li><strong>num</strong> Number of samples generated on each iteration</li>
<li><strong>vmin</strong> Lower bound value of generated data</li>
<li><strong>vmax</strong> Upper bound value of generated data</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A list of it*num float values</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pyFTS.data.artificial.generate_sinoidal_periodic_gaussian">
<code class="descclassname">pyFTS.data.artificial.</code><code class="descname">generate_sinoidal_periodic_gaussian</code><span class="sig-paren">(</span><em>period</em>, <em>mu_min</em>, <em>sigma_min</em>, <em>mu_max</em>, <em>sigma_max</em>, <em>it=100</em>, <em>num=10</em>, <em>vmin=None</em>, <em>vmax=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#generate_sinoidal_periodic_gaussian"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.generate_sinoidal_periodic_gaussian" title="Permalink to this definition"></a></dt>
<dd><p>Generates a periodic sinoidal variation on mean and variance</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>period</strong> the period of recurrence</li>
<li><strong>mu_min</strong> initial (and minimum) mean of each period</li>
<li><strong>sigma_min</strong> initial (and minimum) variance of each period</li>
<li><strong>mu_max</strong> final (and maximum) mean of each period</li>
<li><strong>sigma_max</strong> final (and maximum) variance of each period</li>
<li><strong>it</strong> Number of iterations</li>
<li><strong>num</strong> Number of samples generated on each iteration</li>
<li><strong>vmin</strong> Lower bound value of generated data</li>
<li><strong>vmax</strong> Upper bound value of generated data</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A list of it*num float values</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pyFTS.data.artificial.generate_uniform_linear">
<code class="descclassname">pyFTS.data.artificial.</code><code class="descname">generate_uniform_linear</code><span class="sig-paren">(</span><em>min_ini</em>, <em>max_ini</em>, <em>min_inc</em>, <em>max_inc</em>, <em>it=100</em>, <em>num=10</em>, <em>vmin=None</em>, <em>vmax=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#generate_uniform_linear"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.generate_uniform_linear" title="Permalink to this definition"></a></dt>
<dd><p>Generate data sampled from Uniform distribution, with constant or linear changing bounds</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>mu_ini</strong> Initial mean</li>
<li><strong>sigma_ini</strong> Initial variance</li>
<li><strong>mu_inc</strong> Mean increment after num samples</li>
<li><strong>sigma_inc</strong> Variance increment after num samples</li>
<li><strong>it</strong> Number of iterations</li>
<li><strong>num</strong> Number of samples generated on each iteration</li>
<li><strong>vmin</strong> Lower bound value of generated data</li>
<li><strong>vmax</strong> Upper bound value of generated data</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A list of it*num float values</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pyFTS.data.artificial.random_walk">
<code class="descclassname">pyFTS.data.artificial.</code><code class="descname">random_walk</code><span class="sig-paren">(</span><em>n=500</em>, <em>type='gaussian'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#random_walk"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.random_walk" title="Permalink to this definition"></a></dt>
<dd><p>Simple random walk</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>n</strong> number of samples</li>
<li><strong>type</strong> gaussian or uniform</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pyFTS.data.artificial.white_noise">
<code class="descclassname">pyFTS.data.artificial.</code><code class="descname">white_noise</code><span class="sig-paren">(</span><em>n=500</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#white_noise"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.white_noise" title="Permalink to this definition"></a></dt>
<dd><p>Simple Gaussian noise signal
:param n: number of samples
:return:</p>
</dd></dl>
</div>
<div class="section" id="module-pyFTS.data.AirPassengers">
<span id="airpassengers-dataset"></span><h2>AirPassengers dataset<a class="headerlink" href="#module-pyFTS.data.AirPassengers" title="Permalink to this headline"></a></h2>
@ -628,74 +895,6 @@ If the file dont already exists, it will be downloaded and decompressed.</p>
</table>
</dd></dl>
</div>
<div class="section" id="module-pyFTS.data.artificial">
<span id="pyfts-data-artificial-module"></span><h2>pyFTS.data.artificial module<a class="headerlink" href="#module-pyFTS.data.artificial" title="Permalink to this headline"></a></h2>
<p>Facilities to generate synthetic stochastic processes</p>
<dl class="function">
<dt id="pyFTS.data.artificial.generate_gaussian_linear">
<code class="descclassname">pyFTS.data.artificial.</code><code class="descname">generate_gaussian_linear</code><span class="sig-paren">(</span><em>mu_ini</em>, <em>sigma_ini</em>, <em>mu_inc</em>, <em>sigma_inc</em>, <em>it=100</em>, <em>num=10</em>, <em>vmin=None</em>, <em>vmax=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#generate_gaussian_linear"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.generate_gaussian_linear" title="Permalink to this definition"></a></dt>
<dd><p>Generate data sampled from Gaussian distribution, with constant or linear changing parameters</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>mu_ini</strong> Initial mean</li>
<li><strong>sigma_ini</strong> Initial variance</li>
<li><strong>mu_inc</strong> Mean increment after num samples</li>
<li><strong>sigma_inc</strong> Variance increment after num samples</li>
<li><strong>it</strong> Number of iterations</li>
<li><strong>num</strong> Number of samples generated on each iteration</li>
<li><strong>vmin</strong> Lower bound value of generated data</li>
<li><strong>vmax</strong> Upper bound value of generated data</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A list of it*num float values</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pyFTS.data.artificial.generate_uniform_linear">
<code class="descclassname">pyFTS.data.artificial.</code><code class="descname">generate_uniform_linear</code><span class="sig-paren">(</span><em>min_ini</em>, <em>max_ini</em>, <em>min_inc</em>, <em>max_inc</em>, <em>it=100</em>, <em>num=10</em>, <em>vmin=None</em>, <em>vmax=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#generate_uniform_linear"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.generate_uniform_linear" title="Permalink to this definition"></a></dt>
<dd><p>Generate data sampled from Uniform distribution, with constant or linear changing bounds</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>mu_ini</strong> Initial mean</li>
<li><strong>sigma_ini</strong> Initial variance</li>
<li><strong>mu_inc</strong> Mean increment after num samples</li>
<li><strong>sigma_inc</strong> Variance increment after num samples</li>
<li><strong>it</strong> Number of iterations</li>
<li><strong>num</strong> Number of samples generated on each iteration</li>
<li><strong>vmin</strong> Lower bound value of generated data</li>
<li><strong>vmax</strong> Upper bound value of generated data</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A list of it*num float values</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pyFTS.data.artificial.random_walk">
<code class="descclassname">pyFTS.data.artificial.</code><code class="descname">random_walk</code><span class="sig-paren">(</span><em>n=500</em>, <em>type='gaussian'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#random_walk"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.random_walk" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pyFTS.data.artificial.white_noise">
<code class="descclassname">pyFTS.data.artificial.</code><code class="descname">white_noise</code><span class="sig-paren">(</span><em>n=500</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/artificial.html#white_noise"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.artificial.white_noise" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
<div class="section" id="module-pyFTS.data.henon">
<span id="henon-chaotic-time-series"></span><h2>Henon chaotic time series<a class="headerlink" href="#module-pyFTS.data.henon" title="Permalink to this headline"></a></h2>
@ -955,7 +1154,7 @@ dz/dt = b + z( x - c )</p>
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="pyFTS.hyperparam.html" title="pyFTS.hyperparam package"
<a href="pyFTS.distributed.html" title="pyFTS.distributed package"
>next</a> |</li>
<li class="right" >
<a href="pyFTS.common.html" title="pyFTS.common package"

283
docs/build/html/pyFTS.distributed.html vendored Normal file
View File

@ -0,0 +1,283 @@
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-55120145-3']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<title>pyFTS.distributed package &#8212; pyFTS 1.4 documentation</title>
<link rel="stylesheet" href="_static/bizstyle.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript" src="_static/documentation_options.js"></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="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/bizstyle.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="pyFTS.hyperparam package" href="pyFTS.hyperparam.html" />
<link rel="prev" title="pyFTS.data package" href="pyFTS.data.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!--[if lt IE 9]>
<script type="text/javascript" src="_static/css3-mediaqueries.js"></script>
<![endif]-->
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="pyFTS.hyperparam.html" title="pyFTS.hyperparam package"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="pyFTS.data.html" title="pyFTS.data package"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">pyFTS 1.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="modules.html" >pyFTS</a> &#187;</li>
<li class="nav-item nav-item-2"><a href="pyFTS.html" accesskey="U">pyFTS package</a> &#187;</li>
</ul>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/logo_heading2.png" alt="Logo"/>
</a></p>
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">pyFTS.distributed package</a><ul>
<li><a class="reference internal" href="#module-pyFTS.distributed">Module contents</a></li>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#pyfts-distributed-dispy-module">pyFTS.distributed.dispy module</a></li>
<li><a class="reference internal" href="#module-pyFTS.distributed.spark">pyFTS.distributed.spark module</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="pyFTS.data.html"
title="previous chapter">pyFTS.data package</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="pyFTS.hyperparam.html"
title="next chapter">pyFTS.hyperparam package</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/pyFTS.distributed.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="pyfts-distributed-package">
<h1>pyFTS.distributed package<a class="headerlink" href="#pyfts-distributed-package" title="Permalink to this headline"></a></h1>
<div class="section" id="module-pyFTS.distributed">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-pyFTS.distributed" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="pyfts-distributed-dispy-module">
<h2>pyFTS.distributed.dispy module<a class="headerlink" href="#pyfts-distributed-dispy-module" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="module-pyFTS.distributed.spark">
<span id="pyfts-distributed-spark-module"></span><h2>pyFTS.distributed.spark module<a class="headerlink" href="#module-pyFTS.distributed.spark" title="Permalink to this headline"></a></h2>
<dl class="function">
<dt id="pyFTS.distributed.spark.create_multivariate_model">
<code class="descclassname">pyFTS.distributed.spark.</code><code class="descname">create_multivariate_model</code><span class="sig-paren">(</span><em>**parameters</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/distributed/spark.html#create_multivariate_model"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.distributed.spark.create_multivariate_model" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pyFTS.distributed.spark.create_spark_conf">
<code class="descclassname">pyFTS.distributed.spark.</code><code class="descname">create_spark_conf</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/distributed/spark.html#create_spark_conf"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.distributed.spark.create_spark_conf" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pyFTS.distributed.spark.create_univariate_model">
<code class="descclassname">pyFTS.distributed.spark.</code><code class="descname">create_univariate_model</code><span class="sig-paren">(</span><em>**parameters</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/distributed/spark.html#create_univariate_model"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.distributed.spark.create_univariate_model" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pyFTS.distributed.spark.distributed_predict">
<code class="descclassname">pyFTS.distributed.spark.</code><code class="descname">distributed_predict</code><span class="sig-paren">(</span><em>data</em>, <em>model</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/distributed/spark.html#distributed_predict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.distributed.spark.distributed_predict" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>model</strong> </li>
<li><strong>data</strong> </li>
<li><strong>url</strong> </li>
<li><strong>app</strong> </li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pyFTS.distributed.spark.distributed_train">
<code class="descclassname">pyFTS.distributed.spark.</code><code class="descname">distributed_train</code><span class="sig-paren">(</span><em>model</em>, <em>data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/distributed/spark.html#distributed_train"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.distributed.spark.distributed_train" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>model</strong> </li>
<li><strong>data</strong> </li>
<li><strong>url</strong> </li>
<li><strong>app</strong> </li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pyFTS.distributed.spark.get_clustered_partitioner">
<code class="descclassname">pyFTS.distributed.spark.</code><code class="descname">get_clustered_partitioner</code><span class="sig-paren">(</span><em>explanatory_variables</em>, <em>target_variable</em>, <em>**parameters</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/distributed/spark.html#get_clustered_partitioner"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.distributed.spark.get_clustered_partitioner" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pyFTS.distributed.spark.get_partitioner">
<code class="descclassname">pyFTS.distributed.spark.</code><code class="descname">get_partitioner</code><span class="sig-paren">(</span><em>shared_partitioner</em>, <em>type='common'</em>, <em>variables=[]</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/distributed/spark.html#get_partitioner"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.distributed.spark.get_partitioner" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>part</strong> </td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pyFTS.distributed.spark.get_variables">
<code class="descclassname">pyFTS.distributed.spark.</code><code class="descname">get_variables</code><span class="sig-paren">(</span><em>**parameters</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/distributed/spark.html#get_variables"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.distributed.spark.get_variables" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pyFTS.distributed.spark.share_parameters">
<code class="descclassname">pyFTS.distributed.spark.</code><code class="descname">share_parameters</code><span class="sig-paren">(</span><em>model</em>, <em>context</em>, <em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/distributed/spark.html#share_parameters"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.distributed.spark.share_parameters" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pyFTS.distributed.spark.slave_forecast_multivariate">
<code class="descclassname">pyFTS.distributed.spark.</code><code class="descname">slave_forecast_multivariate</code><span class="sig-paren">(</span><em>data</em>, <em>**parameters</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/distributed/spark.html#slave_forecast_multivariate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.distributed.spark.slave_forecast_multivariate" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pyFTS.distributed.spark.slave_forecast_univariate">
<code class="descclassname">pyFTS.distributed.spark.</code><code class="descname">slave_forecast_univariate</code><span class="sig-paren">(</span><em>data</em>, <em>**parameters</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/distributed/spark.html#slave_forecast_univariate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.distributed.spark.slave_forecast_univariate" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> </td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="pyFTS.distributed.spark.slave_train_multivariate">
<code class="descclassname">pyFTS.distributed.spark.</code><code class="descname">slave_train_multivariate</code><span class="sig-paren">(</span><em>data</em>, <em>**parameters</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/distributed/spark.html#slave_train_multivariate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.distributed.spark.slave_train_multivariate" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="pyFTS.distributed.spark.slave_train_univariate">
<code class="descclassname">pyFTS.distributed.spark.</code><code class="descname">slave_train_univariate</code><span class="sig-paren">(</span><em>data</em>, <em>**parameters</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/distributed/spark.html#slave_train_univariate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.distributed.spark.slave_train_univariate" title="Permalink to this definition"></a></dt>
<dd><table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> </td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="pyFTS.hyperparam.html" title="pyFTS.hyperparam package"
>next</a> |</li>
<li class="right" >
<a href="pyFTS.data.html" title="pyFTS.data package"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">pyFTS 1.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="modules.html" >pyFTS</a> &#187;</li>
<li class="nav-item nav-item-2"><a href="pyFTS.html" >pyFTS package</a> &#187;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2018, Machine Intelligence and Data Science Laboratory - UFMG - Brazil.
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.2.
</div>
</body>
</html>

View File

@ -142,6 +142,7 @@
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.common">pyFTS.data.common module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#datasets">Datasets</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.artificial">Artificial and synthetic data generators</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.AirPassengers">AirPassengers dataset</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.Bitcoin">Bitcoin dataset</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.DowJones">DowJones dataset</a></li>
@ -156,7 +157,6 @@
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.SONDA">SONDA dataset</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.SP500">S&amp;P 500 dataset</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.TAIEX">TAIEX dataset</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.artificial">pyFTS.data.artificial module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.henon">Henon chaotic time series</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.logistic_map">Logistic_map chaotic time series</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.lorentz">Lorentz chaotic time series</a></li>
@ -165,11 +165,19 @@
<li class="toctree-l2"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.sunspots">Sunspots dataset</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="pyFTS.distributed.html">pyFTS.distributed package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.distributed.html#module-pyFTS.distributed">Module contents</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.distributed.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.distributed.html#pyfts-distributed-dispy-module">pyFTS.distributed.dispy module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.distributed.html#module-pyFTS.distributed.spark">pyFTS.distributed.spark module</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="pyFTS.hyperparam.html">pyFTS.hyperparam package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.hyperparam.html#module-pyFTS.hyperparam">Module contents</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.hyperparam.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.hyperparam.html#module-pyFTS.hyperparam.Util">pyFTS.hyperparam.Util module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.hyperparam.html#module-pyFTS.hyperparam.GridSearch">pyFTS.hyperparam.GridSearch module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.hyperparam.html#pyfts-hyperparam-evolutionary-module">pyFTS.hyperparam.Evolutionary module</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="pyFTS.models.html">pyFTS.models package</a><ul>
@ -185,7 +193,8 @@
<li class="toctree-l3"><a class="reference internal" href="pyFTS.models.incremental.html">pyFTS.models.incremental package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.incremental.html#module-pyFTS.models.incremental">Module contents</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.incremental.html#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.incremental.html#pyfts-models-incremental-retrainer-module">pyFTS.models.incremental.Retrainer module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.incremental.html#module-pyFTS.models.incremental.TimeVariant">pyFTS.models.incremental.TimeVariant module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.incremental.html#module-pyFTS.models.incremental.IncrementalEnsemble">pyFTS.models.incremental.IncrementalEnsemble module</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="pyFTS.models.multivariate.html">pyFTS.models.multivariate package</a><ul>

View File

@ -29,7 +29,7 @@
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="next" title="pyFTS.models package" href="pyFTS.models.html" />
<link rel="prev" title="pyFTS.data package" href="pyFTS.data.html" />
<link rel="prev" title="pyFTS.distributed package" href="pyFTS.distributed.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<!--[if lt IE 9]>
<script type="text/javascript" src="_static/css3-mediaqueries.js"></script>
@ -48,7 +48,7 @@
<a href="pyFTS.models.html" title="pyFTS.models package"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="pyFTS.data.html" title="pyFTS.data package"
<a href="pyFTS.distributed.html" title="pyFTS.distributed package"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">pyFTS 1.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="modules.html" >pyFTS</a> &#187;</li>
@ -67,13 +67,14 @@
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#module-pyFTS.hyperparam.Util">pyFTS.hyperparam.Util module</a></li>
<li><a class="reference internal" href="#module-pyFTS.hyperparam.GridSearch">pyFTS.hyperparam.GridSearch module</a></li>
<li><a class="reference internal" href="#pyfts-hyperparam-evolutionary-module">pyFTS.hyperparam.Evolutionary module</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="pyFTS.data.html"
title="previous chapter">pyFTS.data package</a></p>
<p class="topless"><a href="pyFTS.distributed.html"
title="previous chapter">pyFTS.distributed package</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="pyFTS.models.html"
title="next chapter">pyFTS.models package</a></p>
@ -204,6 +205,9 @@ Value: the measure value</p>
<code class="descclassname">pyFTS.hyperparam.GridSearch.</code><code class="descname">process_jobs</code><span class="sig-paren">(</span><em>jobs</em>, <em>datasetname</em>, <em>conn</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/hyperparam/GridSearch.html#process_jobs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.hyperparam.GridSearch.process_jobs" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
<div class="section" id="pyfts-hyperparam-evolutionary-module">
<h2>pyFTS.hyperparam.Evolutionary module<a class="headerlink" href="#pyfts-hyperparam-evolutionary-module" title="Permalink to this headline"></a></h2>
</div>
</div>
@ -226,7 +230,7 @@ Value: the measure value</p>
<a href="pyFTS.models.html" title="pyFTS.models package"
>next</a> |</li>
<li class="right" >
<a href="pyFTS.data.html" title="pyFTS.data package"
<a href="pyFTS.distributed.html" title="pyFTS.distributed package"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">pyFTS 1.4 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="modules.html" >pyFTS</a> &#187;</li>

View File

@ -133,7 +133,8 @@
<li class="toctree-l1"><a class="reference internal" href="pyFTS.models.incremental.html">pyFTS.models.incremental package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.incremental.html#module-pyFTS.models.incremental">Module contents</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.incremental.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.incremental.html#pyfts-models-incremental-retrainer-module">pyFTS.models.incremental.Retrainer module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.incremental.html#module-pyFTS.models.incremental.TimeVariant">pyFTS.models.incremental.TimeVariant module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.incremental.html#module-pyFTS.models.incremental.IncrementalEnsemble">pyFTS.models.incremental.IncrementalEnsemble module</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="pyFTS.models.multivariate.html">pyFTS.models.multivariate package</a><ul>

View File

@ -66,7 +66,8 @@
<li><a class="reference internal" href="#">pyFTS.models.incremental package</a><ul>
<li><a class="reference internal" href="#module-pyFTS.models.incremental">Module contents</a></li>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#pyfts-models-incremental-retrainer-module">pyFTS.models.incremental.Retrainer module</a></li>
<li><a class="reference internal" href="#module-pyFTS.models.incremental.TimeVariant">pyFTS.models.incremental.TimeVariant module</a></li>
<li><a class="reference internal" href="#module-pyFTS.models.incremental.IncrementalEnsemble">pyFTS.models.incremental.IncrementalEnsemble module</a></li>
</ul>
</li>
</ul>
@ -113,29 +114,29 @@
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
<div class="section" id="pyfts-models-incremental-retrainer-module">
<h2>pyFTS.models.incremental.Retrainer module<a class="headerlink" href="#pyfts-models-incremental-retrainer-module" title="Permalink to this headline"></a></h2>
<span class="target" id="module-pyFTS.models.incremental.Retrainer"></span><p>Meta model that wraps another FTS method and continously retrain it using a data window with the most recent data</p>
<div class="section" id="module-pyFTS.models.incremental.TimeVariant">
<span id="pyfts-models-incremental-timevariant-module"></span><h2>pyFTS.models.incremental.TimeVariant module<a class="headerlink" href="#module-pyFTS.models.incremental.TimeVariant" title="Permalink to this headline"></a></h2>
<p>Meta model that wraps another FTS method and continously retrain it using a data window with the most recent data</p>
<dl class="class">
<dt id="pyFTS.models.incremental.Retrainer.Retrainer">
<em class="property">class </em><code class="descclassname">pyFTS.models.incremental.Retrainer.</code><code class="descname">Retrainer</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/incremental/Retrainer.html#Retrainer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.incremental.Retrainer.Retrainer" title="Permalink to this definition"></a></dt>
<dt id="pyFTS.models.incremental.TimeVariant.Retrainer">
<em class="property">class </em><code class="descclassname">pyFTS.models.incremental.TimeVariant.</code><code class="descname">Retrainer</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/incremental/TimeVariant.html#Retrainer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.incremental.TimeVariant.Retrainer" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="pyFTS.common.html#pyFTS.common.fts.FTS" title="pyFTS.common.fts.FTS"><code class="xref py py-class docutils literal notranslate"><span class="pre">pyFTS.common.fts.FTS</span></code></a></p>
<p>Meta model for incremental/online learning</p>
<dl class="attribute">
<dt id="pyFTS.models.incremental.Retrainer.Retrainer.auto_update">
<code class="descname">auto_update</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.Retrainer.Retrainer.auto_update" title="Permalink to this definition"></a></dt>
<dt id="pyFTS.models.incremental.TimeVariant.Retrainer.auto_update">
<code class="descname">auto_update</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.TimeVariant.Retrainer.auto_update" title="Permalink to this definition"></a></dt>
<dd><p>If true the model is updated at each time and not recreated</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.incremental.Retrainer.Retrainer.batch_size">
<code class="descname">batch_size</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.Retrainer.Retrainer.batch_size" title="Permalink to this definition"></a></dt>
<dt id="pyFTS.models.incremental.TimeVariant.Retrainer.batch_size">
<code class="descname">batch_size</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.TimeVariant.Retrainer.batch_size" title="Permalink to this definition"></a></dt>
<dd><p>The batch interval between each retraining</p>
</dd></dl>
<dl class="method">
<dt id="pyFTS.models.incremental.Retrainer.Retrainer.forecast">
<code class="descname">forecast</code><span class="sig-paren">(</span><em>data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/incremental/Retrainer.html#Retrainer.forecast"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.incremental.Retrainer.Retrainer.forecast" title="Permalink to this definition"></a></dt>
<dt id="pyFTS.models.incremental.TimeVariant.Retrainer.forecast">
<code class="descname">forecast</code><span class="sig-paren">(</span><em>data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/incremental/TimeVariant.html#Retrainer.forecast"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.incremental.TimeVariant.Retrainer.forecast" title="Permalink to this definition"></a></dt>
<dd><p>Point forecast one step ahead</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@ -155,44 +156,44 @@
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.incremental.Retrainer.Retrainer.fts_method">
<code class="descname">fts_method</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.Retrainer.Retrainer.fts_method" title="Permalink to this definition"></a></dt>
<dt id="pyFTS.models.incremental.TimeVariant.Retrainer.fts_method">
<code class="descname">fts_method</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.TimeVariant.Retrainer.fts_method" title="Permalink to this definition"></a></dt>
<dd><p>The FTS method to be called when a new model is build</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.incremental.Retrainer.Retrainer.fts_params">
<code class="descname">fts_params</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.Retrainer.Retrainer.fts_params" title="Permalink to this definition"></a></dt>
<dt id="pyFTS.models.incremental.TimeVariant.Retrainer.fts_params">
<code class="descname">fts_params</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.TimeVariant.Retrainer.fts_params" title="Permalink to this definition"></a></dt>
<dd><p>The FTS method specific parameters</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.incremental.Retrainer.Retrainer.model">
<code class="descname">model</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.Retrainer.Retrainer.model" title="Permalink to this definition"></a></dt>
<dt id="pyFTS.models.incremental.TimeVariant.Retrainer.model">
<code class="descname">model</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.TimeVariant.Retrainer.model" title="Permalink to this definition"></a></dt>
<dd><p>The most recent trained model</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.incremental.Retrainer.Retrainer.partitioner">
<code class="descname">partitioner</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.Retrainer.Retrainer.partitioner" title="Permalink to this definition"></a></dt>
<dt id="pyFTS.models.incremental.TimeVariant.Retrainer.partitioner">
<code class="descname">partitioner</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.TimeVariant.Retrainer.partitioner" title="Permalink to this definition"></a></dt>
<dd><p>The most recent trained partitioner</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.incremental.Retrainer.Retrainer.partitioner_method">
<code class="descname">partitioner_method</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.Retrainer.Retrainer.partitioner_method" title="Permalink to this definition"></a></dt>
<dt id="pyFTS.models.incremental.TimeVariant.Retrainer.partitioner_method">
<code class="descname">partitioner_method</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.TimeVariant.Retrainer.partitioner_method" title="Permalink to this definition"></a></dt>
<dd><p>The partitioner method to be called when a new model is build</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.incremental.Retrainer.Retrainer.partitioner_params">
<code class="descname">partitioner_params</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.Retrainer.Retrainer.partitioner_params" title="Permalink to this definition"></a></dt>
<dt id="pyFTS.models.incremental.TimeVariant.Retrainer.partitioner_params">
<code class="descname">partitioner_params</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.TimeVariant.Retrainer.partitioner_params" title="Permalink to this definition"></a></dt>
<dd><p>The partitioner method parameters</p>
</dd></dl>
<dl class="method">
<dt id="pyFTS.models.incremental.Retrainer.Retrainer.train">
<code class="descname">train</code><span class="sig-paren">(</span><em>data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/incremental/Retrainer.html#Retrainer.train"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.incremental.Retrainer.Retrainer.train" title="Permalink to this definition"></a></dt>
<dt id="pyFTS.models.incremental.TimeVariant.Retrainer.train">
<code class="descname">train</code><span class="sig-paren">(</span><em>data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/incremental/TimeVariant.html#Retrainer.train"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.incremental.TimeVariant.Retrainer.train" title="Permalink to this definition"></a></dt>
<dd><p>Method specific parameter fitting</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
@ -209,8 +210,94 @@
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.incremental.Retrainer.Retrainer.window_length">
<code class="descname">window_length</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.Retrainer.Retrainer.window_length" title="Permalink to this definition"></a></dt>
<dt id="pyFTS.models.incremental.TimeVariant.Retrainer.window_length">
<code class="descname">window_length</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.TimeVariant.Retrainer.window_length" title="Permalink to this definition"></a></dt>
<dd><p>The memory window length</p>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-pyFTS.models.incremental.IncrementalEnsemble">
<span id="pyfts-models-incremental-incrementalensemble-module"></span><h2>pyFTS.models.incremental.IncrementalEnsemble module<a class="headerlink" href="#module-pyFTS.models.incremental.IncrementalEnsemble" title="Permalink to this headline"></a></h2>
<p>Time Variant/Incremental Ensemble of FTS methods</p>
<dl class="class">
<dt id="pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS">
<em class="property">class </em><code class="descclassname">pyFTS.models.incremental.IncrementalEnsemble.</code><code class="descname">IncrementalEnsembleFTS</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/incremental/IncrementalEnsemble.html#IncrementalEnsembleFTS"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.EnsembleFTS" title="pyFTS.models.ensemble.ensemble.EnsembleFTS"><code class="xref py py-class docutils literal notranslate"><span class="pre">pyFTS.models.ensemble.ensemble.EnsembleFTS</span></code></a></p>
<p>Time Variant/Incremental Ensemble of FTS methods</p>
<dl class="attribute">
<dt id="pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.batch_size">
<code class="descname">batch_size</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.batch_size" title="Permalink to this definition"></a></dt>
<dd><p>The batch interval between each retraining</p>
</dd></dl>
<dl class="method">
<dt id="pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.forecast">
<code class="descname">forecast</code><span class="sig-paren">(</span><em>data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/incremental/IncrementalEnsemble.html#IncrementalEnsembleFTS.forecast"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.forecast" title="Permalink to this definition"></a></dt>
<dd><p>Point forecast one step ahead</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>data</strong> time series data with the minimal length equal to the max_lag of the model</li>
<li><strong>kwargs</strong> model specific parameters</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">a list with the forecasted values</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.fts_method">
<code class="descname">fts_method</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.fts_method" title="Permalink to this definition"></a></dt>
<dd><p>The FTS method to be called when a new model is build</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.fts_params">
<code class="descname">fts_params</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.fts_params" title="Permalink to this definition"></a></dt>
<dd><p>The FTS method specific parameters</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.partitioner_method">
<code class="descname">partitioner_method</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.partitioner_method" title="Permalink to this definition"></a></dt>
<dd><p>The partitioner method to be called when a new model is build</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.partitioner_params">
<code class="descname">partitioner_params</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.partitioner_params" title="Permalink to this definition"></a></dt>
<dd><p>The partitioner method parameters</p>
</dd></dl>
<dl class="method">
<dt id="pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.train">
<code class="descname">train</code><span class="sig-paren">(</span><em>data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/incremental/IncrementalEnsemble.html#IncrementalEnsembleFTS.train"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.train" title="Permalink to this definition"></a></dt>
<dd><p>Method specific parameter fitting</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>data</strong> training time series data</li>
<li><strong>kwargs</strong> Method specific parameters</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.window_length">
<code class="descname">window_length</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS.window_length" title="Permalink to this definition"></a></dt>
<dd><p>The memory window length</p>
</dd></dl>

View File

@ -189,7 +189,7 @@
<dl class="function">
<dt id="pyFTS.models.multivariate.common.fuzzyfy_instance">
<code class="descclassname">pyFTS.models.multivariate.common.</code><code class="descname">fuzzyfy_instance</code><span class="sig-paren">(</span><em>data_point</em>, <em>var</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/common.html#fuzzyfy_instance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.common.fuzzyfy_instance" title="Permalink to this definition"></a></dt>
<code class="descclassname">pyFTS.models.multivariate.common.</code><code class="descname">fuzzyfy_instance</code><span class="sig-paren">(</span><em>data_point</em>, <em>var</em>, <em>tuples=True</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/common.html#fuzzyfy_instance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.common.fuzzyfy_instance" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="function">
@ -212,6 +212,12 @@ transformations and partitioners.</p>
<dd><p>A string with the alias of the variable</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.multivariate.variable.Variable.alpha_cut">
<code class="descname">alpha_cut</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.multivariate.variable.Variable.alpha_cut" title="Permalink to this definition"></a></dt>
<dd><p>Minimal membership value to be considered on fuzzyfication process</p>
</dd></dl>
<dl class="method">
<dt id="pyFTS.models.multivariate.variable.Variable.apply_inverse_transformations">
<code class="descname">apply_inverse_transformations</code><span class="sig-paren">(</span><em>data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/variable.html#Variable.apply_inverse_transformations"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.variable.Variable.apply_inverse_transformations" title="Permalink to this definition"></a></dt>
@ -261,6 +267,18 @@ transformations and partitioners.</p>
<dd><p>A string with the name of the variable</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.multivariate.variable.Variable.partitioner">
<code class="descname">partitioner</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.multivariate.variable.Variable.partitioner" title="Permalink to this definition"></a></dt>
<dd><p>UoD partitioner for the variable data</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.multivariate.variable.Variable.transformation">
<code class="descname">transformation</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.multivariate.variable.Variable.transformation" title="Permalink to this definition"></a></dt>
<dd><p>Pre processing transformation for the variable</p>
</dd></dl>
</dd></dl>
</div>
@ -448,6 +466,14 @@ transformations and partitioners.</p>
</dd></dl>
<dl class="function">
<dt id="pyFTS.models.multivariate.mvfts.product_dict">
<code class="descclassname">pyFTS.models.multivariate.mvfts.</code><code class="descname">product_dict</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/mvfts.html#product_dict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.mvfts.product_dict" title="Permalink to this definition"></a></dt>
<dd><p>Code by Seth Johnson
:param kwargs:
:return:</p>
</dd></dl>
</div>
<div class="section" id="module-pyFTS.models.multivariate.wmvfts">
<span id="pyfts-models-multivariate-wmvfts-module"></span><h2>pyFTS.models.multivariate.wmvfts module<a class="headerlink" href="#module-pyFTS.models.multivariate.wmvfts" title="Permalink to this headline"></a></h2>

View File

@ -359,7 +359,7 @@
<dt id="pyFTS.models.seasonal.common.DateTime">
<em class="property">class </em><code class="descclassname">pyFTS.models.seasonal.common.</code><code class="descname">DateTime</code><a class="reference internal" href="_modules/pyFTS/models/seasonal/common.html#DateTime"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/enum.html#enum.Enum" title="(in Python v3.7)"><code class="xref py py-class docutils literal notranslate"><span class="pre">enum.Enum</span></code></a></p>
<p>An enumeration.</p>
<p>Data and Time granularity for time granularity and seasonality identification</p>
<dl class="attribute">
<dt id="pyFTS.models.seasonal.common.DateTime.day_of_month">
<code class="descname">day_of_month</code><em class="property"> = 30</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.day_of_month" title="Permalink to this definition"></a></dt>
@ -376,8 +376,8 @@
<dd></dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.seasonal.common.DateTime.hour">
<code class="descname">hour</code><em class="property"> = 6</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.hour" title="Permalink to this definition"></a></dt>
<dt id="pyFTS.models.seasonal.common.DateTime.half">
<code class="descname">half</code><em class="property"> = 2</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.half" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
@ -430,6 +430,11 @@
<code class="descname">month</code><em class="property"> = 12</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.month" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.seasonal.common.DateTime.quarter">
<code class="descname">quarter</code><em class="property"> = 4</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.quarter" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.seasonal.common.DateTime.second">
<code class="descname">second</code><em class="property"> = 8</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.second" title="Permalink to this definition"></a></dt>
@ -450,6 +455,16 @@
<code class="descname">second_of_minute</code><em class="property"> = 60.00001</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.second_of_minute" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.seasonal.common.DateTime.sixth">
<code class="descname">sixth</code><em class="property"> = 6</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.sixth" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.seasonal.common.DateTime.third">
<code class="descname">third</code><em class="property"> = 3</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.third" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.seasonal.common.DateTime.year">
<code class="descname">year</code><em class="property"> = 1</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.year" title="Permalink to this definition"></a></dt>
@ -482,7 +497,7 @@
<dl class="function">
<dt id="pyFTS.models.seasonal.common.strip_datepart">
<code class="descclassname">pyFTS.models.seasonal.common.</code><code class="descname">strip_datepart</code><span class="sig-paren">(</span><em>date</em>, <em>date_part</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/seasonal/common.html#strip_datepart"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.seasonal.common.strip_datepart" title="Permalink to this definition"></a></dt>
<code class="descclassname">pyFTS.models.seasonal.common.</code><code class="descname">strip_datepart</code><span class="sig-paren">(</span><em>date</em>, <em>date_part</em>, <em>mask=''</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/seasonal/common.html#strip_datepart"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.seasonal.common.strip_datepart" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</div>
@ -585,6 +600,12 @@
</table>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.seasonal.partitioner.TimeGridPartitioner.mask">
<code class="descname">mask</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.mask" title="Permalink to this definition"></a></dt>
<dd><p>A string with datetime formating mask</p>
</dd></dl>
<dl class="method">
<dt id="pyFTS.models.seasonal.partitioner.TimeGridPartitioner.plot">
<code class="descname">plot</code><span class="sig-paren">(</span><em>ax</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/seasonal/partitioner.html#TimeGridPartitioner.plot"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.plot" title="Permalink to this definition"></a></dt>
@ -593,6 +614,12 @@
:return:</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.seasonal.partitioner.TimeGridPartitioner.season">
<code class="descname">season</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.season" title="Permalink to this definition"></a></dt>
<dd><p>Seasonality, a pyFTS.models.seasonal.common.DateTime object</p>
</dd></dl>
</dd></dl>
</div>

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,6 @@ pyFTS
=====
.. toctree::
:maxdepth: 4
:maxdepth: 5
pyFTS

View File

@ -29,6 +29,14 @@ pyFTS.data.common module
Datasets
--------
Artificial and synthetic data generators
----------------------------------------
.. automodule:: pyFTS.data.artificial
:members:
:undoc-members:
:show-inheritance:
AirPassengers dataset
-------------------------------
@ -143,14 +151,6 @@ TAIEX dataset
:undoc-members:
:show-inheritance:
pyFTS.data.artificial module
----------------------------
.. automodule:: pyFTS.data.artificial
:members:
:undoc-members:
:show-inheritance:
Henon chaotic time series
-------------------------

View File

@ -0,0 +1,32 @@
pyFTS.distributed package
=========================
Module contents
---------------
.. automodule:: pyFTS.distributed
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
pyFTS.distributed.dispy module
------------------------------
.. automodule:: pyFTS.distributed.dispy
:members:
:undoc-members:
:show-inheritance:
pyFTS.distributed.spark module
----------------------------------
.. automodule:: pyFTS.distributed.spark
:members:
:undoc-members:
:show-inheritance:

View File

@ -28,4 +28,12 @@ pyFTS.hyperparam.GridSearch module
:undoc-members:
:show-inheritance:
pyFTS.hyperparam.Evolutionary module
------------------------------------
.. automodule:: pyFTS.hyperparam.Evolutionary
:members:
:undoc-members:
:show-inheritance:

View File

@ -1,5 +1,5 @@
pyFTS.models.incremental package
=============================
================================
Module contents
---------------
@ -13,10 +13,19 @@ Module contents
Submodules
----------
pyFTS.models.incremental.Retrainer module
-------------------------------------
pyFTS.models.incremental.TimeVariant module
-------------------------------------------
.. automodule:: pyFTS.models.incremental.Retrainer
.. automodule:: pyFTS.models.incremental.TimeVariant
:members:
:undoc-members:
:show-inheritance:
pyFTS.models.incremental.IncrementalEnsemble module
---------------------------------------------------
.. automodule:: pyFTS.models.incremental.IncrementalEnsemble
:members:
:undoc-members:
:show-inheritance:

View File

@ -9,6 +9,7 @@ Subpackages
pyFTS.benchmarks
pyFTS.common
pyFTS.data
pyFTS.distributed
pyFTS.hyperparam
pyFTS.models
pyFTS.partitioners

View File

@ -5,6 +5,148 @@ Facilities to generate synthetic stochastic processes
import numpy as np
class SignalEmulator(object):
"""
Emulate a complex signal built from several additive and non-additive components
"""
def __init__(self, **kwargs):
super(SignalEmulator, self).__init__()
self.components = []
"""Components of the signal"""
def stationary_gaussian(self, mu, sigma, **kwargs):
"""
Creates a continuous Gaussian signal with mean mu and variance sigma.
:param mu: mean
:param sigma: variance
:keyword additive: If False it cancels the previous signal and start this one, if True
this signal is added to the previous one
:keyword start: lag index to start this signal, the default value is 0
:keyword it: Number of iterations, the default value is 1
:keyword length: Number of samples generated on each iteration, the default value is 100
:keyword vmin: Lower bound value of generated data, the default value is None
:keyword vmax: Upper bound value of generated data, the default value is None
:return: the current SignalEmulator instance, for method chaining
"""
parameters = {'mu': mu, 'sigma': sigma}
self.components.append({'dist': 'gaussian', 'type': 'constant',
'parameters': parameters, 'args': kwargs})
return self
def incremental_gaussian(self, mu, sigma, **kwargs):
"""
Creates an additive gaussian interference on a previous signal
:param mu: increment on mean
:param sigma: increment on variance
:keyword start: lag index to start this signal, the default value is 0
:keyword it: Number of iterations, the default value is 1
:keyword length: Number of samples generated on each iteration, the default value is 100
:keyword vmin: Lower bound value of generated data, the default value is None
:keyword vmax: Upper bound value of generated data, the default value is None
:return: the current SignalEmulator instance, for method chaining
"""
parameters = {'mu': mu, 'sigma': sigma}
self.components.append({'dist': 'gaussian', 'type': 'incremental',
'parameters': parameters, 'args': kwargs})
return self
def periodic_gaussian(self, type, period, mu_min, sigma_min, mu_max, sigma_max, **kwargs):
"""
Creates an additive periodic gaussian interference on a previous signal
:param type: 'linear' or 'sinoidal'
:param period: the period of recurrence
:param mu: increment on mean
:param sigma: increment on variance
:keyword start: lag index to start this signal, the default value is 0
:keyword it: Number of iterations, the default value is 1
:keyword length: Number of samples generated on each iteration, the default value is 100
:keyword vmin: Lower bound value of generated data, the default value is None
:keyword vmax: Upper bound value of generated data, the default value is None
:return: the current SignalEmulator instance, for method chaining
"""
parameters = {'type':type, 'period':period,
'mu_min': mu_min, 'sigma_min': sigma_min, 'mu_max': mu_max, 'sigma_max': sigma_max}
self.components.append({'dist': 'gaussian', 'type': 'periodic',
'parameters': parameters, 'args': kwargs})
return self
def blip(self, **kwargs):
"""
Creates an outlier greater than the maximum or lower then the minimum previous values of the signal,
and insert it on a random location of the signal.
:return: the current SignalEmulator instance, for method chaining
"""
parameters = {}
self.components.append({'dist': 'blip', 'type': 'blip',
'parameters': parameters, 'args':kwargs})
return self
def run(self):
"""
Render the signal
:return: a list of float values
"""
signal = []
last_it = 10
last_num = 10
for ct, component in enumerate(self.components):
parameters = component['parameters']
kwargs = component['args']
additive = kwargs.get('additive', True)
start = kwargs.get('start', 0)
it = kwargs.get('it', last_it)
num = kwargs.get('length', last_num)
vmin = kwargs.get('vmin',None)
vmax = kwargs.get('vmax', None)
if component['type'] == 'constant':
tmp = generate_gaussian_linear(parameters['mu'], parameters['sigma'], 0, 0,
it=it, num=num, vmin=vmin, vmax=vmax)
elif component['type'] == 'incremental':
tmp = generate_gaussian_linear(0, 0, parameters['mu'], parameters['sigma'],
it=num, num=1, vmin=vmin, vmax=vmax)
elif component['type'] == 'periodic':
period = parameters['period']
mu_min, sigma_min = parameters['mu_min'],parameters['sigma_min']
mu_max, sigma_max = parameters['mu_max'],parameters['sigma_max']
if parameters['type'] == 'sinoidal':
tmp = generate_sinoidal_periodic_gaussian(period, mu_min, sigma_min, mu_max, sigma_max,
it=num, num=1, vmin=vmin, vmax=vmax)
else:
tmp = generate_linear_periodic_gaussian(period, mu_min, sigma_min, mu_max, sigma_max,
it=num, num=1, vmin=vmin, vmax=vmax)
elif component['type'] == 'blip':
_mx = np.nanmax(signal)
_mn = np.nanmin(signal)
_mx += 2*_mx if _mx > 0 else -2*_mx
_mn += -2*_mn if _mn > 0 else 2*_mn
if vmax is not None:
_mx = min(_mx, vmax) if vmax > 0 else max(_mx, vmax)
if vmin is not None:
_mn = max(_mn, vmin) if vmin > 0 else min(_mn, vmin)
start = np.random.randint(0, len(signal))
tmp = [_mx] if np.random.rand() >= .5 else [-_mn]
last_num = num
last_it = it
signal = _append(additive, start, signal, tmp)
return signal
def generate_gaussian_linear(mu_ini, sigma_ini, mu_inc, sigma_inc, it=100, num=10, vmin=None, vmax=None):
"""
Generate data sampled from Gaussian distribution, with constant or linear changing parameters
@ -157,6 +299,7 @@ def white_noise(n=500):
def random_walk(n=500, type='gaussian'):
"""
Simple random walk
:param n: number of samples
:param type: 'gaussian' or 'uniform'
:return:
@ -195,139 +338,3 @@ def _append(additive, start, before, new):
return tmp.tolist()
class SignalEmulator(object):
"""
Emulate a complex signal built from several additive and non-additive components
"""
def __init__(self, **kwargs):
super(SignalEmulator, self).__init__()
self.components = []
def stationary_gaussian(self, mu, sigma, **kwargs):
"""
Creates a continuous Gaussian signal with mean mu and variance sigma.
:param mu: mean
:param sigma: variance
:keyword additive: If False it cancels the previous signal and start this one, if True
this signal is added to the previous one
:keyword start: lag index to start this signal, the default value is 0
:keyword it: Number of iterations, the default value is 1
:keyword length: Number of samples generated on each iteration, the default value is 100
:keyword vmin: Lower bound value of generated data, the default value is None
:keyword vmax: Upper bound value of generated data, the default value is None
:return: the current SignalEmulator instance, for method chaining
"""
parameters = {'mu': mu, 'sigma': sigma}
self.components.append({'dist': 'gaussian', 'type': 'constant',
'parameters': parameters, 'args': kwargs})
return self
def incremental_gaussian(self, mu, sigma, **kwargs):
"""
Creates an additive gaussian interference on a previous signal
:param mu: increment on mean
:param sigma: increment on variance
:keyword start: lag index to start this signal, the default value is 0
:keyword it: Number of iterations, the default value is 1
:keyword length: Number of samples generated on each iteration, the default value is 100
:keyword vmin: Lower bound value of generated data, the default value is None
:keyword vmax: Upper bound value of generated data, the default value is None
:return: the current SignalEmulator instance, for method chaining
"""
parameters = {'mu': mu, 'sigma': sigma}
self.components.append({'dist': 'gaussian', 'type': 'incremental',
'parameters': parameters, 'args': kwargs})
return self
def periodic_gaussian(self, type, period, mu_min, sigma_min, mu_max, sigma_max, **kwargs):
"""
Creates an additive periodic gaussian interference on a previous signal
:param type: 'linear' or 'sinoidal'
:param period: the period of recurrence
:param mu: increment on mean
:param sigma: increment on variance
:keyword start: lag index to start this signal, the default value is 0
:keyword it: Number of iterations, the default value is 1
:keyword length: Number of samples generated on each iteration, the default value is 100
:keyword vmin: Lower bound value of generated data, the default value is None
:keyword vmax: Upper bound value of generated data, the default value is None
:return: the current SignalEmulator instance, for method chaining
"""
parameters = {'type':type, 'period':period,
'mu_min': mu_min, 'sigma_min': sigma_min, 'mu_max': mu_max, 'sigma_max': sigma_max}
self.components.append({'dist': 'gaussian', 'type': 'periodic',
'parameters': parameters, 'args': kwargs})
return self
def blip(self, **kwargs):
"""
Creates an outlier greater than the maximum or lower then the minimum previous values of the signal,
and insert it on a random location of the signal.
:return: the current SignalEmulator instance, for method chaining
"""
parameters = {}
self.components.append({'dist': 'blip', 'type': 'blip',
'parameters': parameters, 'args':kwargs})
return self
def run(self):
"""
Render the signal
:return: a list of float values
"""
signal = []
last_it = 10
last_num = 10
for ct, component in enumerate(self.components):
parameters = component['parameters']
kwargs = component['args']
additive = kwargs.get('additive', True)
start = kwargs.get('start', 0)
it = kwargs.get('it', last_it)
num = kwargs.get('length', last_num)
vmin = kwargs.get('vmin',None)
vmax = kwargs.get('vmax', None)
if component['type'] == 'constant':
tmp = generate_gaussian_linear(parameters['mu'], parameters['sigma'], 0, 0,
it=it, num=num, vmin=vmin, vmax=vmax)
elif component['type'] == 'incremental':
tmp = generate_gaussian_linear(0, 0, parameters['mu'], parameters['sigma'],
it=num, num=1, vmin=vmin, vmax=vmax)
elif component['type'] == 'periodic':
period = parameters['period']
mu_min, sigma_min = parameters['mu_min'],parameters['sigma_min']
mu_max, sigma_max = parameters['mu_max'],parameters['sigma_max']
if parameters['type'] == 'sinoidal':
tmp = generate_sinoidal_periodic_gaussian(period, mu_min, sigma_min, mu_max, sigma_max,
it=num, num=1, vmin=vmin, vmax=vmax)
else:
tmp = generate_linear_periodic_gaussian(period, mu_min, sigma_min, mu_max, sigma_max,
it=num, num=1, vmin=vmin, vmax=vmax)
elif component['type'] == 'blip':
_mx = np.nanmax(signal)
_mn = np.nanmin(signal)
_mx += 2*_mx if _mx > 0 else -2*_mx
_mn += -2*_mn if _mn > 0 else 2*_mn
if vmax is not None:
_mx = min(_mx, vmax) if vmax > 0 else max(_mx, vmax)
if vmin is not None:
_mn = max(_mn, vmin) if vmin > 0 else min(_mn, vmin)
start = np.random.randint(0, len(signal))
tmp = [_mx] if np.random.rand() >= .5 else [-_mn]
last_num = num
last_it = it
signal = _append(additive, start, signal, tmp)
return signal