Documentation update

This commit is contained in:
Petrônio Cândido 2019-04-22 10:01:58 -03:00
parent c3457a3569
commit 7c11b7e5de
37 changed files with 665 additions and 104 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -127,6 +127,8 @@
<li><a href="pyFTS/models/multivariate/cmvfts.html">pyFTS.models.multivariate.cmvfts</a></li> <li><a href="pyFTS/models/multivariate/cmvfts.html">pyFTS.models.multivariate.cmvfts</a></li>
<li><a href="pyFTS/models/multivariate/common.html">pyFTS.models.multivariate.common</a></li> <li><a href="pyFTS/models/multivariate/common.html">pyFTS.models.multivariate.common</a></li>
<li><a href="pyFTS/models/multivariate/flrg.html">pyFTS.models.multivariate.flrg</a></li> <li><a href="pyFTS/models/multivariate/flrg.html">pyFTS.models.multivariate.flrg</a></li>
<li><a href="pyFTS/models/multivariate/granular.html">pyFTS.models.multivariate.granular</a></li>
<li><a href="pyFTS/models/multivariate/grid.html">pyFTS.models.multivariate.grid</a></li>
<li><a href="pyFTS/models/multivariate/mvfts.html">pyFTS.models.multivariate.mvfts</a></li> <li><a href="pyFTS/models/multivariate/mvfts.html">pyFTS.models.multivariate.mvfts</a></li>
<li><a href="pyFTS/models/multivariate/variable.html">pyFTS.models.multivariate.variable</a></li> <li><a href="pyFTS/models/multivariate/variable.html">pyFTS.models.multivariate.variable</a></li>
<li><a href="pyFTS/models/multivariate/wmvfts.html">pyFTS.models.multivariate.wmvfts</a></li> <li><a href="pyFTS/models/multivariate/wmvfts.html">pyFTS.models.multivariate.wmvfts</a></li>

View File

