Incremental module

This commit is contained in:
Petrônio Cândido 2018-11-01 11:11:20 -03:00
parent f8927fd158
commit 5c85a9b218
35 changed files with 741 additions and 46 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -117,6 +117,7 @@
<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/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/common.html">pyFTS.models.multivariate.common</a></li>

View File

@ -72,8 +72,14 @@
<div class="body" role="main">
<h1>Source code for pyFTS.models.ensemble.ensemble</h1><div class="highlight"><pre>
<span></span><span class="ch">#!/usr/bin/python</span>
<span class="c1"># -*- coding: utf8 -*-</span>
<span></span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">EnsembleFTS wraps several FTS methods to ensemble their forecasts, providing point,</span>
<span class="sd">interval and probabilistic forecasting.</span>
<span class="sd">Silva, P. C. L et al. Probabilistic Forecasting with Seasonal Ensemble Fuzzy Time-Series</span>
<span class="sd">XIII Brazilian Congress on Computational Intelligence, 2017. Rio de Janeiro, Brazil.</span>
<span class="sd">&quot;&quot;&quot;</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>
@ -96,7 +102,7 @@
<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">EnsembleFTS</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;Ensemble FTS&quot;</span>
<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">has_point_forecasting</span> <span class="o">=</span> <span class="kc">True</span>
@ -108,13 +114,16 @@
<span class="bp">self</span><span class="o">.</span><span class="n">parameters</span> <span class="o">=</span> <span class="p">[]</span>
<span class="sd">&quot;&quot;&quot;A list with the parameters for each component model&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">alpha</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;alpha&quot;</span><span class="p">,</span> <span class="mf">0.05</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;The quantiles &quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">point_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;point_method&#39;</span><span class="p">,</span> <span class="s1">&#39;mean&#39;</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;The method used to mix the several model&#39;s forecasts into a unique point forecast. Options: mean, median, quantile&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">interval_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;interval_method&#39;</span><span class="p">,</span> <span class="s1">&#39;quantile&#39;</span><span class="p">)</span>
<span class="sd">&quot;&quot;&quot;The method used to mix the several model&#39;s forecasts into a interval forecast. Options: quantile, extremum, normal&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">order</span> <span class="o">=</span> <span class="mi">1</span>
<div class="viewcode-block" id="EnsembleFTS.append_model"><a class="viewcode-back" href="../../../../pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.EnsembleFTS.append_model">[docs]</a> <span class="k">def</span> <span class="nf">append_model</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">model</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Append a new model to the ensemble</span>
<span class="sd"> Append a new trained model to the ensemble</span>
<span class="sd"> :param model: FTS model</span>
@ -341,6 +350,9 @@
<div class="viewcode-block" id="AllMethodEnsembleFTS"><a class="viewcode-back" href="../../../../pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.AllMethodEnsembleFTS">[docs]</a><span class="k">class</span> <span class="nc">AllMethodEnsembleFTS</span><span class="p">(</span><span class="n">EnsembleFTS</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Creates an EnsembleFTS with all point forecast methods, sharing the same partitioner</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">AllMethodEnsembleFTS</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">min_order</span> <span class="o">=</span> <span class="mi">3</span>

View File

@ -72,8 +72,10 @@
<div class="body" role="main">
<h1>Source code for pyFTS.models.ensemble.multiseasonal</h1><div class="highlight"><pre>
<span></span><span class="ch">#!/usr/bin/python</span>
<span class="c1"># -*- coding: utf8 -*-</span>
<span></span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Silva, P. C. L et al. Probabilistic Forecasting with Seasonal Ensemble Fuzzy Time-Series</span>
<span class="sd">XIII Brazilian Congress on Computational Intelligence, 2017. Rio de Janeiro, Brazil.</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">pyFTS.common</span> <span class="k">import</span> <span class="n">Util</span> <span class="k">as</span> <span class="n">cUtil</span>

View File

@ -0,0 +1,173 @@
<!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.Retrainer &#8212; pyFTS 1.2.3 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.2.3 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.Retrainer</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>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</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>
<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>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Meta model for incremental/online learning</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">Retrainer</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">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">partitioner</span> <span class="o">=</span> <span class="kc">None</span>
<span class="sd">&quot;&quot;&quot;The most recent trained partitioner&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="kc">None</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">model</span> <span class="o">=</span> <span class="kc">None</span>
<span class="sd">&quot;&quot;&quot;The most recent trained model&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">auto_update</span> <span class="o">=</span> <span class="kc">False</span>
<span class="sd">&quot;&quot;&quot;If true the model is updated at each time and not recreated&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>
<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>
<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="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="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></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>
<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>
<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="n">horizon</span><span class="p">,</span> <span class="n">l</span><span class="p">):</span>
<span class="n">_train</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="n">horizon</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">_test</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="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">auto_update</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="n">train</span><span class="p">(</span><span class="n">_train</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">train</span><span class="p">(</span><span class="n">_train</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="n">extend</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="n">predict</span><span class="p">(</span><span class="n">_test</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">ret</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="sd">&quot;&quot;&quot;String representation of the model&quot;&quot;&quot;</span>
<span class="k">return</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</span>
<span class="k">def</span> <span class="nf">__len__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> The length (number of rules) of the model</span>
<span class="sd"> :return: number of rules</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="nb">len</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="p">)</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.2.3 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

@ -77,7 +77,8 @@
<span class="kn">from</span> <span class="nn">pyFTS.common</span> <span class="k">import</span> <span class="n">FuzzySet</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="k">return</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></div>
<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>

View File

@ -162,12 +162,17 @@
<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="n">datepart</span><span class="p">,</span> <span class="n">name</span><span class="p">,</span> <span class="n">mf</span><span class="p">,</span> <span class="n">parameters</span><span class="p">,</span> <span class="n">centroid</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mf">1.0</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">FuzzySet</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="p">,</span> <span class="n">mf</span><span class="p">,</span> <span class="n">parameters</span><span class="p">,</span> <span class="n">centroid</span><span class="p">,</span> <span class="n">alpha</span><span class="p">,</span> <span class="nb">type</span> <span class="o">=</span> <span class="s1">&#39;datetime&#39;</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">FuzzySet</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="p">,</span> <span class="n">mf</span><span class="p">,</span> <span class="n">parameters</span><span class="p">,</span> <span class="n">centroid</span><span class="p">,</span> <span class="n">alpha</span><span class="p">,</span>
<span class="nb">type</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;type&#39;</span><span class="p">,</span> <span class="s1">&#39;datetime&#39;</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">datepart</span> <span class="o">=</span> <span class="n">datepart</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>
<div class="viewcode-block" id="FuzzySet.membership"><a class="viewcode-back" href="../../../../pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.FuzzySet.membership">[docs]</a> <span class="k">def</span> <span class="nf">membership</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">x</span><span class="p">):</span>
<span class="n">dp</span> <span class="o">=</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">datepart</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;datetime&#39;</span><span class="p">:</span>
<span class="n">dp</span> <span class="o">=</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">datepart</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">dp</span> <span class="o">=</span> <span class="n">x</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">mf</span><span class="p">(</span><span class="n">dp</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span> <span class="o">*</span> <span class="bp">self</span><span class="o">.</span><span class="n">alpha</span></div></div>
</pre></div>

View File

@ -138,6 +138,17 @@
<span class="o">**</span><span class="n">kwargs</span><span class="p">))</span>
<span class="n">tmp</span><span class="o">.</span><span class="n">centroid</span> <span class="o">=</span> <span class="n">c</span>
<span class="n">sets</span><span class="p">[</span><span class="n">set_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">tmp</span>
<span class="k">elif</span> <span class="n">c</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="n">partlen</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="n">Composite</span><span class="p">(</span><span class="n">set_name</span><span class="p">,</span> <span class="n">superset</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
<span class="n">tmp</span><span class="o">.</span><span class="n">append_set</span><span class="p">(</span><span class="n">FuzzySet</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="n">set_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="mf">0.0000001</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">,</span>
<span class="n">pl2</span><span class="p">],</span> <span class="mf">0.0</span><span class="p">,</span> <span class="n">alpha</span><span class="o">=.</span><span class="mi">5</span><span class="p">,</span>
<span class="o">**</span><span class="n">kwargs</span><span class="p">))</span>
<span class="n">tmp</span><span class="o">.</span><span class="n">append_set</span><span class="p">(</span><span class="n">FuzzySet</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="n">set_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">c</span> <span class="o">-</span> <span class="n">partlen</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">c</span> <span class="o">+</span> <span class="n">partlen</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="n">tmp</span><span class="o">.</span><span class="n">centroid</span> <span class="o">=</span> <span class="n">c</span>
<span class="n">sets</span><span class="p">[</span><span class="n">set_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">tmp</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">sets</span><span class="p">[</span><span class="n">set_name</span><span class="p">]</span> <span class="o">=</span> <span class="n">FuzzySet</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="n">set_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">c</span> <span class="o">-</span> <span class="n">partlen</span><span class="p">,</span> <span class="n">c</span><span class="p">,</span> <span class="n">c</span> <span class="o">+</span> <span class="n">partlen</span><span class="p">],</span> <span class="n">c</span><span class="p">,</span>

View File

@ -164,7 +164,15 @@
<span class="n">ret</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">percentile</span><span class="p">(</span><span class="n">mp</span><span class="p">,</span> <span class="mi">50</span><span class="p">))</span>
<span class="k">return</span> <span class="n">ret</span></div></div>
<span class="k">return</span> <span class="n">ret</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="sd">&quot;&quot;&quot;String representation of the model&quot;&quot;&quot;</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">+</span> <span class="s2">&quot;:</span><span class="se">\n</span><span class="s2">&quot;</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="n">tmp</span> <span class="o">+</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="o">+</span> <span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span>
<span class="k">return</span> <span class="n">tmp</span></div>
</pre></div>
</div>

View File

@ -116,7 +116,7 @@
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> <span class="o">&lt;</span> <span class="mi">2</span><span class="p">:</span>
<span class="k">return</span> <span class="kc">None</span>
<span class="n">count</span> <span class="o">=</span> <span class="mi">1</span>
<span class="n">ndata</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">data</span><span class="p">))</span>
<span class="n">ndata</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">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">data</span><span class="p">)</span><span class="o">.</span><span class="n">flatten</span><span class="p">()))</span>
<span class="n">ndata</span><span class="o">.</span><span class="n">sort</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="n">threshold</span> <span class="o">=</span> <span class="mi">0</span>