@ -81,6 +81,7 @@
<span class="sd">&quot;&quot;&quot;</span> <span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Fuzzy Set</span> <span class="sd"> Fuzzy Set</span>
<span class="sd"> &quot;&quot;&quot;</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="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="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</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="sd">&quot;&quot;&quot;</span> <span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Create a Fuzzy Set</span> <span class="sd"> Create a Fuzzy Set</span>
@ -194,13 +195,12 @@
<span class="sd"> :param data: input value to be fuzzyfied</span> <span class="sd"> :param data: input value to be fuzzyfied</span>
<span class="sd"> :param partitioner: a trained pyFTS.partitioners.Partitioner object</span> <span class="sd"> :param partitioner: a trained pyFTS.partitioners.Partitioner object</span>
<span class="sd"> :param kwargs: dict, optional arguments</span> <span class="sd"> :param kwargs: dict, optional arguments</span>
<span class="sd"> :keyword alpha_cut: the minimal membership value to be considered on fuzzyfication (only for mode=&#39;sets&#39;)</span> <span class="sd"> :keyword alpha_cut: the minimal membership value to be considered on fuzzyfication (only for mode=&#39;sets&#39;)</span>
<span class="sd"> :keyword method: the fuzzyfication method (fuzzy: all fuzzy memberships, maximum: only the maximum membership)</span> <span class="sd"> :keyword method: the fuzzyfication method (fuzzy: all fuzzy memberships, maximum: only the maximum membership)</span>
<span class="sd"> :keyword mode: the fuzzyfication mode (sets: return the fuzzy sets names, vector: return a vector with the membership</span> <span class="sd"> :keyword mode: the fuzzyfication mode (sets: return the fuzzy sets names, vector: return a vector with the membership</span>
<span class="sd"> values for all fuzzy sets, both: return a list with tuples (fuzzy set, membership value) )</span> <span class="sd"> values for all fuzzy sets, both: return a list with tuples (fuzzy set, membership value) )</span>
<span class="sd"> </span>
<span class="sd"> :returns a list with the fuzzyfied values, depending on the mode</span> <span class="sd"> :returns a list with the fuzzyfied values, depending on the mode</span>
<span class="sd"> &quot;&quot;&quot;</span> <span class="sd"> &quot;&quot;&quot;</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.</span><span class="p">)</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.</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;sets&#39;</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;sets&#39;</span><span class="p">)</span>
@ -369,6 +369,7 @@
<span class="k">else</span><span class="p">:</span> <span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="n">data</span></div> <span class="k">return</span> <span class="n">data</span></div>
<div class="viewcode-block" id="check_bounds"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.check_bounds">[docs]</a><span class="k">def</span> <span class="nf">check_bounds</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">fuzzy_sets</span><span class="p">,</span> <span class="n">ordered_sets</span><span class="p">):</span> <div class="viewcode-block" id="check_bounds"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.check_bounds">[docs]</a><span class="k">def</span> <span class="nf">check_bounds</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">fuzzy_sets</span><span class="p">,</span> <span class="n">ordered_sets</span><span class="p">):</span>
<span class="k">if</span> <span class="n">data</span> <span class="o">&lt;</span> <span class="n">fuzzy_sets</span><span class="p">[</span><span class="n">ordered_sets</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span><span class="o">.</span><span class="n">lower</span><span class="p">:</span> <span class="k">if</span> <span class="n">data</span> <span class="o">&lt;</span> <span class="n">fuzzy_sets</span><span class="p">[</span><span class="n">ordered_sets</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span><span class="o">.</span><span class="n">lower</span><span class="p">:</span>
<span class="k">return</span> <span class="n">fuzzy_sets</span><span class="p">[</span><span class="n">ordered_sets</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span> <span class="k">return</span> <span class="n">fuzzy_sets</span><span class="p">[</span><span class="n">ordered_sets</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span>

View File

@ -145,6 +145,8 @@
<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">order</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">order</span>
<span class="sd">&quot;&quot;&quot;A integer indicating the largest lag used by the model. This value also indicates the minimum number of past lags </span> <span class="sd">&quot;&quot;&quot;A integer indicating the largest lag used by the model. This value also indicates the minimum number of past lags </span>
<span class="sd"> needed to forecast a single step ahead&quot;&quot;&quot;</span> <span class="sd"> needed to forecast a single step ahead&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">log</span> <span class="o">=</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">([],</span><span class="n">columns</span><span class="o">=</span><span class="p">[</span><span class="s2">&quot;Datetime&quot;</span><span class="p">,</span><span class="s2">&quot;Operation&quot;</span><span class="p">,</span><span class="s2">&quot;Value&quot;</span><span class="p">])</span>
<span class="sd">&quot;&quot;&quot;&quot;&quot;&quot;</span>
<div class="viewcode-block" id="FTS.fuzzy"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.fts.FTS.fuzzy">[docs]</a> <span class="k">def</span> <span class="nf">fuzzy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span> <div class="viewcode-block" id="FTS.fuzzy"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.fts.FTS.fuzzy">[docs]</a> <span class="k">def</span> <span class="nf">fuzzy</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="sd">&quot;&quot;&quot;</span> <span class="sd">&quot;&quot;&quot;</span>
@ -222,7 +224,7 @@
<span class="k">elif</span> <span class="nb">type</span> <span class="o">==</span> <span class="s1">&#39;distribution&#39;</span><span class="p">:</span> <span class="k">elif</span> <span class="nb">type</span> <span class="o">==</span> <span class="s1">&#39;distribution&#39;</span><span class="p">:</span>
<span class="n">ret</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">forecast_ahead_distribution</span><span class="p">(</span><span class="n">ndata</span><span class="p">,</span> <span class="n">steps_ahead</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="bp">self</span><span class="o">.</span><span class="n">forecast_ahead_distribution</span><span class="p">(</span><span class="n">ndata</span><span class="p">,</span> <span class="n">steps_ahead</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="nb">type</span> <span class="o">==</span> <span class="s1">&#39;multivariate&#39;</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">ret</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">forecast_ahead_multivariate</span><span class="p">(</span><span class="n">ndata</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="bp">self</span><span class="o">.</span><span class="n">forecast_ahead_multivariate</span><span class="p">(</span><span class="n">ndata</span><span class="p">,</span> <span class="n">steps_ahead</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="ow">not</span> <span class="p">[</span><span class="s1">&#39;point&#39;</span><span class="p">,</span> <span class="s1">&#39;interval&#39;</span><span class="p">,</span> <span class="s1">&#39;distribution&#39;</span><span class="p">,</span> <span class="s1">&#39;multivariate&#39;</span><span class="p">]</span><span class="o">.</span><span class="fm">__contains__</span><span class="p">(</span><span class="nb">type</span><span class="p">):</span> <span class="k">if</span> <span class="ow">not</span> <span class="p">[</span><span class="s1">&#39;point&#39;</span><span class="p">,</span> <span class="s1">&#39;interval&#39;</span><span class="p">,</span> <span class="s1">&#39;distribution&#39;</span><span class="p">,</span> <span class="s1">&#39;multivariate&#39;</span><span class="p">]</span><span class="o">.</span><span class="fm">__contains__</span><span class="p">(</span><span class="nb">type</span><span class="p">):</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;The argument </span><span class="se">\&#39;</span><span class="s1">type</span><span class="se">\&#39;</span><span class="s1"> has an unknown value.&#39;</span><span class="p">)</span> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s1">&#39;The argument </span><span class="se">\&#39;</span><span class="s1">type</span><span class="se">\&#39;</span><span class="s1"> has an unknown value.&#39;</span><span class="p">)</span>
@ -630,7 +632,10 @@
<span class="sd"> &quot;&quot;&quot;</span> <span class="sd"> &quot;&quot;&quot;</span>
<span class="k">for</span> <span class="n">flrg</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="o">.</span><span class="n">keys</span><span class="p">():</span> <span class="k">for</span> <span class="n">flrg</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="o">.</span><span class="n">keys</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="p">]</span><span class="o">.</span><span class="n">reset_calculated_values</span><span class="p">()</span></div></div> <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="p">]</span><span class="o">.</span><span class="n">reset_calculated_values</span><span class="p">()</span></div>
<div class="viewcode-block" id="FTS.append_log"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.fts.FTS.append_log">[docs]</a> <span class="k">def</span> <span class="nf">append_log</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="n">operation</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span>
<span class="k">pass</span></div></div>

View File

@ -124,7 +124,7 @@
<div class="viewcode-block" id="ConventionalFTS.train"><a class="viewcode-back" href="../../../pyFTS.models.html#pyFTS.models.chen.ConventionalFTS.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="ConventionalFTS.train"><a class="viewcode-back" href="../../../pyFTS.models.html#pyFTS.models.chen.ConventionalFTS.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">tmpdata</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</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">method</span><span class="o">=</span><span class="s1">&#39;maximum&#39;</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">tmpdata</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">fuzzyfy</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;maximum&#39;</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">flrs</span> <span class="o">=</span> <span class="n">FLR</span><span class="o">.</span><span class="n">generate_non_recurrent_flrs</span><span class="p">(</span><span class="n">tmpdata</span><span class="p">)</span> <span class="n">flrs</span> <span class="o">=</span> <span class="n">FLR</span><span class="o">.</span><span class="n">generate_non_recurrent_flrs</span><span class="p">(</span><span class="n">tmpdata</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">generate_flrg</span><span class="p">(</span><span class="n">flrs</span><span class="p">)</span></div> <span class="bp">self</span><span class="o">.</span><span class="n">generate_flrg</span><span class="p">(</span><span class="n">flrs</span><span class="p">)</span></div>

View File

@ -200,6 +200,9 @@
<span class="n">nsample</span> <span class="o">=</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">fuzzyfy</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s2">&quot;sets&quot;</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">nsample</span> <span class="o">=</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">fuzzyfy</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s2">&quot;sets&quot;</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">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">sample</span><span class="p">]</span> <span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">sample</span><span class="p">]</span>
<span class="k">if</span> <span class="n">explain</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">append_log</span><span class="p">(</span><span class="s2">&quot;Fuzzyfication&quot;</span><span class="p">,</span><span class="s2">&quot;</span><span class="si">{}</span><span class="s2"> -&gt; </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">sample</span><span class="p">,</span> <span class="n">nsample</span><span class="p">))</span>
<span class="k">return</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">nsample</span><span class="p">,</span> <span class="n">explain</span><span class="p">)</span></div> <span class="k">return</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">nsample</span><span class="p">,</span> <span class="n">explain</span><span class="p">)</span></div>
<div class="viewcode-block" id="HighOrderFTS.generate_lhs_flrg_fuzzyfied"><a class="viewcode-back" href="../../../pyFTS.models.html#pyFTS.models.hofts.HighOrderFTS.generate_lhs_flrg_fuzzyfied">[docs]</a> <span class="k">def</span> <span class="nf">generate_lhs_flrg_fuzzyfied</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sample</span><span class="p">,</span> <span class="n">explain</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span> <div class="viewcode-block" id="HighOrderFTS.generate_lhs_flrg_fuzzyfied"><a class="viewcode-back" href="../../../pyFTS.models.html#pyFTS.models.hofts.HighOrderFTS.generate_lhs_flrg_fuzzyfied">[docs]</a> <span class="k">def</span> <span class="nf">generate_lhs_flrg_fuzzyfied</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sample</span><span class="p">,</span> <span class="n">explain</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
@ -211,7 +214,7 @@
<span class="n">lags</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">lhs</span><span class="p">)</span> <span class="n">lags</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">lhs</span><span class="p">)</span>
<span class="k">if</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;</span><span class="se">\t</span><span class="s2"> (Lag </span><span class="si">{}</span><span class="s2">) </span><span class="si">{}</span><span class="s2"> -&gt; </span><span class="si">{}</span><span class="s2"> </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">o</span><span class="p">,</span> <span class="n">sample</span><span class="p">[</span><span class="n">o</span><span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="n">lhs</span><span class="p">))</span> <span class="bp">self</span><span class="o">.</span><span class="n">append_log</span><span class="p">(</span><span class="s2">&quot;Ordering Lags&quot;</span><span class="p">,</span> <span class="s2">&quot;Lag </span><span class="si">{}</span><span class="s2"> Value </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">o</span><span class="p">,</span> <span class="n">lhs</span><span class="p">))</span>
<span class="c1"># Trace the possible paths</span> <span class="c1"># Trace the possible paths</span>
<span class="k">for</span> <span class="n">path</span> <span class="ow">in</span> <span class="n">product</span><span class="p">(</span><span class="o">*</span><span class="n">lags</span><span class="p">):</span> <span class="k">for</span> <span class="n">path</span> <span class="ow">in</span> <span class="n">product</span><span class="p">(</span><span class="o">*</span><span class="n">lags</span><span class="p">):</span>
@ -291,17 +294,11 @@
<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="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">fuzzyfied</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="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="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">sample</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">midpoints</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="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">for</span> <span class="n">flrg</span> <span class="ow">in</span> <span class="n">flrgs</span><span class="p">:</span>
@ -314,7 +311,7 @@
<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="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="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> <span class="bp">self</span><span class="o">.</span><span class="n">append_log</span><span class="p">(</span><span class="s2">&quot;Rule Matching&quot;</span><span class="p">,</span> <span class="s2">&quot;</span><span class="si">{}</span><span class="s2"> -&gt; </span><span class="si">{}</span><span class="s2"> (Naïve) Midpoint: </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="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>
<span class="n">mp</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="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">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>
@ -324,19 +321,17 @@
<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="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="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="bp">self</span><span class="o">.</span><span class="n">append_log</span><span class="p">(</span><span class="s2">&quot;Rule Matching&quot;</span><span class="p">,</span> <span class="s2">&quot;</span><span class="si">{}</span><span class="s2">, Midpoint: </span><span class="si">{}</span><span class="s2"> Membership: </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">flrg</span><span class="o">.</span><span class="n">get_key</span><span class="p">(),</span> <span class="n">mp</span><span class="p">,</span> <span class="n">mv</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="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="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">if</span> <span class="n">explain</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">append_log</span><span class="p">(</span><span class="s2">&quot;Deffuzyfication&quot;</span><span class="p">,</span> <span class="s2">&quot;By Mean: </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">final</span><span class="p">))</span>
<span class="k">else</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">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="k">if</span> <span class="n">explain</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">append_log</span><span class="p">(</span><span class="s2">&quot;Deffuzyfication&quot;</span><span class="p">,</span> <span class="s2">&quot;By Memberships: </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">final</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="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>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Deffuzyfied value: </span><span class="si">{}</span><span class="s2"> </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">final</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></div>

View File

@ -137,7 +137,7 @@
<div class="viewcode-block" id="ImprovedWeightedFTS.train"><a class="viewcode-back" href="../../../pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFTS.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">ndata</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <div class="viewcode-block" id="ImprovedWeightedFTS.train"><a class="viewcode-back" href="../../../pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFTS.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">ndata</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="n">tmpdata</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">ndata</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">method</span><span class="o">=</span><span class="s1">&#39;maximum&#39;</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">tmpdata</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">fuzzyfy</span><span class="p">(</span><span class="n">ndata</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;maximum&#39;</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">flrs</span> <span class="o">=</span> <span class="n">FLR</span><span class="o">.</span><span class="n">generate_recurrent_flrs</span><span class="p">(</span><span class="n">tmpdata</span><span class="p">)</span> <span class="n">flrs</span> <span class="o">=</span> <span class="n">FLR</span><span class="o">.</span><span class="n">generate_recurrent_flrs</span><span class="p">(</span><span class="n">tmpdata</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">generate_flrg</span><span class="p">(</span><span class="n">flrs</span><span class="p">)</span></div> <span class="bp">self</span><span class="o">.</span><span class="n">generate_flrg</span><span class="p">(</span><span class="n">flrs</span><span class="p">)</span></div>

View File

@ -78,11 +78,12 @@
<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.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.models</span> <span class="k">import</span> <span class="n">hofts</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.multivariate</span> <span class="k">import</span> <span class="n">mvfts</span><span class="p">,</span> <span class="n">grid</span><span class="p">,</span> <span class="n">common</span> <span class="kn">from</span> <span class="nn">pyFTS.models.multivariate</span> <span class="k">import</span> <span class="n">mvfts</span><span class="p">,</span> <span class="n">grid</span><span class="p">,</span> <span class="n">common</span>
<span class="kn">from</span> <span class="nn">types</span> <span class="k">import</span> <span class="n">LambdaType</span>
<div class="viewcode-block" id="ClusteredMVFTS"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS">[docs]</a><span class="k">class</span> <span class="nc">ClusteredMVFTS</span><span class="p">(</span><span class="n">mvfts</span><span class="o">.</span><span class="n">MVFTS</span><span class="p">):</span> <div class="viewcode-block" id="ClusteredMVFTS"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS">[docs]</a><span class="k">class</span> <span class="nc">ClusteredMVFTS</span><span class="p">(</span><span class="n">mvfts</span><span class="o">.</span><span class="n">MVFTS</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span> <span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Meta model for multivariate, high order, clustered multivariate FTS</span> <span class="sd"> Meta model for high order, clustered multivariate FTS</span>
<span class="sd"> &quot;&quot;&quot;</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="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">ClusteredMVFTS</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="nb">super</span><span class="p">(</span><span class="n">ClusteredMVFTS</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>
@ -112,16 +113,15 @@
<span class="n">ndata</span> <span class="o">=</span> <span class="p">[]</span> <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="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">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">ndata</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">partitioner</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">mode</span><span class="o">=</span><span class="s1">&#39;sets&#39;</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> <span class="k">return</span> <span class="n">ndata</span></div>
<div class="viewcode-block" id="ClusteredMVFTS.train"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.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="ClusteredMVFTS.train"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.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">fts_params</span><span class="p">[</span><span class="s1">&#39;order&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">order</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="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>
<span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</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="n">ndata</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">check_data</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="bp">self</span><span class="o">.</span><span class="n">check_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
@ -147,18 +147,53 @@
<span class="n">ndata</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">check_data</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="bp">self</span><span class="o">.</span><span class="n">check_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="n">generators</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;generators&#39;</span><span class="p">,</span> <span class="p">{})</span>
<span class="n">already_processed_cols</span> <span class="o">=</span> <span class="p">[]</span>
<span class="n">ret</span> <span class="o">=</span> <span class="p">{}</span> <span class="n">ret</span> <span class="o">=</span> <span class="p">{}</span>
<span class="n">ret</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="bp">self</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">ndata</span><span class="p">,</span> <span class="n">fuzzyfied</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">pre_fuzzyfy</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</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">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="bp">self</span><span class="o">.</span><span class="n">target_variable</span><span class="o">.</span><span class="n">name</span> <span class="o">!=</span> <span class="n">var</span><span class="o">.</span><span class="n">name</span><span class="p">:</span> <span class="k">if</span> <span class="n">var</span><span class="o">.</span><span class="n">data_label</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">already_processed_cols</span><span class="p">:</span>
<span class="k">if</span> <span class="n">var</span><span class="o">.</span><span class="n">data_label</span> <span class="ow">in</span> <span class="n">generators</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">var</span><span class="o">.</span><span class="n">data_label</span><span class="p">],</span> <span class="n">LambdaType</span><span class="p">):</span>
<span class="n">fx</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">data_label</span><span class="p">]</span>
<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="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="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">order</span><span class="p">:</span>
<span class="n">ret</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="p">[</span><span class="n">fx</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">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="o">.</span><span class="n">values</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="k">else</span><span class="p">:</span>
<span class="n">ret</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="p">[</span><span class="n">fx</span><span class="p">(</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="o">.</span><span class="n">values</span><span class="p">[</span><span class="o">-</span><span class="mi">1</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">var</span><span class="o">.</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">var</span><span class="o">.</span><span class="n">data_label</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">ret</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">model</span><span class="o">.</span><span class="n">forecast</span><span class="p">(</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="o">.</span><span class="n">values</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">ret</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">model</span><span class="o">.</span><span class="n">forecast</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="k">elif</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="o">!=</span> <span class="n">var</span><span class="o">.</span><span class="n">name</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">var</span> <span class="bp">self</span><span class="o">.</span><span class="n">target_variable</span> <span class="o">=</span> <span class="n">var</span>
<span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">change_target_variable</span><span class="p">(</span><span class="n">var</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">change_target_variable</span><span class="p">(</span><span class="n">var</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">partitioner</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitioner</span> <span class="bp">self</span><span class="o">.</span><span class="n">model</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</span>
<span class="bp">self</span><span class="o">.</span><span class="n">model</span><span class="o">.</span><span class="n">reset_calculated_values</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">reset_calculated_values</span><span class="p">()</span>
<span class="n">ret</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="bp">self</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">ndata</span><span class="p">,</span> <span class="n">fuzzyfied</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">pre_fuzzyfy</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="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="bp">self</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">ndata</span><span class="p">,</span> <span class="n">fuzzyfied</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">pre_fuzzyfy</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> <span class="n">already_processed_cols</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">data_label</span><span class="p">)</span>
<span class="k">return</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">(</span><span class="n">ret</span><span class="p">,</span> <span class="n">columns</span><span class="o">=</span><span class="n">ret</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span></div> <span class="k">return</span> <span class="n">pd</span><span class="o">.</span><span class="n">DataFrame</span><span class="p">(</span><span class="n">ret</span><span class="p">,</span> <span class="n">columns</span><span class="o">=</span><span class="n">ret</span><span class="o">.</span><span class="n">keys</span><span class="p">())</span></div>
<div class="viewcode-block" id="ClusteredMVFTS.forecast_ahead_multivariate"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.forecast_ahead_multivariate">[docs]</a> <span class="k">def</span> <span class="nf">forecast_ahead_multivariate</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">steps</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="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="n">ret</span> <span class="o">=</span> <span class="n">ndata</span><span class="o">.</span><span class="n">iloc</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="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">steps</span><span class="p">):</span>
<span class="n">sample</span> <span class="o">=</span> <span class="n">ret</span><span class="o">.</span><span class="n">iloc</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">order</span><span class="o">+</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">forecast_multivariate</span><span class="p">(</span><span class="n">sample</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">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">ignore_index</span><span class="o">=</span><span class="kc">True</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="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="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">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>

View File

@ -117,7 +117,7 @@
<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> <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="n">fsets</span> <span class="o">=</span> <span class="n">var</span><span class="o">.</span><span class="n">partitioner</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">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">if</span> <span class="n">tuples</span><span class="p">:</span> <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">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">else</span><span class="p">:</span>
@ -128,7 +128,7 @@
<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="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="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;sets&#39;</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;sets&#39;</span><span class="p">)</span>
<span class="n">fsets</span> <span class="o">=</span> <span class="p">[]</span> <span class="n">fsets</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">fset</span> <span class="ow">in</span> <span class="n">cluster</span><span class="o">.</span><span class="n">knn</span><span class="p">(</span><span class="n">data_point</span><span class="p">):</span> <span class="k">for</span> <span class="n">fset</span> <span class="ow">in</span> <span class="n">cluster</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">data_point</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s1">&#39;name&#39;</span><span class="p">):</span>
<span class="k">if</span> <span class="n">cluster</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="n">fset</span><span class="p">]</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="o">&gt;</span> <span class="n">alpha_cut</span><span class="p">:</span> <span class="k">if</span> <span class="n">cluster</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="n">fset</span><span class="p">]</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="o">&gt;</span> <span class="n">alpha_cut</span><span class="p">:</span>
<span class="k">if</span> <span class="n">mode</span> <span class="o">==</span> <span class="s1">&#39;sets&#39;</span><span class="p">:</span> <span class="k">if</span> <span class="n">mode</span> <span class="o">==</span> <span class="s1">&#39;sets&#39;</span><span class="p">:</span>
<span class="n">fsets</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">fset</span><span class="p">)</span> <span class="n">fsets</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">fset</span><span class="p">)</span>

View File

@ -119,7 +119,6 @@
<div class="viewcode-block" id="MVFTS.format_data"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.format_data">[docs]</a> <span class="k">def</span> <span class="nf">format_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span> <div class="viewcode-block" id="MVFTS.format_data"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.format_data">[docs]</a> <span class="k">def</span> <span class="nf">format_data</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">ndata</span> <span class="o">=</span> <span class="p">{}</span> <span class="n">ndata</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">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="c1">#ndata[var.name] = data[var.data_label]</span>
<span class="n">ndata</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">var</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">extractor</span><span class="p">(</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">ndata</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">var</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">extractor</span><span class="p">(</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="k">return</span> <span class="n">ndata</span></div> <span class="k">return</span> <span class="n">ndata</span></div>

View File

@ -141,7 +141,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">[</span><span class="n">flr</span><span class="o">.</span><span class="n">LHS</span><span class="p">]</span><span class="o">.</span><span class="n">append_rhs</span><span class="p">(</span><span class="n">flr</span><span class="o">.</span><span class="n">RHS</span><span class="p">)</span></div> <span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">[</span><span class="n">flr</span><span class="o">.</span><span class="n">LHS</span><span class="p">]</span><span class="o">.</span><span class="n">append_rhs</span><span class="p">(</span><span class="n">flr</span><span class="o">.</span><span class="n">RHS</span><span class="p">)</span></div>
<div class="viewcode-block" id="ExponentialyWeightedFTS.train"><a class="viewcode-back" href="../../../pyFTS.models.html#pyFTS.models.sadaei.ExponentialyWeightedFTS.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="ExponentialyWeightedFTS.train"><a class="viewcode-back" href="../../../pyFTS.models.html#pyFTS.models.sadaei.ExponentialyWeightedFTS.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">tmpdata</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</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">method</span><span class="o">=</span><span class="s1">&#39;maximum&#39;</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">tmpdata</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">fuzzyfy</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;maximum&#39;</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">flrs</span> <span class="o">=</span> <span class="n">FLR</span><span class="o">.</span><span class="n">generate_recurrent_flrs</span><span class="p">(</span><span class="n">tmpdata</span><span class="p">)</span> <span class="n">flrs</span> <span class="o">=</span> <span class="n">FLR</span><span class="o">.</span><span class="n">generate_recurrent_flrs</span><span class="p">(</span><span class="n">tmpdata</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">generate_flrg</span><span class="p">(</span><span class="n">flrs</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">c</span><span class="p">)</span></div> <span class="bp">self</span><span class="o">.</span><span class="n">generate_flrg</span><span class="p">(</span><span class="n">flrs</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">c</span><span class="p">)</span></div>

View File

@ -93,9 +93,9 @@
<span class="n">day_of_month</span> <span class="o">=</span> <span class="mi">30</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> <span class="n">day_of_year</span> <span class="o">=</span> <span class="mi">364</span>
<span class="n">day_of_week</span> <span class="o">=</span> <span class="mi">7</span> <span class="n">day_of_week</span> <span class="o">=</span> <span class="mi">7</span>
<span class="n">hour</span> <span class="o">=</span> <span class="mi">6</span> <span class="n">hour</span> <span class="o">=</span> <span class="mi">24</span>
<span class="n">minute</span> <span class="o">=</span> <span class="mi">7</span> <span class="n">minute</span> <span class="o">=</span> <span class="mi">60</span>
<span class="n">second</span> <span class="o">=</span> <span class="mi">8</span> <span class="n">second</span> <span class="o">=</span> <span class="mi">60</span>
<span class="n">hour_of_day</span> <span class="o">=</span> <span class="mi">24</span> <span class="n">hour_of_day</span> <span class="o">=</span> <span class="mi">24</span>
<span class="n">hour_of_week</span> <span class="o">=</span> <span class="mi">168</span> <span class="n">hour_of_week</span> <span class="o">=</span> <span class="mi">168</span>
<span class="n">hour_of_month</span> <span class="o">=</span> <span class="mi">744</span> <span class="n">hour_of_month</span> <span class="o">=</span> <span class="mi">744</span>

View File

@ -78,6 +78,7 @@
<span class="kn">from</span> <span class="nn">pyFTS.models.seasonal.common</span> <span class="k">import</span> <span class="n">DateTime</span><span class="p">,</span> <span class="n">FuzzySet</span><span class="p">,</span> <span class="n">strip_datepart</span> <span class="kn">from</span> <span class="nn">pyFTS.models.seasonal.common</span> <span class="k">import</span> <span class="n">DateTime</span><span class="p">,</span> <span class="n">FuzzySet</span><span class="p">,</span> <span class="n">strip_datepart</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">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">matplotlib.pylab</span> <span class="k">as</span> <span class="nn">plt</span> <span class="kn">import</span> <span class="nn">matplotlib.pylab</span> <span class="k">as</span> <span class="nn">plt</span>
<span class="kn">from</span> <span class="nn">scipy.spatial</span> <span class="k">import</span> <span class="n">KDTree</span>
<div class="viewcode-block" id="TimeGridPartitioner"><a class="viewcode-back" href="../../../../pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner">[docs]</a><span class="k">class</span> <span class="nc">TimeGridPartitioner</span><span class="p">(</span><span class="n">partitioner</span><span class="o">.</span><span class="n">Partitioner</span><span class="p">):</span> <div class="viewcode-block" id="TimeGridPartitioner"><a class="viewcode-back" href="../../../../pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner">[docs]</a><span class="k">class</span> <span class="nc">TimeGridPartitioner</span><span class="p">(</span><span class="n">partitioner</span><span class="o">.</span><span class="n">Partitioner</span><span class="p">):</span>
@ -130,6 +131,8 @@
<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="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="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="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">minute</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">60</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="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="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="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>
@ -148,7 +151,7 @@
<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="o">**</span><span class="n">kwargs</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="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="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="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="n">pl2</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="p">,</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="n">pl2</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="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="mf">0.0000001</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="p">,</span> <span class="n">alpha</span><span class="o">=.</span><span class="mi">5</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="n">pl2</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="p">,</span> <span class="n">alpha</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span>
<span class="o">**</span><span class="n">kwargs</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="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="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>
@ -158,8 +161,8 @@
<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="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="o">**</span><span class="n">kwargs</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="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="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="p">[</span><span class="o">-</span><span class="n">pl2</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="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">1</span><span class="p">,</span>
<span class="o">**</span><span class="n">kwargs</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="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="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>
@ -196,6 +199,57 @@
<span class="k">return</span> <span class="n">sets</span></div> <span class="k">return</span> <span class="n">sets</span></div>
<div class="viewcode-block" id="TimeGridPartitioner.build_index"><a class="viewcode-back" href="../../../../pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.build_index">[docs]</a> <span class="k">def</span> <span class="nf">build_index</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">points</span> <span class="o">=</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">sets</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span>
<span class="n">points</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">fset</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">,</span> <span class="n">fset</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">centroid</span><span class="p">,</span> <span class="n">fset</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">upper</span><span class="p">])</span>
<span class="k">for</span> <span class="n">ct</span><span class="p">,</span> <span class="n">key</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">ordered_sets</span><span class="p">[</span><span class="mi">1</span><span class="p">:</span><span class="o">-</span><span class="mi">1</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">sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
<span class="n">points</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">fset</span><span class="o">.</span><span class="n">lower</span><span class="p">,</span> <span class="n">fset</span><span class="o">.</span><span class="n">centroid</span><span class="p">,</span> <span class="n">fset</span><span class="o">.</span><span class="n">upper</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">sets</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]]</span>
<span class="n">points</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">fset</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">lower</span><span class="p">,</span> <span class="n">fset</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">centroid</span><span class="p">,</span> <span class="n">fset</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">upper</span><span class="p">])</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="n">sys</span><span class="o">.</span><span class="n">setrecursionlimit</span><span class="p">(</span><span class="mi">100000</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">kdtree</span> <span class="o">=</span> <span class="n">KDTree</span><span class="p">(</span><span class="n">points</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">setrecursionlimit</span><span class="p">(</span><span class="mi">1000</span><span class="p">)</span></div>
<div class="viewcode-block" id="TimeGridPartitioner.search"><a class="viewcode-back" href="../../../../pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.search">[docs]</a> <span class="k">def</span> <span class="nf">search</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="sd">&#39;&#39;&#39;</span>
<span class="sd"> Perform a search for the nearest fuzzy sets of the point &#39;data&#39;. This function were designed to work with several</span>
<span class="sd"> overlapped fuzzy sets.</span>
<span class="sd"> :param data: the value to search for the nearest fuzzy sets</span>
<span class="sd"> :param type: the return type: &#39;index&#39; for the fuzzy set indexes or &#39;name&#39; for fuzzy set names.</span>
<span class="sd"> :param results: the number of nearest fuzzy sets to return</span>
<span class="sd"> :return: a list with the nearest fuzzy sets</span>
<span class="sd"> &#39;&#39;&#39;</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;index&#39;</span><span class="p">)</span>
<span class="n">results</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;results&#39;</span><span class="p">,</span><span class="mi">3</span><span class="p">)</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">kdtree</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">build_index</span><span class="p">()</span>
<span class="n">_</span><span class="p">,</span> <span class="n">ix</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">kdtree</span><span class="o">.</span><span class="n">query</span><span class="p">([</span><span class="n">data</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">data</span><span class="p">],</span> <span class="n">results</span><span class="p">)</span>
<span class="n">ix</span> <span class="o">=</span> <span class="n">ix</span><span class="o">.</span><span class="n">tolist</span><span class="p">()</span>
<span class="k">if</span> <span class="mi">0</span> <span class="ow">in</span> <span class="n">ix</span><span class="p">:</span>
<span class="n">ix</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="bp">self</span><span class="o">.</span><span class="n">partitions</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitions</span><span class="o">-</span><span class="mi">1</span> <span class="ow">in</span> <span class="n">ix</span><span class="p">:</span>
<span class="n">ix</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="k">if</span> <span class="nb">type</span> <span class="o">==</span> <span class="s1">&#39;name&#39;</span><span class="p">:</span>
<span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</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">sorted</span><span class="p">(</span><span class="n">ix</span><span class="p">)]</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">ix</span><span class="p">)</span></div>
<div class="viewcode-block" id="TimeGridPartitioner.plot"><a class="viewcode-back" href="../../../../pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.plot">[docs]</a> <span class="k">def</span> <span class="nf">plot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ax</span><span class="p">):</span> <div class="viewcode-block" id="TimeGridPartitioner.plot"><a class="viewcode-back" href="../../../../pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.plot">[docs]</a> <span class="k">def</span> <span class="nf">plot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ax</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span> <span class="sd">&quot;&quot;&quot;</span>