View File

@ -128,7 +128,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">min</span> <span class="o">=</span> <span class="nb">float</span><span class="p">(</span><span class="n">_min</span> <span class="o">*</span> <span class="mf">1.1</span> <span class="k">if</span> <span class="n">_min</span> <span class="o">&lt;</span> <span class="mi">0</span> <span class="k">else</span> <span class="n">_min</span> <span class="o">*</span> <span class="mf">0.9</span><span class="p">)</span>
<span class="n">_max</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">ndata</span><span class="p">)</span>
<span class="n">_max</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">ndata</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="nb">float</span><span class="p">(</span><span class="n">_max</span> <span class="o">*</span> <span class="mf">1.1</span> <span class="k">if</span> <span class="n">_max</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">else</span> <span class="n">_max</span> <span class="o">*</span> <span class="mf">0.9</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">build</span><span class="p">(</span><span class="n">ndata</span><span class="p">)</span>

View File

@ -256,7 +256,8 @@
<div class="viewcode-block" id="ProbabilityDistribution.cumulative"><a class="viewcode-back" href="../../../pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.cumulative">[docs]</a> <span class="k">def</span> <span class="nf">cumulative</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">values</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Return the cumulative probability densities for the input values</span>
<span class="sd"> Return the cumulative probability densities for the input values, </span>
<span class="sd"> such that F(x) = P(X &lt;= x)</span>
<span class="sd"> :param values: A list of input values</span>
<span class="sd"> :return: The cumulative probability densities for the input values</span>
@ -275,7 +276,8 @@
<div class="viewcode-block" id="ProbabilityDistribution.quantile"><a class="viewcode-back" href="../../../pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.quantile">[docs]</a> <span class="k">def</span> <span class="nf">quantile</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">values</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Return the quantile values for the input values</span>
<span class="sd"> Return the Universe of Discourse values in relation to the quantile input values, </span>
<span class="sd"> such that Q(tau) = min( {x | F(x) &gt;= tau })</span>
<span class="sd"> :param values: input values</span>
<span class="sd"> :return: The list of the quantile values for the input values</span>
@ -296,7 +298,7 @@
<div class="viewcode-block" id="ProbabilityDistribution.entropy"><a class="viewcode-back" href="../../../pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.entropy">[docs]</a> <span class="k">def</span> <span class="nf">entropy</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Return the entropy of the probability distribution, H[X] =</span>
<span class="sd"> Return the entropy of the probability distribution, H(P) = E[ -ln P(X) ] = - ∑ P(x) log ( P(x) )</span>
<span class="sd"> :return:the entropy of the probability distribution</span>
<span class="sd"> &quot;&quot;&quot;</span>
@ -306,7 +308,8 @@
<div class="viewcode-block" id="ProbabilityDistribution.crossentropy"><a class="viewcode-back" href="../../../pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.crossentropy">[docs]</a> <span class="k">def</span> <span class="nf">crossentropy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">q</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Cross entropy between the actual probability distribution and the informed one.</span>
<span class="sd"> Cross entropy between the actual probability distribution and the informed one, </span>
<span class="sd"> H(P,Q) = - ∑ P(x) log ( Q(x) )</span>
<span class="sd"> :param q: a probabilistic.ProbabilityDistribution object</span>
<span class="sd"> :return: Cross entropy between this probability distribution and the given distribution</span>
@ -318,6 +321,7 @@
<div class="viewcode-block" id="ProbabilityDistribution.kullbackleiblerdivergence"><a class="viewcode-back" href="../../../pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.kullbackleiblerdivergence">[docs]</a> <span class="k">def</span> <span class="nf">kullbackleiblerdivergence</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">q</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Kullback-Leibler divergence between the actual probability distribution and the informed one.</span>
<span class="sd"> DKL(P || Q) = - ∑ P(x) log( P(X) / Q(x) )</span>
<span class="sd"> :param q: a probabilistic.ProbabilityDistribution object</span>
<span class="sd"> :return: Kullback-Leibler divergence</span>
@ -328,7 +332,7 @@
<div class="viewcode-block" id="ProbabilityDistribution.empiricalloglikelihood"><a class="viewcode-back" href="../../../pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.empiricalloglikelihood">[docs]</a> <span class="k">def</span> <span class="nf">empiricalloglikelihood</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Empirical Log Likelihood of the probability distribution</span>
<span class="sd"> Empirical Log Likelihood of the probability distribution, L(P) = ∑ log( P(x) )</span>
<span class="sd"> :return:</span>
<span class="sd"> &quot;&quot;&quot;</span>

View File

@ -0,0 +1,24 @@
pyFTS.models.incremental package
=============================
Module contents
---------------
.. automodule:: pyFTS.models.incremental
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
pyFTS.models.incremental.Retrainer module
-------------------------------------
.. automodule:: pyFTS.models.incremental.Retrainer
:members:
:undoc-members:
:show-inheritance:

View File

@ -16,6 +16,7 @@ Subpackages
.. toctree::
pyFTS.models.ensemble
pyFTS.models.incremental
pyFTS.models.multivariate
pyFTS.models.nonstationary
pyFTS.models.seasonal

View File

@ -117,7 +117,11 @@
<li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.AllMethodEnsembleFTS">AllMethodEnsembleFTS (class in pyFTS.models.ensemble.ensemble)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.FuzzySet.FuzzySet.alpha">alpha (pyFTS.common.FuzzySet.FuzzySet attribute)</a>
<ul>
<li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.EnsembleFTS.alpha">(pyFTS.models.ensemble.ensemble.EnsembleFTS attribute)</a>
</li>
</ul></li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.alpha_cut">alpha_cut (pyFTS.common.fts.FTS attribute)</a>
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Util.analytic_tabular_dataframe">analytic_tabular_dataframe() (in module pyFTS.benchmarks.Util)</a>
@ -213,7 +217,11 @@
<li><a href="pyFTS.common.html#pyFTS.common.SortedCollection.SortedCollection.around">around() (pyFTS.common.SortedCollection.SortedCollection method)</a>
</li>
<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>
</ul></li>
<li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.averageloglikelihood">averageloglikelihood() (pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution method)</a>
</li>
</ul></td>
@ -508,6 +516,8 @@
<li><a href="pyFTS.models.html#pyFTS.models.hofts.HighOrderFTS.forecast">(pyFTS.models.hofts.HighOrderFTS method)</a>
</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>
<li><a href="pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFTS.forecast">(pyFTS.models.ismailefendi.ImprovedWeightedFTS method)</a>
</li>
@ -609,6 +619,10 @@
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.format_data">format_data() (pyFTS.models.multivariate.mvfts.MVFTS method)</a>
</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>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.fts_params">fts_params (pyFTS.models.incremental.Retrainer.Retrainer attribute)</a>
</li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.common.fuzzify">fuzzify() (in module pyFTS.models.nonstationary.common)</a>
</li>
@ -1037,6 +1051,8 @@
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Util.interval_dataframe_synthetic_columns">interval_dataframe_synthetic_columns() (in module pyFTS.benchmarks.Util)</a>
</li>
<li><a href="pyFTS.models.html#pyFTS.models.pwfts.ProbabilisticWeightedFTS.interval_heuristic">interval_heuristic() (pyFTS.models.pwfts.ProbabilisticWeightedFTS method)</a>
</li>
<li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.EnsembleFTS.interval_method">interval_method (pyFTS.models.ensemble.ensemble.EnsembleFTS attribute)</a>
</li>
<li><a href="pyFTS.models.html#pyFTS.models.pwfts.ProbabilisticWeightedFTS.interval_quantile">interval_quantile() (pyFTS.models.pwfts.ProbabilisticWeightedFTS method)</a>
</li>
@ -1163,6 +1179,8 @@
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.minute_of_week">minute_of_week (pyFTS.models.seasonal.common.DateTime attribute)</a>
</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>
<li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.EnsembleFTS.models">models (pyFTS.models.ensemble.ensemble.EnsembleFTS attribute)</a>
</li>
@ -1251,6 +1269,14 @@
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner">Partitioner (class in pyFTS.partitioners.partitioner)</a>
</li>
<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>
</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>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.Retrainer.Retrainer.partitioner_params">partitioner_params (pyFTS.models.incremental.Retrainer.Retrainer attribute)</a>
</li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.partitions">partitions (pyFTS.partitioners.partitioner.Partitioner attribute)</a>
</li>
@ -1339,6 +1365,8 @@
<li><a href="pyFTS.models.html#pyFTS.models.pwfts.ProbabilisticWeightedFTS.point_expected_value">point_expected_value() (pyFTS.models.pwfts.ProbabilisticWeightedFTS method)</a>
</li>
<li><a href="pyFTS.models.html#pyFTS.models.pwfts.ProbabilisticWeightedFTS.point_heuristic">point_heuristic() (pyFTS.models.pwfts.ProbabilisticWeightedFTS method)</a>
</li>
<li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.EnsembleFTS.point_method">point_method (pyFTS.models.ensemble.ensemble.EnsembleFTS attribute)</a>
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.quantreg.QuantileRegression.point_to_interval">point_to_interval() (pyFTS.benchmarks.quantreg.QuantileRegression method)</a>
</li>
@ -1397,11 +1425,11 @@
<li><a href="pyFTS.benchmarks.html#module-pyFTS.benchmarks.quantreg">pyFTS.benchmarks.quantreg (module)</a>
</li>
<li><a href="pyFTS.benchmarks.html#module-pyFTS.benchmarks.ResidualAnalysis">pyFTS.benchmarks.ResidualAnalysis (module)</a>
</li>
<li><a href="pyFTS.benchmarks.html#module-pyFTS.benchmarks.Util">pyFTS.benchmarks.Util (module)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<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>
@ -1487,6 +1515,10 @@
<li><a href="pyFTS.models.html#module-pyFTS.models.hwang">pyFTS.models.hwang (module)</a>
</li>
<li><a href="pyFTS.models.html#module-pyFTS.models.ifts">pyFTS.models.ifts (module)</a>
</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>
<li><a href="pyFTS.models.html#module-pyFTS.models.ismailefendi">pyFTS.models.ismailefendi (module)</a>
</li>
@ -1593,6 +1625,8 @@
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.ResidualAnalysis.residuals">residuals() (in module pyFTS.benchmarks.ResidualAnalysis)</a>
</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>
<li><a href="pyFTS.common.html#pyFTS.common.FLR.FLR.RHS">RHS (pyFTS.common.FLR.FLR attribute)</a>
@ -1600,10 +1634,10 @@
<li><a href="pyFTS.common.html#pyFTS.common.flrg.FLRG.RHS">(pyFTS.common.flrg.FLRG attribute)</a>
</li>
</ul></li>
<li><a href="pyFTS.models.html#pyFTS.models.pwfts.ProbabilisticWeightedFLRG.rhs_conditional_probability">rhs_conditional_probability() (pyFTS.models.pwfts.ProbabilisticWeightedFLRG method)</a>
</li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.models.html#pyFTS.models.pwfts.ProbabilisticWeightedFLRG.rhs_conditional_probability">rhs_conditional_probability() (pyFTS.models.pwfts.ProbabilisticWeightedFLRG method)</a>
</li>
<li><a href="pyFTS.models.html#pyFTS.models.pwfts.ProbabilisticWeightedFLRG.rhs_unconditional_probability">rhs_unconditional_probability() (pyFTS.models.pwfts.ProbabilisticWeightedFLRG method)</a>
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.rmse">rmse() (in module pyFTS.benchmarks.Measures)</a>
@ -1764,6 +1798,8 @@
<li><a href="pyFTS.models.html#pyFTS.models.hofts.HighOrderFTS.train">(pyFTS.models.hofts.HighOrderFTS method)</a>
</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>
<li><a href="pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFTS.train">(pyFTS.models.ismailefendi.ImprovedWeightedFTS method)</a>
</li>
@ -1891,6 +1927,8 @@
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.common.FuzzySet.width_params">width_params (pyFTS.models.nonstationary.common.FuzzySet attribute)</a>
</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>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.winkler_mean">winkler_mean() (in module pyFTS.benchmarks.Measures)</a>
</li>