View File

@ -124,7 +124,7 @@
<div class="viewcode-block" id="ConventionalFTS.train"><a class="viewcode-back" href="../../../pyFTS.models.html#pyFTS.models.song.ConventionalFTS.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="ConventionalFTS.train"><a class="viewcode-back" href="../../../pyFTS.models.html#pyFTS.models.song.ConventionalFTS.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">tmpdata</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</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">method</span><span class="o">=</span><span class="s1">&#39;maximum&#39;</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">tmpdata</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">fuzzyfy</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;maximum&#39;</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">flrs</span> <span class="o">=</span> <span class="n">FLR</span><span class="o">.</span><span class="n">generate_non_recurrent_flrs</span><span class="p">(</span><span class="n">tmpdata</span><span class="p">)</span> <span class="n">flrs</span> <span class="o">=</span> <span class="n">FLR</span><span class="o">.</span><span class="n">generate_non_recurrent_flrs</span><span class="p">(</span><span class="n">tmpdata</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">operation_matrix</span><span class="p">(</span><span class="n">flrs</span><span class="p">)</span></div> <span class="bp">self</span><span class="o">.</span><span class="n">operation_matrix</span><span class="p">(</span><span class="n">flrs</span><span class="p">)</span></div>

View File

@ -133,7 +133,7 @@
<span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">[</span><span class="n">flr</span><span class="o">.</span><span class="n">LHS</span><span class="p">]</span><span class="o">.</span><span class="n">append_rhs</span><span class="p">(</span><span class="n">flr</span><span class="o">.</span><span class="n">RHS</span><span class="p">)</span></div> <span class="bp">self</span><span class="o">.</span><span class="n">flrgs</span><span class="p">[</span><span class="n">flr</span><span class="o">.</span><span class="n">LHS</span><span class="p">]</span><span class="o">.</span><span class="n">append_rhs</span><span class="p">(</span><span class="n">flr</span><span class="o">.</span><span class="n">RHS</span><span class="p">)</span></div>
<div class="viewcode-block" id="WeightedFTS.train"><a class="viewcode-back" href="../../../pyFTS.models.html#pyFTS.models.yu.WeightedFTS.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">ndata</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> <div class="viewcode-block" id="WeightedFTS.train"><a class="viewcode-back" href="../../../pyFTS.models.html#pyFTS.models.yu.WeightedFTS.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">ndata</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="n">tmpdata</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">ndata</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">method</span><span class="o">=</span><span class="s1">&#39;maximum&#39;</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">tmpdata</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">fuzzyfy</span><span class="p">(</span><span class="n">ndata</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">&#39;maximum&#39;</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">flrs</span> <span class="o">=</span> <span class="n">FLR</span><span class="o">.</span><span class="n">generate_recurrent_flrs</span><span class="p">(</span><span class="n">tmpdata</span><span class="p">)</span> <span class="n">flrs</span> <span class="o">=</span> <span class="n">FLR</span><span class="o">.</span><span class="n">generate_recurrent_flrs</span><span class="p">(</span><span class="n">tmpdata</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">generate_FLRG</span><span class="p">(</span><span class="n">flrs</span><span class="p">)</span></div> <span class="bp">self</span><span class="o">.</span><span class="n">generate_FLRG</span><span class="p">(</span><span class="n">flrs</span><span class="p">)</span></div>

View File

@ -74,6 +74,7 @@
<h1>Source code for pyFTS.partitioners.partitioner</h1><div class="highlight"><pre> <h1>Source code for pyFTS.partitioners.partitioner</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">FuzzySet</span><span class="p">,</span> <span class="n">Membership</span> <span></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">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">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">from</span> <span class="nn">scipy.spatial</span> <span class="k">import</span> <span class="n">KDTree</span>
<span class="kn">import</span> <span class="nn">matplotlib.pylab</span> <span class="k">as</span> <span class="nn">plt</span> <span class="kn">import</span> <span class="nn">matplotlib.pylab</span> <span class="k">as</span> <span class="nn">plt</span>
@ -108,6 +109,8 @@
<span class="sd">&quot;&quot;&quot;Anonymous function used to extract a single primitive type from an object instance&quot;&quot;&quot;</span> <span class="sd">&quot;&quot;&quot;Anonymous function used to extract a single primitive type from an object instance&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span> <span class="o">=</span> <span class="kc">None</span> <span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span> <span class="o">=</span> <span class="kc">None</span>
<span class="sd">&quot;&quot;&quot;A ordered list of the fuzzy sets names, sorted by their middle point&quot;&quot;&quot;</span> <span class="sd">&quot;&quot;&quot;A ordered list of the fuzzy sets names, sorted by their middle point&quot;&quot;&quot;</span>
<span class="bp">self</span><span class="o">.</span><span class="n">kdtree</span> <span class="o">=</span> <span class="kc">None</span>
<span class="sd">&quot;&quot;&quot;A spatial index to help in fuzzyfication&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;preprocess&#39;</span><span class="p">,</span><span class="kc">True</span><span class="p">):</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;preprocess&#39;</span><span class="p">,</span><span class="kc">True</span><span class="p">):</span>
@ -179,8 +182,112 @@
<span class="sd"> &quot;&quot;&quot;</span> <span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]]</span></div> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">]]</span></div>
<div class="viewcode-block" id="Partitioner.build_index"><a class="viewcode-back" href="../../../pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.build_index">[docs]</a> <span class="k">def</span> <span class="nf">build_index</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="n">points</span> <span class="o">=</span> <span class="p">[]</span>
<span class="c1">#self.index = {}</span>
<span class="k">for</span> <span class="n">ct</span><span class="p">,</span> <span class="n">key</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">ordered_sets</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">sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span>
<span class="n">points</span><span class="o">.</span><span class="n">append</span><span class="p">([</span><span class="n">fset</span><span class="o">.</span><span class="n">lower</span><span class="p">,</span> <span class="n">fset</span><span class="o">.</span><span class="n">centroid</span><span class="p">,</span> <span class="n">fset</span><span class="o">.</span><span class="n">upper</span><span class="p">])</span>
<span class="c1">#self.index[ct] = fset.name</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="n">sys</span><span class="o">.</span><span class="n">setrecursionlimit</span><span class="p">(</span><span class="mi">100000</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">kdtree</span> <span class="o">=</span> <span class="n">KDTree</span><span class="p">(</span><span class="n">points</span><span class="p">)</span>
<span class="n">sys</span><span class="o">.</span><span class="n">setrecursionlimit</span><span class="p">(</span><span class="mi">1000</span><span class="p">)</span></div>
<div class="viewcode-block" id="Partitioner.fuzzyfy"><a class="viewcode-back" href="../../../pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.fuzzyfy">[docs]</a> <span class="k">def</span> <span class="nf">fuzzyfy</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="Partitioner.fuzzyfy"><a class="viewcode-back" href="../../../pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.fuzzyfy">[docs]</a> <span class="k">def</span> <span class="nf">fuzzyfy</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="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</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></div> <span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Fuzzyfy the input data according to this partitioner fuzzy sets.</span>
<span class="sd"> :param data: input value to be fuzzyfied</span>
<span class="sd"> :keyword alpha_cut: the minimal membership value to be considered on fuzzyfication (only for mode=&#39;sets&#39;)</span>
<span class="sd"> :keyword method: the fuzzyfication method (fuzzy: all fuzzy memberships, maximum: only the maximum membership)</span>
<span class="sd"> :keyword mode: the fuzzyfication mode (sets: return the fuzzy sets names, vector: return a vector with the membership</span>
<span class="sd"> values for all fuzzy sets, both: return a list with tuples (fuzzy set, membership value) )</span>
<span class="sd"> :returns a list with the fuzzyfied values, depending on the mode</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="p">(</span><span class="nb">list</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">ret</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">inst</span> <span class="ow">in</span> <span class="n">data</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">fuzzyfy</span><span class="p">(</span><span class="n">inst</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">append</span><span class="p">(</span><span class="n">mv</span><span class="p">)</span>
<span class="k">return</span> <span class="n">ret</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.</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;sets&#39;</span><span class="p">)</span>
<span class="n">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;method&#39;</span><span class="p">,</span> <span class="s1">&#39;fuzzy&#39;</span><span class="p">)</span>
<span class="n">nearest</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="s1">&#39;index&#39;</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">zeros</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="k">for</span> <span class="n">ix</span> <span class="ow">in</span> <span class="n">nearest</span><span class="p">:</span>
<span class="n">tmp</span> <span class="o">=</span> <span class="bp">self</span><span class="p">[</span><span class="n">ix</span><span class="p">]</span><span class="o">.</span><span class="n">membership</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
<span class="n">mv</span><span class="p">[</span><span class="n">ix</span><span class="p">]</span> <span class="o">=</span> <span class="n">tmp</span> <span class="k">if</span> <span class="n">tmp</span> <span class="o">&gt;=</span> <span class="n">alpha_cut</span> <span class="k">else</span> <span class="mf">0.</span>
<span class="n">ix</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">ravel</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">argwhere</span><span class="p">(</span><span class="n">mv</span> <span class="o">&gt;</span> <span class="mf">0.</span><span class="p">))</span>
<span class="k">if</span> <span class="n">ix</span><span class="o">.</span><span class="n">size</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
<span class="n">mv</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">check_bounds</span><span class="p">(</span><span class="n">data</span><span class="p">)]</span> <span class="o">=</span> <span class="mf">1.</span>
<span class="k">if</span> <span class="n">method</span> <span class="o">==</span> <span class="s1">&#39;fuzzy&#39;</span> <span class="ow">and</span> <span class="n">mode</span> <span class="o">==</span> <span class="s1">&#39;vector&#39;</span><span class="p">:</span>
<span class="k">return</span> <span class="n">mv</span>
<span class="k">elif</span> <span class="n">method</span> <span class="o">==</span> <span class="s1">&#39;fuzzy&#39;</span> <span class="ow">and</span> <span class="n">mode</span> <span class="o">==</span> <span class="s1">&#39;sets&#39;</span><span class="p">:</span>
<span class="n">ix</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">ravel</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">argwhere</span><span class="p">(</span><span class="n">mv</span> <span class="o">&gt;</span> <span class="mf">0.</span><span class="p">))</span>
<span class="n">sets</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span><span class="p">[</span><span class="n">i</span><span class="p">]</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">ix</span><span class="p">]</span>
<span class="k">return</span> <span class="n">sets</span>
<span class="k">elif</span> <span class="n">method</span> <span class="o">==</span> <span class="s1">&#39;maximum&#39;</span> <span class="ow">and</span> <span class="n">mode</span> <span class="o">==</span> <span class="s1">&#39;sets&#39;</span><span class="p">:</span>
<span class="n">mx</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">mv</span><span class="p">)</span>
<span class="n">ix</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">ravel</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">argwhere</span><span class="p">(</span><span class="n">mv</span> <span class="o">==</span> <span class="n">mx</span><span class="p">))</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span><span class="p">[</span><span class="n">ix</span><span class="p">[</span><span class="mi">0</span><span class="p">]]</span>
<span class="k">elif</span> <span class="n">mode</span> <span class="o">==</span> <span class="s1">&#39;both&#39;</span><span class="p">:</span>
<span class="n">ix</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">ravel</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">argwhere</span><span class="p">(</span><span class="n">mv</span> <span class="o">&gt;</span> <span class="mf">0.</span><span class="p">))</span>
<span class="n">sets</span> <span class="o">=</span> <span class="p">[(</span><span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="n">mv</span><span class="p">[</span><span class="n">i</span><span class="p">])</span> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="n">ix</span><span class="p">]</span>
<span class="k">return</span> <span class="n">sets</span></div>
<div class="viewcode-block" id="Partitioner.check_bounds"><a class="viewcode-back" href="../../../pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.check_bounds">[docs]</a> <span class="k">def</span> <span class="nf">check_bounds</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="sd">&#39;&#39;&#39;</span>
<span class="sd"> Check if the input data is outside the known Universe of Discourse and, if it is, round it to the closest</span>
<span class="sd"> fuzzy set.</span>
<span class="sd"> :param data: input data to be verified</span>
<span class="sd"> :return: the index of the closest fuzzy set when data is outside de universe of discourse or None if</span>
<span class="sd"> the data is inside the UoD.</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">if</span> <span class="n">data</span> <span class="o">&lt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">min</span><span class="p">:</span>
<span class="k">return</span> <span class="mi">0</span>
<span class="k">elif</span> <span class="n">data</span> <span class="o">&gt;</span> <span class="bp">self</span><span class="o">.</span><span class="n">max</span><span class="p">:</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitions</span><span class="o">-</span><span class="mi">1</span></div>
<div class="viewcode-block" id="Partitioner.search"><a class="viewcode-back" href="../../../pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.search">[docs]</a> <span class="k">def</span> <span class="nf">search</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="sd">&#39;&#39;&#39;</span>
<span class="sd"> Perform a search for the nearest fuzzy sets of the point &#39;data&#39;. This function were designed to work with several</span>
<span class="sd"> overlapped fuzzy sets.</span>
<span class="sd"> :param data: the value to search for the nearest fuzzy sets</span>
<span class="sd"> :param type: the return type: &#39;index&#39; for the fuzzy set indexes or &#39;name&#39; for fuzzy set names.</span>
<span class="sd"> :param results: the number of nearest fuzzy sets to return</span>
<span class="sd"> :return: a list with the nearest fuzzy sets</span>
<span class="sd"> &#39;&#39;&#39;</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">kdtree</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">build_index</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;index&#39;</span><span class="p">)</span>
<span class="n">results</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;results&#39;</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
<span class="n">_</span><span class="p">,</span> <span class="n">ix</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">kdtree</span><span class="o">.</span><span class="n">query</span><span class="p">([</span><span class="n">data</span><span class="p">,</span> <span class="n">data</span><span class="p">,</span> <span class="n">data</span><span class="p">],</span> <span class="n">results</span><span class="p">)</span>
<span class="k">if</span> <span class="nb">type</span> <span class="o">==</span> <span class="s1">&#39;name&#39;</span><span class="p">:</span>
<span class="k">return</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</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">sorted</span><span class="p">(</span><span class="n">ix</span><span class="p">)]</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">return</span> <span class="nb">sorted</span><span class="p">(</span><span class="n">ix</span><span class="p">)</span></div>
<div class="viewcode-block" id="Partitioner.plot"><a class="viewcode-back" href="../../../pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.plot">[docs]</a> <span class="k">def</span> <span class="nf">plot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ax</span><span class="p">,</span> <span class="n">rounding</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span> <div class="viewcode-block" id="Partitioner.plot"><a class="viewcode-back" href="../../../pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.plot">[docs]</a> <span class="k">def</span> <span class="nf">plot</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">ax</span><span class="p">,</span> <span class="n">rounding</span><span class="o">=</span><span class="mi">0</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span> <span class="sd">&quot;&quot;&quot;</span>
@ -240,7 +347,36 @@
<span class="sd"> :return: number of partitions</span> <span class="sd"> :return: number of partitions</span>
<span class="sd"> &quot;&quot;&quot;</span> <span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitions</span></div> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitions</span>
<span class="k">def</span> <span class="nf">__getitem__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">item</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Return a fuzzy set by its order or its name.</span>
<span class="sd"> :param item: If item is an integer then it represents the fuzzy set index (order), if it was a string then</span>
<span class="sd"> it represents the fuzzy set name.</span>
<span class="sd"> :return: the fuzzy set</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">item</span><span class="p">,</span> <span class="p">(</span><span class="nb">int</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">int</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">int8</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">int16</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">int32</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">int64</span><span class="p">)):</span>
<span class="k">if</span> <span class="n">item</span> <span class="o">&lt;</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">item</span> <span class="o">&gt;=</span> <span class="bp">self</span><span class="o">.</span><span class="n">partitions</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;The fuzzy set index must be between 0 and </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">partitions</span><span class="p">))</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span><span class="p">[</span><span class="n">item</span><span class="p">]]</span>
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="nb">str</span><span class="p">):</span>
<span class="k">if</span> <span class="n">item</span> <span class="ow">not</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">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;The fuzzy set with name </span><span class="si">{}</span><span class="s2"> does not exist.&quot;</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">item</span><span class="p">))</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="n">item</span><span class="p">]</span>
<span class="k">else</span><span class="p">:</span>
<span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;The parameter &#39;item&#39; must be an integer or a string and the value informed was </span><span class="si">{}</span><span class="s2"> of type </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">item</span><span class="p">,</span> <span class="nb">type</span><span class="p">(</span><span class="n">item</span><span class="p">)))</span>
<span class="k">def</span> <span class="nf">__iter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Iterate over the fuzzy sets, ordered by its midpoints.</span>
<span class="sd"> :return: An iterator over the fuzzy sets.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span><span class="p">:</span>
<span class="k">yield</span> <span class="bp">self</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span></div>
</pre></div> </pre></div>
</div> </div>