Binary file not shown.

View File

@ -350,6 +350,16 @@
<td>&#160;&#160;&#160;
<a href="pyFTS.models.html#module-pyFTS.models.ifts"><code class="xref">pyFTS.models.ifts</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"><code class="xref">pyFTS.models.incremental</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.Retrainer"><code class="xref">pyFTS.models.incremental.Retrainer</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;

View File

@ -174,6 +174,12 @@
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.ensemble.html#module-pyFTS.models.ensemble">Module contents</a></li>
</ul>
</li>
<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>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="pyFTS.models.multivariate.html">pyFTS.models.multivariate package</a><ul>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#submodules">Submodules</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.FLR">pyFTS.models.multivariate.FLR module</a></li>

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.models.multivariate package" href="pyFTS.models.multivariate.html" />
<link rel="next" title="pyFTS.models.incremental package" href="pyFTS.models.incremental.html" />
<link rel="prev" title="pyFTS.models package" href="pyFTS.models.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.models.multivariate.html" title="pyFTS.models.multivariate package"
<a href="pyFTS.models.incremental.html" title="pyFTS.models.incremental package"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="pyFTS.models.html" title="pyFTS.models package"
@ -76,8 +76,8 @@
<p class="topless"><a href="pyFTS.models.html"
title="previous chapter">pyFTS.models package</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="pyFTS.models.multivariate.html"
title="next chapter">pyFTS.models.multivariate package</a></p>
<p class="topless"><a href="pyFTS.models.incremental.html"
title="next chapter">pyFTS.models.incremental package</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
@ -112,10 +112,15 @@
</div>
<div class="section" id="module-pyFTS.models.ensemble.ensemble">
<span id="pyfts-models-ensemble-ensemble-module"></span><h2>pyFTS.models.ensemble.ensemble module<a class="headerlink" href="#module-pyFTS.models.ensemble.ensemble" title="Permalink to this headline"></a></h2>
<p>EnsembleFTS wraps several FTS methods to ensemble their forecasts, providing point,
interval and probabilistic forecasting.</p>
<p>Silva, P. C. L et al. Probabilistic Forecasting with Seasonal Ensemble Fuzzy Time-Series
XIII Brazilian Congress on Computational Intelligence, 2017. Rio de Janeiro, Brazil.</p>
<dl class="class">
<dt id="pyFTS.models.ensemble.ensemble.AllMethodEnsembleFTS">
<em class="property">class </em><code class="descclassname">pyFTS.models.ensemble.ensemble.</code><code class="descname">AllMethodEnsembleFTS</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/ensemble/ensemble.html#AllMethodEnsembleFTS"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.ensemble.ensemble.AllMethodEnsembleFTS" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#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>Creates an EnsembleFTS with all point forecast methods, sharing the same partitioner</p>
<dl class="method">
<dt id="pyFTS.models.ensemble.ensemble.AllMethodEnsembleFTS.set_transformations">
<code class="descname">set_transformations</code><span class="sig-paren">(</span><em>model</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/ensemble/ensemble.html#AllMethodEnsembleFTS.set_transformations"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.ensemble.ensemble.AllMethodEnsembleFTS.set_transformations" title="Permalink to this definition"></a></dt>
@ -146,10 +151,16 @@
<em class="property">class </em><code class="descclassname">pyFTS.models.ensemble.ensemble.</code><code class="descname">EnsembleFTS</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/ensemble/ensemble.html#EnsembleFTS"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.ensemble.ensemble.EnsembleFTS" 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>Ensemble FTS</p>
<dl class="attribute">
<dt id="pyFTS.models.ensemble.ensemble.EnsembleFTS.alpha">
<code class="descname">alpha</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.ensemble.ensemble.EnsembleFTS.alpha" title="Permalink to this definition"></a></dt>
<dd><p>The quantiles</p>
</dd></dl>
<dl class="method">
<dt id="pyFTS.models.ensemble.ensemble.EnsembleFTS.append_model">
<code class="descname">append_model</code><span class="sig-paren">(</span><em>model</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/ensemble/ensemble.html#EnsembleFTS.append_model"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.ensemble.ensemble.EnsembleFTS.append_model" title="Permalink to this definition"></a></dt>
<dd><p>Append a new model to the ensemble</p>
<dd><p>Append a new trained model to the ensemble</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
@ -287,6 +298,12 @@
<code class="descname">get_point</code><span class="sig-paren">(</span><em>forecasts</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/ensemble/ensemble.html#EnsembleFTS.get_point"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.ensemble.ensemble.EnsembleFTS.get_point" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.ensemble.ensemble.EnsembleFTS.interval_method">
<code class="descname">interval_method</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.ensemble.ensemble.EnsembleFTS.interval_method" title="Permalink to this definition"></a></dt>
<dd><p>The method used to mix the several models forecasts into a interval forecast. Options: quantile, extremum, normal</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.ensemble.ensemble.EnsembleFTS.models">
<code class="descname">models</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.ensemble.ensemble.EnsembleFTS.models" title="Permalink to this definition"></a></dt>
@ -299,6 +316,12 @@
<dd><p>A list with the parameters for each component model</p>
</dd></dl>
<dl class="attribute">
<dt id="pyFTS.models.ensemble.ensemble.EnsembleFTS.point_method">
<code class="descname">point_method</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.ensemble.ensemble.EnsembleFTS.point_method" title="Permalink to this definition"></a></dt>
<dd><p>The method used to mix the several models forecasts into a unique point forecast. Options: mean, median, quantile</p>
</dd></dl>
<dl class="method">
<dt id="pyFTS.models.ensemble.ensemble.EnsembleFTS.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/ensemble/ensemble.html#EnsembleFTS.train"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.ensemble.ensemble.EnsembleFTS.train" title="Permalink to this definition"></a></dt>
@ -327,6 +350,8 @@
</div>
<div class="section" id="module-pyFTS.models.ensemble.multiseasonal">
<span id="pyfts-models-ensemble-multiseasonal-module"></span><h2>pyFTS.models.ensemble.multiseasonal module<a class="headerlink" href="#module-pyFTS.models.ensemble.multiseasonal" title="Permalink to this headline"></a></h2>
<p>Silva, P. C. L et al. Probabilistic Forecasting with Seasonal Ensemble Fuzzy Time-Series
XIII Brazilian Congress on Computational Intelligence, 2017. Rio de Janeiro, Brazil.</p>
<dl class="class">
<dt id="pyFTS.models.ensemble.multiseasonal.SeasonalEnsembleFTS">
<em class="property">class </em><code class="descclassname">pyFTS.models.ensemble.multiseasonal.</code><code class="descname">SeasonalEnsembleFTS</code><span class="sig-paren">(</span><em>name</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/ensemble/multiseasonal.html#SeasonalEnsembleFTS"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.ensemble.multiseasonal.SeasonalEnsembleFTS" title="Permalink to this definition"></a></dt>
@ -405,7 +430,7 @@
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="pyFTS.models.multivariate.html" title="pyFTS.models.multivariate package"
<a href="pyFTS.models.incremental.html" title="pyFTS.models.incremental package"
>next</a> |</li>
<li class="right" >
<a href="pyFTS.models.html" title="pyFTS.models package"

View File

@ -130,6 +130,12 @@
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.ensemble.html#module-pyFTS.models.ensemble">Module contents</a></li>
</ul>
</li>
<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>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="pyFTS.models.multivariate.html">pyFTS.models.multivariate package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.FLR">pyFTS.models.multivariate.FLR module</a></li>

View File

@ -0,0 +1,248 @@
<!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 package &#8212; pyFTS 1.2.3 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.models.multivariate package" href="pyFTS.models.multivariate.html" />
<link rel="prev" title="pyFTS.models.ensemble package" href="pyFTS.models.ensemble.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.models.multivariate.html" title="pyFTS.models.multivariate package"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="pyFTS.models.ensemble.html" title="pyFTS.models.ensemble package"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">pyFTS 1.2.3 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>
<li class="nav-item nav-item-3"><a href="pyFTS.models.html" accesskey="U">pyFTS.models 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.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>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="pyFTS.models.ensemble.html"
title="previous chapter">pyFTS.models.ensemble package</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="pyFTS.models.multivariate.html"
title="next chapter">pyFTS.models.multivariate package</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/pyFTS.models.incremental.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-models-incremental-package">
<h1>pyFTS.models.incremental package<a class="headerlink" href="#pyfts-models-incremental-package" title="Permalink to this headline"></a></h1>
<div class="section" id="module-pyFTS.models.incremental">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-pyFTS.models.incremental" title="Permalink to this headline"></a></h2>
<p>FTS methods with incremental/online learning</p>
</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-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>
<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>
<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>
<dd><p>If true the model is updated at each time and not recreated</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>
<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.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>
<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>
<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>
<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>
<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>
<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>
<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>
<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.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>
<dd><p>The memory window length</p>
</dd></dl>
</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.models.multivariate.html" title="pyFTS.models.multivariate package"
>next</a> |</li>
<li class="right" >
<a href="pyFTS.models.ensemble.html" title="pyFTS.models.ensemble package"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">pyFTS 1.2.3 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>
<li class="nav-item nav-item-3"><a href="pyFTS.models.html" >pyFTS.models 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

@ -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.nonstationary package" href="pyFTS.models.nonstationary.html" />
<link rel="prev" title="pyFTS.models.ensemble package" href="pyFTS.models.ensemble.html" />
<link rel="prev" title="pyFTS.models.incremental package" href="pyFTS.models.incremental.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.nonstationary.html" title="pyFTS.models.nonstationary package"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="pyFTS.models.ensemble.html" title="pyFTS.models.ensemble package"
<a href="pyFTS.models.incremental.html" title="pyFTS.models.incremental package"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">pyFTS 1.2.3 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="modules.html" >pyFTS</a> &#187;</li>
@ -76,8 +76,8 @@
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="pyFTS.models.ensemble.html"
title="previous chapter">pyFTS.models.ensemble package</a></p>
<p class="topless"><a href="pyFTS.models.incremental.html"
title="previous chapter">pyFTS.models.incremental package</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="pyFTS.models.nonstationary.html"
title="next chapter">pyFTS.models.nonstationary package</a></p>
@ -383,7 +383,7 @@ transformations and partitioners.</p>
<a href="pyFTS.models.nonstationary.html" title="pyFTS.models.nonstationary package"
>next</a> |</li>
<li class="right" >
<a href="pyFTS.models.ensemble.html" title="pyFTS.models.ensemble package"
<a href="pyFTS.models.incremental.html" title="pyFTS.models.incremental package"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">pyFTS 1.2.3 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="modules.html" >pyFTS</a> &#187;</li>

View File

@ -173,7 +173,8 @@ If type is KDE the PDF is continuous</p>
<dl class="method">
<dt id="pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.crossentropy">
<code class="descname">crossentropy</code><span class="sig-paren">(</span><em>q</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/probabilistic/ProbabilityDistribution.html#ProbabilityDistribution.crossentropy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.crossentropy" title="Permalink to this definition"></a></dt>
<dd><p>Cross entropy between the actual probability distribution and the informed one.</p>
<dd><p>Cross entropy between the actual probability distribution and the informed one,
H(P,Q) = - ∑ P(x) log ( Q(x) )</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
@ -189,7 +190,8 @@ If type is KDE the PDF is continuous</p>
<dl class="method">
<dt id="pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.cumulative">
<code class="descname">cumulative</code><span class="sig-paren">(</span><em>values</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/probabilistic/ProbabilityDistribution.html#ProbabilityDistribution.cumulative"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.cumulative" title="Permalink to this definition"></a></dt>
<dd><p>Return the cumulative probability densities for the input values</p>
<dd><p>Return the cumulative probability densities for the input values,
such that F(x) = P(X &lt;= x)</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
@ -237,7 +239,7 @@ If type is KDE the PDF is continuous</p>
<dl class="method">
<dt id="pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.empiricalloglikelihood">
<code class="descname">empiricalloglikelihood</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/probabilistic/ProbabilityDistribution.html#ProbabilityDistribution.empiricalloglikelihood"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.empiricalloglikelihood" title="Permalink to this definition"></a></dt>
<dd><p>Empirical Log Likelihood of the probability distribution</p>
<dd><p>Empirical Log Likelihood of the probability distribution, L(P) = ∑ log( P(x) )</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
@ -251,7 +253,7 @@ If type is KDE the PDF is continuous</p>
<dl class="method">
<dt id="pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.entropy">
<code class="descname">entropy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/probabilistic/ProbabilityDistribution.html#ProbabilityDistribution.entropy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.entropy" title="Permalink to this definition"></a></dt>
<dd><p>Return the entropy of the probability distribution, H[X] =</p>
<dd><p>Return the entropy of the probability distribution, H(P) = E[ -ln P(X) ] = - ∑ P(x) log ( P(x) )</p>
<p>:return:the entropy of the probability distribution</p>
</dd></dl>
@ -272,7 +274,8 @@ If type is KDE the PDF is continuous</p>
<dl class="method">
<dt id="pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.kullbackleiblerdivergence">
<code class="descname">kullbackleiblerdivergence</code><span class="sig-paren">(</span><em>q</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/probabilistic/ProbabilityDistribution.html#ProbabilityDistribution.kullbackleiblerdivergence"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.kullbackleiblerdivergence" title="Permalink to this definition"></a></dt>
<dd><p>Kullback-Leibler divergence between the actual probability distribution and the informed one.</p>
<dd><p>Kullback-Leibler divergence between the actual probability distribution and the informed one.
DKL(P || Q) = - ∑ P(x) log( P(X) / Q(x) )</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
@ -315,7 +318,8 @@ If type is KDE the PDF is continuous</p>
<dl class="method">
<dt id="pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.quantile">
<code class="descname">quantile</code><span class="sig-paren">(</span><em>values</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/probabilistic/ProbabilityDistribution.html#ProbabilityDistribution.quantile"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.quantile" title="Permalink to this definition"></a></dt>
<dd><p>Return the quantile values for the input values</p>
<dd><p>Return the Universe of Discourse values in relation to the quantile input values,
such that Q(tau) = min( {x | F(x) &gt;= tau })</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,24 @@
pyFTS.models.incremental package
=============================
Module contents
---------------
.. automodule:: pyFTS.models.incremental
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
pyFTS.models.incremental.Retrainer module
-------------------------------------
.. automodule:: pyFTS.models.incremental.Retrainer
:members:
:undoc-members:
:show-inheritance:

View File

@ -16,6 +16,7 @@ Subpackages
.. toctree::
pyFTS.models.ensemble
pyFTS.models.incremental
pyFTS.models.multivariate
pyFTS.models.nonstationary
pyFTS.models.seasonal

View File

@ -1,5 +1,11 @@
#!/usr/bin/python
# -*- coding: utf8 -*-
"""
EnsembleFTS wraps several FTS methods to ensemble their forecasts, providing point,
interval and probabilistic forecasting.
Silva, P. C. L et al. Probabilistic Forecasting with Seasonal Ensemble Fuzzy Time-Series
XIII Brazilian Congress on Computational Intelligence, 2017. Rio de Janeiro, Brazil.
"""
import numpy as np
import pandas as pd
@ -22,7 +28,7 @@ class EnsembleFTS(fts.FTS):
"""
def __init__(self, **kwargs):
super(EnsembleFTS, self).__init__(**kwargs)
self.shortname = "Ensemble FTS"
self.shortname = "EnsembleFTS"
self.name = "Ensemble FTS"
self.flrgs = {}
self.has_point_forecasting = True
@ -34,13 +40,16 @@ class EnsembleFTS(fts.FTS):
self.parameters = []
"""A list with the parameters for each component model"""
self.alpha = kwargs.get("alpha", 0.05)
"""The quantiles """
self.point_method = kwargs.get('point_method', 'mean')
"""The method used to mix the several model's forecasts into a unique point forecast. Options: mean, median, quantile"""
self.interval_method = kwargs.get('interval_method', 'quantile')
"""The method used to mix the several model's forecasts into a interval forecast. Options: quantile, extremum, normal"""
self.order = 1
def append_model(self, model):
"""
Append a new model to the ensemble
Append a new trained model to the ensemble
:param model: FTS model
@ -267,6 +276,9 @@ class EnsembleFTS(fts.FTS):
class AllMethodEnsembleFTS(EnsembleFTS):
"""
Creates an EnsembleFTS with all point forecast methods, sharing the same partitioner
"""
def __init__(self, **kwargs):
super(AllMethodEnsembleFTS, self).__init__(**kwargs)
self.min_order = 3

View File

@ -1,5 +1,7 @@
#!/usr/bin/python
# -*- coding: utf8 -*-
"""
Silva, P. C. L et al. Probabilistic Forecasting with Seasonal Ensemble Fuzzy Time-Series
XIII Brazilian Congress on Computational Intelligence, 2017. Rio de Janeiro, Brazil.
"""
import numpy as np
from pyFTS.common import Util as cUtil

View File

@ -0,0 +1,73 @@
"""
Meta model that wraps another FTS method and continously retrain it using a data window with the most recent data
"""
import numpy as np
from pyFTS.common import FuzzySet, FLR, fts, flrg
from pyFTS.partitioners import Grid
class Retrainer(fts.FTS):
"""
Meta model for incremental/online learning
"""
def __init__(self, **kwargs):
super(Retrainer, self).__init__(**kwargs)
self.partitioner_method = kwargs.get('partitioner_method', Grid.GridPartitioner)
"""The partitioner method to be called when a new model is build"""
self.partitioner_params = kwargs.get('partitioner_params', {'npart': 10})
"""The partitioner method parameters"""
self.partitioner = None
"""The most recent trained partitioner"""
self.fts_method = kwargs.get('fts_method', None)
"""The FTS method to be called when a new model is build"""
self.fts_params = kwargs.get('fts_params', {})
"""The FTS method specific parameters"""
self.model = None
"""The most recent trained model"""
self.window_length = kwargs.get('window_length',100)
"""The memory window length"""
self.auto_update = False
"""If true the model is updated at each time and not recreated"""
self.is_high_order = True
def train(self, data, **kwargs):
self.partitioner = self.partitioner_method(data=data, **self.partitioner_params)
self.model = self.fts_method(partitioner=self.partitioner, order=self.order, **self.fts_params)
self.model.fit(data, **kwargs)
def forecast(self, data, **kwargs):
l = len(data)
horizon = self.window_length + self.order
ret = []
for k in np.arange(horizon, l):
_train = data[k - horizon: k - self.order]
_test = data[k - self.order: k]
if self.auto_update:
self.model.train(_train)
else:
self.train(_train, **kwargs)
ret.extend(self.model.predict(_test, **kwargs))
return ret
def __str__(self):
"""String representation of the model"""
return str(self.model)
def __len__(self):
"""
The length (number of rules) of the model
:return: number of rules
"""
return len(self.model)

View File

@ -0,0 +1,3 @@
"""
FTS methods with incremental/online learning
"""

View File

@ -4,7 +4,8 @@ setup(
name='pyFTS',
packages=['pyFTS', 'pyFTS.benchmarks', 'pyFTS.common', 'pyFTS.data', 'pyFTS.models.ensemble',
'pyFTS.models', 'pyFTS.models.seasonal', 'pyFTS.partitioners', 'pyFTS.probabilistic',
'pyFTS.tests', 'pyFTS.models.nonstationary', 'pyFTS.models.multivariate'],
'pyFTS.tests', 'pyFTS.models.nonstationary', 'pyFTS.models.multivariate',
'pyFTS.models.incremental'],
version='1.2.3',
description='Fuzzy Time Series for Python',
author='Petronio Candido L. e Silva',