View File

@ -45,6 +45,22 @@ pyFTS.models.multivariate.flrg module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
pyFTS.models.multivariate.partitioner module
---------------------------------------------
.. automodule:: pyFTS.models.multivariate.partitioner
:members:
:undoc-members:
:show-inheritance:
pyFTS.models.multivariate.grid module
------------------------------------------
.. automodule:: pyFTS.models.multivariate.grid
:members:
:undoc-members:
:show-inheritance:
pyFTS.models.multivariate.mvfts module pyFTS.models.multivariate.mvfts module
-------------------------------------- --------------------------------------
@ -69,3 +85,11 @@ pyFTS.models.multivariate.cmvfts module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
pyFTS.models.multivariate.granular module
---------------------------------------------
.. automodule:: pyFTS.models.multivariate.granular
:members:
:undoc-members:
:show-inheritance:

View File

@ -154,6 +154,8 @@
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.honsfts.HighOrderNonStationaryFLRG.append_lhs">(pyFTS.models.nonstationary.honsfts.HighOrderNonStationaryFLRG method)</a> <li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.honsfts.HighOrderNonStationaryFLRG.append_lhs">(pyFTS.models.nonstationary.honsfts.HighOrderNonStationaryFLRG method)</a>
</li> </li>
</ul></li> </ul></li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.append_log">append_log() (pyFTS.common.fts.FTS method)</a>
</li>
<li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.EnsembleFTS.append_model">append_model() (pyFTS.models.ensemble.ensemble.EnsembleFTS method)</a> <li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.EnsembleFTS.append_model">append_model() (pyFTS.models.ensemble.ensemble.EnsembleFTS method)</a>
</li> </li>
<li><a href="pyFTS.common.html#pyFTS.common.flrg.FLRG.append_rhs">append_rhs() (pyFTS.common.flrg.FLRG method)</a> <li><a href="pyFTS.common.html#pyFTS.common.flrg.FLRG.append_rhs">append_rhs() (pyFTS.common.flrg.FLRG method)</a>
@ -278,11 +280,11 @@
</li> </li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.brier_score">brier_score() (in module pyFTS.benchmarks.Measures)</a> <li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Measures.brier_score">brier_score() (in module pyFTS.benchmarks.Measures)</a>
</li> </li>
</ul></td> <li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.grid.GridCluster.build">build() (pyFTS.models.multivariate.grid.GridCluster method)</a>
<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> <ul>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.variable.Variable.build">(pyFTS.models.multivariate.variable.Variable method)</a>
</li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.partitioners.PolynomialNonStationaryPartitioner.build">(pyFTS.models.nonstationary.partitioners.PolynomialNonStationaryPartitioner method)</a> <li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.partitioners.PolynomialNonStationaryPartitioner.build">(pyFTS.models.nonstationary.partitioners.PolynomialNonStationaryPartitioner method)</a>
</li> </li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.partitioners.SimpleNonStationaryPartitioner.build">(pyFTS.models.nonstationary.partitioners.SimpleNonStationaryPartitioner method)</a> <li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.partitioners.SimpleNonStationaryPartitioner.build">(pyFTS.models.nonstationary.partitioners.SimpleNonStationaryPartitioner method)</a>
@ -304,8 +306,16 @@
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.build">(pyFTS.partitioners.partitioner.Partitioner method)</a> <li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.build">(pyFTS.partitioners.partitioner.Partitioner method)</a>
</li> </li>
</ul></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><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.build_cdf_qtl">build_cdf_qtl() (pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution method)</a>
</li> </li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.build_index">build_index() (pyFTS.models.seasonal.partitioner.TimeGridPartitioner method)</a>
<ul>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.build_index">(pyFTS.partitioners.partitioner.Partitioner method)</a>
</li>
</ul></li>
<li><a href="pyFTS.common.html#pyFTS.common.tree.build_tree_without_order">build_tree_without_order() (in module pyFTS.common.tree)</a> <li><a href="pyFTS.common.html#pyFTS.common.tree.build_tree_without_order">build_tree_without_order() (in module pyFTS.common.tree)</a>
</li> </li>
</ul></td> </ul></td>
@ -330,6 +340,8 @@
<ul> <ul>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.common.check_bounds">(in module pyFTS.models.nonstationary.common)</a> <li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.common.check_bounds">(in module pyFTS.models.nonstationary.common)</a>
</li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.check_bounds">(pyFTS.partitioners.partitioner.Partitioner method)</a>
</li> </li>
</ul></li> </ul></li>
<li><a href="pyFTS.common.html#pyFTS.common.FuzzySet.check_bounds_index">check_bounds_index() (in module pyFTS.common.FuzzySet)</a> <li><a href="pyFTS.common.html#pyFTS.common.FuzzySet.check_bounds_index">check_bounds_index() (in module pyFTS.common.FuzzySet)</a>
@ -633,7 +645,11 @@
</li> </li>
</ul></li> </ul></li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.forecast_ahead_multivariate">forecast_ahead_multivariate() (pyFTS.common.fts.FTS method)</a> <li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.forecast_ahead_multivariate">forecast_ahead_multivariate() (pyFTS.common.fts.FTS method)</a>
<ul>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.forecast_ahead_multivariate">(pyFTS.models.multivariate.cmvfts.ClusteredMVFTS method)</a>
</li> </li>
</ul></li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.arima.ARIMA.forecast_distribution">forecast_distribution() (pyFTS.benchmarks.arima.ARIMA method)</a> <li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.arima.ARIMA.forecast_distribution">forecast_distribution() (pyFTS.benchmarks.arima.ARIMA method)</a>
<ul> <ul>
@ -710,6 +726,8 @@
<ul> <ul>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.fuzzyfy">(pyFTS.models.multivariate.cmvfts.ClusteredMVFTS method)</a> <li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.fuzzyfy">(pyFTS.models.multivariate.cmvfts.ClusteredMVFTS method)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.grid.IncrementalGridCluster.fuzzyfy">(pyFTS.models.multivariate.grid.IncrementalGridCluster method)</a>
</li> </li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.fuzzyfy">(pyFTS.partitioners.partitioner.Partitioner method)</a> <li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.fuzzyfy">(pyFTS.partitioners.partitioner.Partitioner method)</a>
</li> </li>
@ -1091,6 +1109,10 @@
<li><a href="pyFTS.common.html#pyFTS.common.tree.FLRGTreeNode.getStr">getStr() (pyFTS.common.tree.FLRGTreeNode method)</a> <li><a href="pyFTS.common.html#pyFTS.common.tree.FLRGTreeNode.getStr">getStr() (pyFTS.common.tree.FLRGTreeNode method)</a>
</li> </li>
<li><a href="pyFTS.common.html#pyFTS.common.FuzzySet.grant_bounds">grant_bounds() (in module pyFTS.common.FuzzySet)</a> <li><a href="pyFTS.common.html#pyFTS.common.FuzzySet.grant_bounds">grant_bounds() (in module pyFTS.common.FuzzySet)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.granular.GranularWMVFTS">GranularWMVFTS (class in pyFTS.models.multivariate.granular)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.grid.GridCluster">GridCluster (class in pyFTS.models.multivariate.grid)</a>
</li> </li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.Grid.GridPartitioner">GridPartitioner (class in pyFTS.partitioners.Grid)</a> <li><a href="pyFTS.partitioners.html#pyFTS.partitioners.Grid.GridPartitioner">GridPartitioner (class in pyFTS.partitioners.Grid)</a>
</li> </li>
@ -1132,7 +1154,7 @@
</li> </li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.honsfts.HighOrderNonStationaryFTS">HighOrderNonStationaryFTS (class in pyFTS.models.nonstationary.honsfts)</a> <li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.honsfts.HighOrderNonStationaryFTS">HighOrderNonStationaryFTS (class in pyFTS.models.nonstationary.honsfts)</a>
</li> </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><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.hour">hour (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li> </li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.hour_of_month">hour_of_month (pyFTS.models.seasonal.common.DateTime attribute)</a> <li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.hour_of_month">hour_of_month (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li> </li>
@ -1153,8 +1175,12 @@
<li><a href="pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFTS">ImprovedWeightedFTS (class in pyFTS.models.ismailefendi)</a> <li><a href="pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFTS">ImprovedWeightedFTS (class in pyFTS.models.ismailefendi)</a>
</li> </li>
<li><a href="pyFTS.data.html#pyFTS.data.artificial.SignalEmulator.incremental_gaussian">incremental_gaussian() (pyFTS.data.artificial.SignalEmulator method)</a> <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.multivariate.html#pyFTS.models.multivariate.grid.IncrementalGridCluster.incremental_search">incremental_search() (pyFTS.models.multivariate.grid.IncrementalGridCluster method)</a>
</li> </li>
<li><a href="pyFTS.models.incremental.html#pyFTS.models.incremental.IncrementalEnsemble.IncrementalEnsembleFTS">IncrementalEnsembleFTS (class in pyFTS.models.incremental.IncrementalEnsemble)</a> <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.models.multivariate.html#pyFTS.models.multivariate.grid.IncrementalGridCluster">IncrementalGridCluster (class in pyFTS.models.multivariate.grid)</a>
</li> </li>
<li><a href="pyFTS.common.html#pyFTS.common.FLR.IndexedFLR.index">index (pyFTS.common.FLR.IndexedFLR attribute)</a> <li><a href="pyFTS.common.html#pyFTS.common.FLR.IndexedFLR.index">index (pyFTS.common.FLR.IndexedFLR attribute)</a>
</li> </li>
@ -1175,11 +1201,11 @@
<li><a href="pyFTS.common.html#pyFTS.common.SortedCollection.SortedCollection.insert_right">insert_right() (pyFTS.common.SortedCollection.SortedCollection method)</a> <li><a href="pyFTS.common.html#pyFTS.common.SortedCollection.SortedCollection.insert_right">insert_right() (pyFTS.common.SortedCollection.SortedCollection method)</a>
</li> </li>
<li><a href="pyFTS.common.html#pyFTS.common.SortedCollection.SortedCollection.inside">inside() (pyFTS.common.SortedCollection.SortedCollection method)</a> <li><a href="pyFTS.common.html#pyFTS.common.SortedCollection.SortedCollection.inside">inside() (pyFTS.common.SortedCollection.SortedCollection method)</a>
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Util.interval_dataframe_analytic_columns">interval_dataframe_analytic_columns() (in module pyFTS.benchmarks.Util)</a>
</li> </li>
</ul></td> </ul></td>
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Util.interval_dataframe_analytic_columns">interval_dataframe_analytic_columns() (in module pyFTS.benchmarks.Util)</a>
</li>
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.Util.interval_dataframe_synthetic_columns">interval_dataframe_synthetic_columns() (in module pyFTS.benchmarks.Util)</a> <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>
<li><a href="pyFTS.models.html#pyFTS.models.pwfts.ProbabilisticWeightedFTS.interval_heuristic">interval_heuristic() (pyFTS.models.pwfts.ProbabilisticWeightedFTS method)</a> <li><a href="pyFTS.models.html#pyFTS.models.pwfts.ProbabilisticWeightedFTS.interval_heuristic">interval_heuristic() (pyFTS.models.pwfts.ProbabilisticWeightedFTS method)</a>
@ -1218,6 +1244,8 @@
<h2 id="K">K</h2> <h2 id="K">K</h2>
<table style="width: 100%" class="indextable genindextable"><tr> <table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.kdtree">kdtree (pyFTS.partitioners.partitioner.Partitioner attribute)</a>
</li>
<li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.kde.KernelSmoothing.kernel">kernel (pyFTS.probabilistic.kde.KernelSmoothing attribute)</a> <li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.kde.KernelSmoothing.kernel">kernel (pyFTS.probabilistic.kde.KernelSmoothing attribute)</a>
</li> </li>
<li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.kde.KernelSmoothing.kernel_function">kernel_function() (pyFTS.probabilistic.kde.KernelSmoothing method)</a> <li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.kde.KernelSmoothing.kernel_function">kernel_function() (pyFTS.probabilistic.kde.KernelSmoothing method)</a>
@ -1269,6 +1297,8 @@
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.common.FuzzySet.location">location (pyFTS.models.nonstationary.common.FuzzySet attribute)</a> <li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.common.FuzzySet.location">location (pyFTS.models.nonstationary.common.FuzzySet attribute)</a>
</li> </li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.common.FuzzySet.location_params">location_params (pyFTS.models.nonstationary.common.FuzzySet attribute)</a> <li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.common.FuzzySet.location_params">location_params (pyFTS.models.nonstationary.common.FuzzySet attribute)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.log">log (pyFTS.common.fts.FTS attribute)</a>
</li> </li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.lower_set">lower_set() (pyFTS.partitioners.partitioner.Partitioner method)</a> <li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.lower_set">lower_set() (pyFTS.partitioners.partitioner.Partitioner method)</a>
</li> </li>
@ -1308,15 +1338,15 @@
</li> </li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.merge">merge() (pyFTS.common.fts.FTS method)</a> <li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.merge">merge() (pyFTS.common.fts.FTS method)</a>
</li> </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><a href="pyFTS.common.html#pyFTS.common.FuzzySet.FuzzySet.mf">mf (pyFTS.common.FuzzySet.FuzzySet attribute)</a>
</li> </li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.min_order">min_order (pyFTS.common.fts.FTS attribute)</a> <li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.min_order">min_order (pyFTS.common.fts.FTS attribute)</a>
</li> </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> <li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.minute">minute (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li> </li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.minute_of_hour">minute_of_hour (pyFTS.models.seasonal.common.DateTime attribute)</a> <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>
</li> </li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.minute_of_month">minute_of_month (pyFTS.models.seasonal.common.DateTime attribute)</a> <li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.minute_of_month">minute_of_month (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li> </li>
@ -1328,6 +1358,8 @@
<ul> <ul>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.model">(pyFTS.models.multivariate.cmvfts.ClusteredMVFTS attribute)</a> <li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.model">(pyFTS.models.multivariate.cmvfts.ClusteredMVFTS attribute)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.granular.GranularWMVFTS.model">(pyFTS.models.multivariate.granular.GranularWMVFTS attribute)</a>
</li> </li>
</ul></li> </ul></li>
<li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.EnsembleFTS.models">models (pyFTS.models.ensemble.ensemble.EnsembleFTS attribute)</a> <li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.EnsembleFTS.models">models (pyFTS.models.ensemble.ensemble.EnsembleFTS attribute)</a>
@ -1575,6 +1607,8 @@
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.benchmarks.process_probabilistic_jobs">process_probabilistic_jobs() (in module pyFTS.benchmarks.benchmarks)</a> <li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.benchmarks.process_probabilistic_jobs">process_probabilistic_jobs() (in module pyFTS.benchmarks.benchmarks)</a>
</li> </li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.product_dict">product_dict() (in module pyFTS.models.multivariate.mvfts)</a> <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.models.multivariate.html#pyFTS.models.multivariate.grid.IncrementalGridCluster.prune">prune() (pyFTS.models.multivariate.grid.IncrementalGridCluster method)</a>
</li> </li>
<li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.pseudologlikelihood">pseudologlikelihood() (pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution method)</a> <li><a href="pyFTS.probabilistic.html#pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution.pseudologlikelihood">pseudologlikelihood() (pyFTS.probabilistic.ProbabilityDistribution.ProbabilityDistribution method)</a>
</li> </li>
@ -1600,10 +1634,10 @@
</li> </li>
<li><a href="pyFTS.common.html#module-pyFTS.common">pyFTS.common (module)</a> <li><a href="pyFTS.common.html#module-pyFTS.common">pyFTS.common (module)</a>
</li> </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><a href="pyFTS.common.html#module-pyFTS.common.Composite">pyFTS.common.Composite (module)</a>
</li> </li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.common.html#module-pyFTS.common.FLR">pyFTS.common.FLR (module)</a> <li><a href="pyFTS.common.html#module-pyFTS.common.FLR">pyFTS.common.FLR (module)</a>
</li> </li>
<li><a href="pyFTS.common.html#module-pyFTS.common.flrg">pyFTS.common.flrg (module)</a> <li><a href="pyFTS.common.html#module-pyFTS.common.flrg">pyFTS.common.flrg (module)</a>
@ -1713,6 +1747,10 @@
<li><a href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.FLR">pyFTS.models.multivariate.FLR (module)</a> <li><a href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.FLR">pyFTS.models.multivariate.FLR (module)</a>
</li> </li>
<li><a href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.flrg">pyFTS.models.multivariate.flrg (module)</a> <li><a href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.flrg">pyFTS.models.multivariate.flrg (module)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.granular">pyFTS.models.multivariate.granular (module)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.grid">pyFTS.models.multivariate.grid (module)</a>
</li> </li>
<li><a href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.mvfts">pyFTS.models.multivariate.mvfts (module)</a> <li><a href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.mvfts">pyFTS.models.multivariate.mvfts (module)</a>
</li> </li>
@ -1874,6 +1912,12 @@
</li> </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><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.partitioners.PolynomialNonStationaryPartitioner.scale_up">scale_up() (pyFTS.models.nonstationary.partitioners.PolynomialNonStationaryPartitioner method)</a>
</li> </li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.search">search() (pyFTS.models.seasonal.partitioner.TimeGridPartitioner method)</a>
<ul>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.search">(pyFTS.partitioners.partitioner.Partitioner method)</a>
</li>
</ul></li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.season">season (pyFTS.models.seasonal.partitioner.TimeGridPartitioner attribute)</a> <li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.season">season (pyFTS.models.seasonal.partitioner.TimeGridPartitioner attribute)</a>
</li> </li>
<li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.multiseasonal.SeasonalEnsembleFTS">SeasonalEnsembleFTS (class in pyFTS.models.ensemble.multiseasonal)</a> <li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.multiseasonal.SeasonalEnsembleFTS">SeasonalEnsembleFTS (class in pyFTS.models.ensemble.multiseasonal)</a>
@ -1883,8 +1927,6 @@
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.sfts.SeasonalFTS">SeasonalFTS (class in pyFTS.models.seasonal.sfts)</a> <li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.sfts.SeasonalFTS">SeasonalFTS (class in pyFTS.models.seasonal.sfts)</a>
</li> </li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.SeasonalIndexer.SeasonalIndexer">SeasonalIndexer (class in pyFTS.models.seasonal.SeasonalIndexer)</a> <li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.SeasonalIndexer.SeasonalIndexer">SeasonalIndexer (class in pyFTS.models.seasonal.SeasonalIndexer)</a>
</li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.second">second (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li> </li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.second_of_day">second_of_day (pyFTS.models.seasonal.common.DateTime attribute)</a> <li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.common.DateTime.second_of_day">second_of_day (pyFTS.models.seasonal.common.DateTime attribute)</a>
</li> </li>
@ -1915,11 +1957,11 @@
<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> <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>
</li> </li>
<li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.AllMethodEnsembleFTS.set_transformations">set_transformations() (pyFTS.models.ensemble.ensemble.AllMethodEnsembleFTS method)</a> <li><a href="pyFTS.models.ensemble.html#pyFTS.models.ensemble.ensemble.AllMethodEnsembleFTS.set_transformations">set_transformations() (pyFTS.models.ensemble.ensemble.AllMethodEnsembleFTS method)</a>
</li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.setnames">setnames (pyFTS.partitioners.partitioner.Partitioner attribute)</a>
</li> </li>
</ul></td> </ul></td>
<td style="width: 33%; vertical-align: top;"><ul> <td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.partitioner.Partitioner.setnames">setnames (pyFTS.partitioners.partitioner.Partitioner attribute)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.sets">sets (pyFTS.common.fts.FTS attribute)</a> <li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.sets">sets (pyFTS.common.fts.FTS attribute)</a>
</li> </li>
<li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.share_parameters">share_parameters() (in module pyFTS.distributed.spark)</a> <li><a href="pyFTS.distributed.html#pyFTS.distributed.spark.share_parameters">share_parameters() (in module pyFTS.distributed.spark)</a>
@ -2020,6 +2062,8 @@
<li><a href="pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFTS.train">(pyFTS.models.ismailefendi.ImprovedWeightedFTS method)</a> <li><a href="pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFTS.train">(pyFTS.models.ismailefendi.ImprovedWeightedFTS method)</a>
</li> </li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.train">(pyFTS.models.multivariate.cmvfts.ClusteredMVFTS method)</a> <li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.train">(pyFTS.models.multivariate.cmvfts.ClusteredMVFTS method)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.granular.GranularWMVFTS.train">(pyFTS.models.multivariate.granular.GranularWMVFTS method)</a>
</li> </li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.train">(pyFTS.models.multivariate.mvfts.MVFTS method)</a> <li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.train">(pyFTS.models.multivariate.mvfts.MVFTS method)</a>
</li> </li>

Binary file not shown.

View File

@ -420,6 +420,16 @@
<td>&#160;&#160;&#160; <td>&#160;&#160;&#160;
<a href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.flrg"><code class="xref">pyFTS.models.multivariate.flrg</code></a></td><td> <a href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.flrg"><code class="xref">pyFTS.models.multivariate.flrg</code></a></td><td>
<em></em></td></tr> <em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.granular"><code class="xref">pyFTS.models.multivariate.granular</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.grid"><code class="xref">pyFTS.models.multivariate.grid</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1"> <tr class="cg-1">
<td></td> <td></td>
<td>&#160;&#160;&#160; <td>&#160;&#160;&#160;

View File

@ -452,8 +452,8 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<p>values for all fuzzy sets, both: return a list with tuples (fuzzy set, membership value) )</p> <p>values for all fuzzy sets, both: return a list with tuples (fuzzy set, membership value) )
<p>:returns a list with the fuzzyfied values, depending on the mode</p> :returns a list with the fuzzyfied values, depending on the mode</p>
</dd></dl> </dd></dl>
<dl class="function"> <dl class="function">
@ -1554,6 +1554,11 @@ when the LHS pattern is identified on time t.</p>
<dd><p>A float with the minimal membership to be considered on fuzzyfication process</p> <dd><p>A float with the minimal membership to be considered on fuzzyfication process</p>
</dd></dl> </dd></dl>
<dl class="method">
<dt id="pyFTS.common.fts.FTS.append_log">
<code class="descname">append_log</code><span class="sig-paren">(</span><em>operation</em>, <em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/fts.html#FTS.append_log"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.fts.FTS.append_log" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method"> <dl class="method">
<dt id="pyFTS.common.fts.FTS.append_rule"> <dt id="pyFTS.common.fts.FTS.append_rule">
<code class="descname">append_rule</code><span class="sig-paren">(</span><em>flrg</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/fts.html#FTS.append_rule"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.fts.FTS.append_rule" title="Permalink to this definition"></a></dt> <code class="descname">append_rule</code><span class="sig-paren">(</span><em>flrg</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/fts.html#FTS.append_rule"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.fts.FTS.append_rule" title="Permalink to this definition"></a></dt>
@ -1951,6 +1956,11 @@ a monovariate method, default: False</p>
</table> </table>
</dd></dl> </dd></dl>
<dl class="attribute">
<dt id="pyFTS.common.fts.FTS.log">
<code class="descname">log</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.common.fts.FTS.log" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="pyFTS.common.fts.FTS.max_lag"> <dt id="pyFTS.common.fts.FTS.max_lag">
<code class="descname">max_lag</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.common.fts.FTS.max_lag" title="Permalink to this definition"></a></dt> <code class="descname">max_lag</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.common.fts.FTS.max_lag" title="Permalink to this definition"></a></dt>

View File

@ -204,9 +204,11 @@
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.common">pyFTS.models.multivariate.common module</a></li> <li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.common">pyFTS.models.multivariate.common module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.variable">pyFTS.models.multivariate.variable module</a></li> <li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.variable">pyFTS.models.multivariate.variable module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.flrg">pyFTS.models.multivariate.flrg module</a></li> <li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.flrg">pyFTS.models.multivariate.flrg module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#pyfts-models-multivariate-partitioner-module">pyFTS.models.multivariate.partitioner module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.mvfts">pyFTS.models.multivariate.mvfts module</a></li> <li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.mvfts">pyFTS.models.multivariate.mvfts module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.wmvfts">pyFTS.models.multivariate.wmvfts module</a></li> <li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.wmvfts">pyFTS.models.multivariate.wmvfts module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.cmvfts">pyFTS.models.multivariate.cmvfts module</a></li> <li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.cmvfts">pyFTS.models.multivariate.cmvfts module</a></li>
<li class="toctree-l4"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.granular">pyFTS.models.multivariate.granular module</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l3"><a class="reference internal" href="pyFTS.models.nonstationary.html">pyFTS.models.nonstationary package</a><ul> <li class="toctree-l3"><a class="reference internal" href="pyFTS.models.nonstationary.html">pyFTS.models.nonstationary package</a><ul>

View File

@ -144,9 +144,11 @@
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.common">pyFTS.models.multivariate.common module</a></li> <li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.common">pyFTS.models.multivariate.common module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.variable">pyFTS.models.multivariate.variable module</a></li> <li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.variable">pyFTS.models.multivariate.variable module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.flrg">pyFTS.models.multivariate.flrg module</a></li> <li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.flrg">pyFTS.models.multivariate.flrg module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#pyfts-models-multivariate-partitioner-module">pyFTS.models.multivariate.partitioner module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.mvfts">pyFTS.models.multivariate.mvfts module</a></li> <li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.mvfts">pyFTS.models.multivariate.mvfts module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.wmvfts">pyFTS.models.multivariate.wmvfts module</a></li> <li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.wmvfts">pyFTS.models.multivariate.wmvfts module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.cmvfts">pyFTS.models.multivariate.cmvfts module</a></li> <li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.cmvfts">pyFTS.models.multivariate.cmvfts module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.granular">pyFTS.models.multivariate.granular module</a></li>
</ul> </ul>
</li> </li>
<li class="toctree-l1"><a class="reference internal" href="pyFTS.models.nonstationary.html">pyFTS.models.nonstationary package</a><ul> <li class="toctree-l1"><a class="reference internal" href="pyFTS.models.nonstationary.html">pyFTS.models.nonstationary package</a><ul>

View File

@ -70,9 +70,11 @@
<li><a class="reference internal" href="#module-pyFTS.models.multivariate.common">pyFTS.models.multivariate.common module</a></li> <li><a class="reference internal" href="#module-pyFTS.models.multivariate.common">pyFTS.models.multivariate.common module</a></li>
<li><a class="reference internal" href="#module-pyFTS.models.multivariate.variable">pyFTS.models.multivariate.variable module</a></li> <li><a class="reference internal" href="#module-pyFTS.models.multivariate.variable">pyFTS.models.multivariate.variable module</a></li>
<li><a class="reference internal" href="#module-pyFTS.models.multivariate.flrg">pyFTS.models.multivariate.flrg module</a></li> <li><a class="reference internal" href="#module-pyFTS.models.multivariate.flrg">pyFTS.models.multivariate.flrg module</a></li>
<li><a class="reference internal" href="#pyfts-models-multivariate-partitioner-module">pyFTS.models.multivariate.partitioner module</a></li>
<li><a class="reference internal" href="#module-pyFTS.models.multivariate.mvfts">pyFTS.models.multivariate.mvfts module</a></li> <li><a class="reference internal" href="#module-pyFTS.models.multivariate.mvfts">pyFTS.models.multivariate.mvfts module</a></li>
<li><a class="reference internal" href="#module-pyFTS.models.multivariate.wmvfts">pyFTS.models.multivariate.wmvfts module</a></li> <li><a class="reference internal" href="#module-pyFTS.models.multivariate.wmvfts">pyFTS.models.multivariate.wmvfts module</a></li>
<li><a class="reference internal" href="#module-pyFTS.models.multivariate.cmvfts">pyFTS.models.multivariate.cmvfts module</a></li> <li><a class="reference internal" href="#module-pyFTS.models.multivariate.cmvfts">pyFTS.models.multivariate.cmvfts module</a></li>
<li><a class="reference internal" href="#module-pyFTS.models.multivariate.granular">pyFTS.models.multivariate.granular module</a></li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -354,6 +356,73 @@ transformations and partitioners.</p>
</dd></dl> </dd></dl>
</div>
<div class="section" id="pyfts-models-multivariate-partitioner-module">
<h2>pyFTS.models.multivariate.partitioner module<a class="headerlink" href="#pyfts-models-multivariate-partitioner-module" title="Permalink to this headline"></a></h2>
<hr class="docutils" />
<span class="target" id="module-pyFTS.models.multivariate.grid"></span><dl class="class">
<dt id="pyFTS.models.multivariate.grid.GridCluster">
<em class="property">class </em><code class="descclassname">pyFTS.models.multivariate.grid.</code><code class="descname">GridCluster</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/grid.html#GridCluster"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.grid.GridCluster" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pyFTS.models.multivariate.partitioner.MultivariatePartitioner</span></code></p>
<p>A cartesian product of all fuzzy sets of all variables</p>
<dl class="method">
<dt id="pyFTS.models.multivariate.grid.GridCluster.build">
<code class="descname">build</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/grid.html#GridCluster.build"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.grid.GridCluster.build" title="Permalink to this definition"></a></dt>
<dd><p>Perform the partitioning of the Universe of Discourse</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"><strong>data</strong> training data</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pyFTS.models.multivariate.grid.IncrementalGridCluster">
<em class="property">class </em><code class="descclassname">pyFTS.models.multivariate.grid.</code><code class="descname">IncrementalGridCluster</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/grid.html#IncrementalGridCluster"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.grid.IncrementalGridCluster" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">pyFTS.models.multivariate.partitioner.MultivariatePartitioner</span></code></p>
<p>Create combinations of fuzzy sets of the variables on demand, incrementally increasing the
multivariate fuzzy set base.</p>
<dl class="method">
<dt id="pyFTS.models.multivariate.grid.IncrementalGridCluster.fuzzyfy">
<code class="descname">fuzzyfy</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/grid.html#IncrementalGridCluster.fuzzyfy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.grid.IncrementalGridCluster.fuzzyfy" title="Permalink to this definition"></a></dt>
<dd><p>Fuzzyfy the input data according to this partitioner fuzzy sets.</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> input value to be fuzzyfied</li>
<li><strong>alpha_cut</strong> the minimal membership value to be considered on fuzzyfication (only for mode=sets)</li>
<li><strong>method</strong> the fuzzyfication method (fuzzy: all fuzzy memberships, maximum: only the maximum membership)</li>
<li><strong>mode</strong> the fuzzyfication mode (sets: return the fuzzy sets names, vector: return a vector with the membership</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>values for all fuzzy sets, both: return a list with tuples (fuzzy set, membership value) )</p>
<p>:returns a list with the fuzzyfied values, depending on the mode</p>
</dd></dl>
<dl class="method">
<dt id="pyFTS.models.multivariate.grid.IncrementalGridCluster.incremental_search">
<code class="descname">incremental_search</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/grid.html#IncrementalGridCluster.incremental_search"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.grid.IncrementalGridCluster.incremental_search" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pyFTS.models.multivariate.grid.IncrementalGridCluster.prune">
<code class="descname">prune</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/grid.html#IncrementalGridCluster.prune"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.grid.IncrementalGridCluster.prune" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div> </div>
<div class="section" id="module-pyFTS.models.multivariate.mvfts"> <div class="section" id="module-pyFTS.models.multivariate.mvfts">
<span id="pyfts-models-multivariate-mvfts-module"></span><h2>pyFTS.models.multivariate.mvfts module<a class="headerlink" href="#module-pyFTS.models.multivariate.mvfts" title="Permalink to this headline"></a></h2> <span id="pyfts-models-multivariate-mvfts-module"></span><h2>pyFTS.models.multivariate.mvfts module<a class="headerlink" href="#module-pyFTS.models.multivariate.mvfts" title="Permalink to this headline"></a></h2>
@ -614,7 +683,7 @@ transformations and partitioners.</p>
<dt id="pyFTS.models.multivariate.cmvfts.ClusteredMVFTS"> <dt id="pyFTS.models.multivariate.cmvfts.ClusteredMVFTS">
<em class="property">class </em><code class="descclassname">pyFTS.models.multivariate.cmvfts.</code><code class="descname">ClusteredMVFTS</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/cmvfts.html#ClusteredMVFTS"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS" title="Permalink to this definition"></a></dt> <em class="property">class </em><code class="descclassname">pyFTS.models.multivariate.cmvfts.</code><code class="descname">ClusteredMVFTS</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/cmvfts.html#ClusteredMVFTS"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#pyFTS.models.multivariate.mvfts.MVFTS" title="pyFTS.models.multivariate.mvfts.MVFTS"><code class="xref py py-class docutils literal notranslate"><span class="pre">pyFTS.models.multivariate.mvfts.MVFTS</span></code></a></p> <dd><p>Bases: <a class="reference internal" href="#pyFTS.models.multivariate.mvfts.MVFTS" title="pyFTS.models.multivariate.mvfts.MVFTS"><code class="xref py py-class docutils literal notranslate"><span class="pre">pyFTS.models.multivariate.mvfts.MVFTS</span></code></a></p>
<p>Meta model for multivariate, high order, clustered multivariate FTS</p> <p>Meta model for high order, clustered multivariate FTS</p>
<dl class="method"> <dl class="method">
<dt id="pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.check_data"> <dt id="pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.check_data">
<code class="descname">check_data</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/cmvfts.html#ClusteredMVFTS.check_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.check_data" title="Permalink to this definition"></a></dt> <code class="descname">check_data</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/cmvfts.html#ClusteredMVFTS.check_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.check_data" title="Permalink to this definition"></a></dt>
@ -641,6 +710,28 @@ transformations and partitioners.</p>
</table> </table>
</dd></dl> </dd></dl>
<dl class="method">
<dt id="pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.forecast_ahead_multivariate">
<code class="descname">forecast_ahead_multivariate</code><span class="sig-paren">(</span><em>data</em>, <em>steps</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/cmvfts.html#ClusteredMVFTS.forecast_ahead_multivariate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.forecast_ahead_multivariate" title="Permalink to this definition"></a></dt>
<dd><p>Multivariate forecast n 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> Pandas dataframe with one column for each variable and with the minimal length equal to the max_lag of the model</li>
<li><strong>steps</strong> the number of steps ahead to forecast</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 Pandas Dataframe object representing the forecasted values for each variable</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method"> <dl class="method">
<dt id="pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.forecast_multivariate"> <dt id="pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.forecast_multivariate">
<code class="descname">forecast_multivariate</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/cmvfts.html#ClusteredMVFTS.forecast_multivariate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.forecast_multivariate" title="Permalink to this definition"></a></dt> <code class="descname">forecast_multivariate</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/cmvfts.html#ClusteredMVFTS.forecast_multivariate"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS.forecast_multivariate" title="Permalink to this definition"></a></dt>
@ -705,6 +796,40 @@ transformations and partitioners.</p>
</dd></dl> </dd></dl>
</div>
<div class="section" id="module-pyFTS.models.multivariate.granular">
<span id="pyfts-models-multivariate-granular-module"></span><h2>pyFTS.models.multivariate.granular module<a class="headerlink" href="#module-pyFTS.models.multivariate.granular" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="pyFTS.models.multivariate.granular.GranularWMVFTS">
<em class="property">class </em><code class="descclassname">pyFTS.models.multivariate.granular.</code><code class="descname">GranularWMVFTS</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/granular.html#GranularWMVFTS"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.granular.GranularWMVFTS" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#pyFTS.models.multivariate.cmvfts.ClusteredMVFTS" title="pyFTS.models.multivariate.cmvfts.ClusteredMVFTS"><code class="xref py py-class docutils literal notranslate"><span class="pre">pyFTS.models.multivariate.cmvfts.ClusteredMVFTS</span></code></a></p>
<p>Granular multivariate weighted high order FTS</p>
<dl class="attribute">
<dt id="pyFTS.models.multivariate.granular.GranularWMVFTS.model">
<code class="descname">model</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.models.multivariate.granular.GranularWMVFTS.model" title="Permalink to this definition"></a></dt>
<dd><p>The most recent trained model</p>
</dd></dl>
<dl class="method">
<dt id="pyFTS.models.multivariate.granular.GranularWMVFTS.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/multivariate/granular.html#GranularWMVFTS.train"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.multivariate.granular.GranularWMVFTS.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>
</dd></dl>
</div> </div>
</div> </div>

View File

@ -381,8 +381,8 @@
<dd></dd></dl> <dd></dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="pyFTS.models.seasonal.common.DateTime.hour_of_day"> <dt id="pyFTS.models.seasonal.common.DateTime.hour">
<code class="descname">hour_of_day</code><em class="property"> = 24</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.hour_of_day" title="Permalink to this definition"></a></dt> <code class="descname">hour</code><em class="property"> = 24</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.hour" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="attribute"> <dl class="attribute">
@ -401,13 +401,13 @@
<dd></dd></dl> <dd></dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="pyFTS.models.seasonal.common.DateTime.minute_of_day"> <dt id="pyFTS.models.seasonal.common.DateTime.minute">
<code class="descname">minute_of_day</code><em class="property"> = 1440</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.minute_of_day" title="Permalink to this definition"></a></dt> <code class="descname">minute</code><em class="property"> = 60</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.minute" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="pyFTS.models.seasonal.common.DateTime.minute_of_hour"> <dt id="pyFTS.models.seasonal.common.DateTime.minute_of_day">
<code class="descname">minute_of_hour</code><em class="property"> = 60</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.minute_of_hour" title="Permalink to this definition"></a></dt> <code class="descname">minute_of_day</code><em class="property"> = 1440</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.minute_of_day" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd></dd></dl>
<dl class="attribute"> <dl class="attribute">
@ -435,11 +435,6 @@
<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> <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> <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>
<dd></dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="pyFTS.models.seasonal.common.DateTime.second_of_day"> <dt id="pyFTS.models.seasonal.common.DateTime.second_of_day">
<code class="descname">second_of_day</code><em class="property"> = 86400</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.second_of_day" title="Permalink to this definition"></a></dt> <code class="descname">second_of_day</code><em class="property"> = 86400</em><a class="headerlink" href="#pyFTS.models.seasonal.common.DateTime.second_of_day" title="Permalink to this definition"></a></dt>
@ -600,6 +595,11 @@
</table> </table>
</dd></dl> </dd></dl>
<dl class="method">
<dt id="pyFTS.models.seasonal.partitioner.TimeGridPartitioner.build_index">
<code class="descname">build_index</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/seasonal/partitioner.html#TimeGridPartitioner.build_index"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.build_index" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="pyFTS.models.seasonal.partitioner.TimeGridPartitioner.mask"> <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> <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>
@ -614,6 +614,29 @@
:return:</p> :return:</p>
</dd></dl> </dd></dl>
<dl class="method">
<dt id="pyFTS.models.seasonal.partitioner.TimeGridPartitioner.search">
<code class="descname">search</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/seasonal/partitioner.html#TimeGridPartitioner.search"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.search" title="Permalink to this definition"></a></dt>
<dd><p>Perform a search for the nearest fuzzy sets of the point data. This function were designed to work with several
overlapped fuzzy sets.</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> the value to search for the nearest fuzzy sets</li>
<li><strong>type</strong> the return type: index for the fuzzy set indexes or name for fuzzy set names.</li>
<li><strong>results</strong> the number of nearest fuzzy sets to return</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 nearest fuzzy sets</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="pyFTS.models.seasonal.partitioner.TimeGridPartitioner.season"> <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> <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>

View File

@ -144,6 +144,29 @@
</table> </table>
</dd></dl> </dd></dl>
<dl class="method">
<dt id="pyFTS.partitioners.partitioner.Partitioner.build_index">
<code class="descname">build_index</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/partitioners/partitioner.html#Partitioner.build_index"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.partitioners.partitioner.Partitioner.build_index" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="pyFTS.partitioners.partitioner.Partitioner.check_bounds">
<code class="descname">check_bounds</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/partitioners/partitioner.html#Partitioner.check_bounds"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.partitioners.partitioner.Partitioner.check_bounds" title="Permalink to this definition"></a></dt>
<dd><p>Check if the input data is outside the known Universe of Discourse and, if it is, round it to the closest
fuzzy set.</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"><strong>data</strong> input data to be verified</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">the index of the closest fuzzy set when data is outside de universe of discourse or None if</td>
</tr>
</tbody>
</table>
<p>the data is inside the UoD.</p>
</dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="pyFTS.partitioners.partitioner.Partitioner.extractor"> <dt id="pyFTS.partitioners.partitioner.Partitioner.extractor">
<code class="descname">extractor</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.partitioners.partitioner.Partitioner.extractor" title="Permalink to this definition"></a></dt> <code class="descname">extractor</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.partitioners.partitioner.Partitioner.extractor" title="Permalink to this definition"></a></dt>
@ -153,7 +176,24 @@
<dl class="method"> <dl class="method">
<dt id="pyFTS.partitioners.partitioner.Partitioner.fuzzyfy"> <dt id="pyFTS.partitioners.partitioner.Partitioner.fuzzyfy">
<code class="descname">fuzzyfy</code><span class="sig-paren">(</span><em>data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/partitioners/partitioner.html#Partitioner.fuzzyfy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.partitioners.partitioner.Partitioner.fuzzyfy" title="Permalink to this definition"></a></dt> <code class="descname">fuzzyfy</code><span class="sig-paren">(</span><em>data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/partitioners/partitioner.html#Partitioner.fuzzyfy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.partitioners.partitioner.Partitioner.fuzzyfy" title="Permalink to this definition"></a></dt>
<dd></dd></dl> <dd><p>Fuzzyfy the input data according to this partitioner fuzzy sets.</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> input value to be fuzzyfied</li>
<li><strong>alpha_cut</strong> the minimal membership value to be considered on fuzzyfication (only for mode=sets)</li>
<li><strong>method</strong> the fuzzyfication method (fuzzy: all fuzzy memberships, maximum: only the maximum membership)</li>
<li><strong>mode</strong> the fuzzyfication mode (sets: return the fuzzy sets names, vector: return a vector with the membership</li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>values for all fuzzy sets, both: return a list with tuples (fuzzy set, membership value) )</p>
<p>:returns a list with the fuzzyfied values, depending on the mode</p>
</dd></dl>
<dl class="method"> <dl class="method">
<dt id="pyFTS.partitioners.partitioner.Partitioner.get_name"> <dt id="pyFTS.partitioners.partitioner.Partitioner.get_name">
@ -171,6 +211,12 @@
</table> </table>
</dd></dl> </dd></dl>
<dl class="attribute">
<dt id="pyFTS.partitioners.partitioner.Partitioner.kdtree">
<code class="descname">kdtree</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.partitioners.partitioner.Partitioner.kdtree" title="Permalink to this definition"></a></dt>
<dd><p>A spatial index to help in fuzzyfication</p>
</dd></dl>
<dl class="method"> <dl class="method">
<dt id="pyFTS.partitioners.partitioner.Partitioner.lower_set"> <dt id="pyFTS.partitioners.partitioner.Partitioner.lower_set">
<code class="descname">lower_set</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/partitioners/partitioner.html#Partitioner.lower_set"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.partitioners.partitioner.Partitioner.lower_set" title="Permalink to this definition"></a></dt> <code class="descname">lower_set</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/partitioners/partitioner.html#Partitioner.lower_set"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.partitioners.partitioner.Partitioner.lower_set" title="Permalink to this definition"></a></dt>
@ -247,6 +293,29 @@
<dd><p>prefix of auto generated partition names</p> <dd><p>prefix of auto generated partition names</p>
</dd></dl> </dd></dl>
<dl class="method">
<dt id="pyFTS.partitioners.partitioner.Partitioner.search">
<code class="descname">search</code><span class="sig-paren">(</span><em>data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/partitioners/partitioner.html#Partitioner.search"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.partitioners.partitioner.Partitioner.search" title="Permalink to this definition"></a></dt>
<dd><p>Perform a search for the nearest fuzzy sets of the point data. This function were designed to work with several
overlapped fuzzy sets.</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> the value to search for the nearest fuzzy sets</li>
<li><strong>type</strong> the return type: index for the fuzzy set indexes or name for fuzzy set names.</li>
<li><strong>results</strong> the number of nearest fuzzy sets to return</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 nearest fuzzy sets</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="attribute"> <dl class="attribute">
<dt id="pyFTS.partitioners.partitioner.Partitioner.setnames"> <dt id="pyFTS.partitioners.partitioner.Partitioner.setnames">
<code class="descname">setnames</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.partitioners.partitioner.Partitioner.setnames" title="Permalink to this definition"></a></dt> <code class="descname">setnames</code><em class="property"> = None</em><a class="headerlink" href="#pyFTS.partitioners.partitioner.Partitioner.setnames" title="Permalink to this definition"></a></dt>

File diff suppressed because one or more lines are too long

View File

@ -45,6 +45,22 @@ pyFTS.models.multivariate.flrg module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
pyFTS.models.multivariate.partitioner module
---------------------------------------------
.. automodule:: pyFTS.models.multivariate.partitioner
:members:
:undoc-members:
:show-inheritance:
pyFTS.models.multivariate.grid module
------------------------------------------
.. automodule:: pyFTS.models.multivariate.grid
:members:
:undoc-members:
:show-inheritance:
pyFTS.models.multivariate.mvfts module pyFTS.models.multivariate.mvfts module
-------------------------------------- --------------------------------------
@ -69,3 +85,11 @@ pyFTS.models.multivariate.cmvfts module
:undoc-members: :undoc-members:
:show-inheritance: :show-inheritance:
pyFTS.models.multivariate.granular module
---------------------------------------------
.. automodule:: pyFTS.models.multivariate.granular
:members:
:undoc-members:
:show-inheritance:

View File

@ -71,6 +71,8 @@ class FTS(object):
self.max_lag = self.order self.max_lag = self.order
"""A integer indicating the largest lag used by the model. This value also indicates the minimum number of past lags """A integer indicating the largest lag used by the model. This value also indicates the minimum number of past lags
needed to forecast a single step ahead""" needed to forecast a single step ahead"""
self.log = pd.DataFrame([],columns=["Datetime","Operation","Value"])
""""""
def fuzzy(self, data): def fuzzy(self, data):
""" """
@ -558,6 +560,9 @@ class FTS(object):
for flrg in self.flrgs.keys(): for flrg in self.flrgs.keys():
self.flrgs[flrg].reset_calculated_values() self.flrgs[flrg].reset_calculated_values()
def append_log(self,operation, value):
pass

View File

@ -126,6 +126,9 @@ class HighOrderFTS(fts.FTS):
nsample = [self.partitioner.fuzzyfy(k, mode="sets", alpha_cut=self.alpha_cut) nsample = [self.partitioner.fuzzyfy(k, mode="sets", alpha_cut=self.alpha_cut)
for k in sample] for k in sample]
if explain:
self.append_log("Fuzzyfication","{} -> {}".format(sample, nsample))
return self.generate_lhs_flrg_fuzzyfied(nsample, explain) return self.generate_lhs_flrg_fuzzyfied(nsample, explain)
def generate_lhs_flrg_fuzzyfied(self, sample, explain=False): def generate_lhs_flrg_fuzzyfied(self, sample, explain=False):
@ -137,7 +140,7 @@ class HighOrderFTS(fts.FTS):
lags.append(lhs) lags.append(lhs)
if explain: if explain:
print("\t (Lag {}) {} -> {} \n".format(o, sample[o-1], lhs)) self.append_log("Ordering Lags", "Lag {} Value {}".format(o, lhs))
# Trace the possible paths # Trace the possible paths
for path in product(*lags): for path in product(*lags):
@ -217,17 +220,11 @@ class HighOrderFTS(fts.FTS):
sample = ndata[k - self.max_lag: k] sample = ndata[k - self.max_lag: k]
if explain:
print("Fuzzyfication \n")
if not fuzzyfied: if not fuzzyfied:
flrgs = self.generate_lhs_flrg(sample, explain) flrgs = self.generate_lhs_flrg(sample, explain)
else: else:
flrgs = self.generate_lhs_flrg_fuzzyfied(sample, explain) flrgs = self.generate_lhs_flrg_fuzzyfied(sample, explain)
if explain:
print("Rules:\n")
midpoints = [] midpoints = []
memberships = [] memberships = []
for flrg in flrgs: for flrg in flrgs:
@ -240,7 +237,7 @@ class HighOrderFTS(fts.FTS):
memberships.append(mv) memberships.append(mv)
if explain: if explain:
print("\t {} -> {} (Naïve)\t Midpoint: {}\n".format(str(flrg.LHS), flrg.LHS[-1], self.append_log("Rule Matching", "{} -> {} (Naïve) Midpoint: {}".format(str(flrg.LHS), flrg.LHS[-1],
mp)) mp))
else: else:
flrg = self.flrgs[flrg.get_key()] flrg = self.flrgs[flrg.get_key()]
@ -250,19 +247,17 @@ class HighOrderFTS(fts.FTS):
memberships.append(mv) memberships.append(mv)
if explain: if explain:
print("\t {} \t Midpoint: {}\n".format(str(flrg), mp)) self.append_log("Rule Matching", "{}, Midpoint: {} Membership: {}".format(flrg.get_key(), mp, mv))
print("\t {} \t Membership: {}\n".format(str(flrg), mv))
if mode == "mean" or fuzzyfied: if mode == "mean" or fuzzyfied:
final = np.nanmean(midpoints) final = np.nanmean(midpoints)
if explain: self.append_log("Deffuzyfication", "By Mean: {}".format(final))
else: else:
final = np.dot(midpoints, memberships) final = np.dot(midpoints, memberships)
if explain: self.append_log("Deffuzyfication", "By Memberships: {}".format(final))
ret.append(final) ret.append(final)
if explain:
print("Deffuzyfied value: {} \n".format(final))
return ret return ret

View File

@ -33,6 +33,10 @@ class GridCluster(partitioner.MultivariatePartitioner):
class IncrementalGridCluster(partitioner.MultivariatePartitioner): class IncrementalGridCluster(partitioner.MultivariatePartitioner):
"""
Create combinations of fuzzy sets of the variables on demand, incrementally increasing the
multivariate fuzzy set base.
"""
def __init__(self, **kwargs): def __init__(self, **kwargs):
super(IncrementalGridCluster, self).__init__(**kwargs) super(IncrementalGridCluster, self).__init__(**kwargs)
self.name="IncrementalGridCluster" self.name="IncrementalGridCluster"

View File

@ -9,11 +9,11 @@ import pandas as pd
def product_dict(**kwargs): def product_dict(**kwargs):
''' """
Code by Seth Johnson Code by Seth Johnson
:param kwargs: :param kwargs:
:return: :return:
''' """
keys = kwargs.keys() keys = kwargs.keys()
vals = kwargs.values() vals = kwargs.values()
for instance in product(*vals): for instance in product(*vals):
@ -244,7 +244,6 @@ class MVFTS(fts.FTS):
params=data[self.target_variable.data_label].values) params=data[self.target_variable.data_label].values)
return ret return ret
def clone_parameters(self, model): def clone_parameters(self, model):
super(MVFTS, self).clone_parameters(model) super(MVFTS, self).clone_parameters(model)

View File

@ -53,14 +53,15 @@ class MultivariatePartitioner(partitioner.Partitioner):
self.build_index() self.build_index()
def search(self, data, **kwargs): def search(self, data, **kwargs):
''' """
Perform a search for the nearest fuzzy sets of the point 'data'. This function were designed to work with several Perform a search for the nearest fuzzy sets of the point 'data'. This function were designed to work with several
overlapped fuzzy sets. overlapped fuzzy sets.
:param data: the value to search for the nearest fuzzy sets :param data: the value to search for the nearest fuzzy sets
:param type: the return type: 'index' for the fuzzy set indexes or 'name' for fuzzy set names. :param type: the return type: 'index' for the fuzzy set indexes or 'name' for fuzzy set names.
:return: a list with the nearest fuzzy sets :return: a list with the nearest fuzzy sets
''' """
if self.kdtree is None: if self.kdtree is None:
self.build_index() self.build_index()
@ -83,9 +84,6 @@ class MultivariatePartitioner(partitioner.Partitioner):
elif type == 'index': elif type == 'index':
return sorted(ix) return sorted(ix)
def fuzzyfy(self, data, **kwargs): def fuzzyfy(self, data, **kwargs):
return fuzzyfy_instance_clustered(data, self, **kwargs) return fuzzyfy_instance_clustered(data, self, **kwargs)