Updating the documentation

This commit is contained in:
Petrônio Cândido 2018-11-09 17:49:39 -02:00
parent b0a0fa5fe0
commit cd43a7dcd5
11 changed files with 245 additions and 39 deletions

Binary file not shown.

View File

@ -1,6 +1,15 @@
pyFTS.models.multivariate package
=================================
Module contents
---------------
.. automodule:: pyFTS.models.multivariate
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
@ -43,12 +52,12 @@ pyFTS.models.multivariate.variable module
:members:
:undoc-members:
:show-inheritance:
pyFTS.models.multivariate.wmvfts module
--------------------------------------
Module contents
---------------
.. automodule:: pyFTS.models.multivariate
.. automodule:: pyFTS.models.multivariate.mvfts
:members:
:undoc-members:
:show-inheritance:

View File

@ -180,7 +180,7 @@
</li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.append_transformation">append_transformation() (pyFTS.common.fts.FTS method)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.append_variable">append_variable() (pyFTS.models.multivariate.mvfts.MVFTS method)</a>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.append_variable">append_variable() (pyFTS.models.multivariate.mvfts.MVFTS method)</a>, <a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.append_variable">[1]</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.tree.FLRGTreeNode.appendChild">appendChild() (pyFTS.common.tree.FLRGTreeNode method)</a>
</li>
@ -205,7 +205,7 @@
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.apply_transformations">apply_transformations() (pyFTS.common.fts.FTS method)</a>
<ul>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.apply_transformations">(pyFTS.models.multivariate.mvfts.MVFTS method)</a>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.apply_transformations">(pyFTS.models.multivariate.mvfts.MVFTS method)</a>, <a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.apply_transformations">[1]</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.variable.Variable.apply_transformations">(pyFTS.models.multivariate.variable.Variable method)</a>
</li>
@ -323,7 +323,7 @@
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS.clone_parameters">clone_parameters() (pyFTS.common.fts.FTS method)</a>
<ul>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.clone_parameters">(pyFTS.models.multivariate.mvfts.MVFTS method)</a>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.clone_parameters">(pyFTS.models.multivariate.mvfts.MVFTS method)</a>, <a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.clone_parameters">[1]</a>
</li>
</ul></li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.CMeans.CMeansPartitioner">CMeansPartitioner (class in pyFTS.partitioners.CMeans)</a>
@ -523,7 +523,7 @@
</li>
<li><a href="pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFTS.forecast">(pyFTS.models.ismailefendi.ImprovedWeightedFTS method)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.forecast">(pyFTS.models.multivariate.mvfts.MVFTS method)</a>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.forecast">(pyFTS.models.multivariate.mvfts.MVFTS method)</a>, <a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.forecast">[1]</a>
</li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.cvfts.ConditionalVarianceFTS.forecast">(pyFTS.models.nonstationary.cvfts.ConditionalVarianceFTS method)</a>
</li>
@ -618,7 +618,7 @@
<li><a href="pyFTS.models.html#pyFTS.models.pwfts.ProbabilisticWeightedFTS.forecast_interval">(pyFTS.models.pwfts.ProbabilisticWeightedFTS method)</a>
</li>
</ul></li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.format_data">format_data() (pyFTS.models.multivariate.mvfts.MVFTS method)</a>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.format_data">format_data() (pyFTS.models.multivariate.mvfts.MVFTS method)</a>, <a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.format_data">[1]</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.fts.FTS">FTS (class in pyFTS.common.fts)</a>
</li>
@ -677,7 +677,7 @@
<ul>
<li><a href="pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFTS.generate_flrg">(pyFTS.models.ismailefendi.ImprovedWeightedFTS method)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.generate_flrg">(pyFTS.models.multivariate.mvfts.MVFTS method)</a>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.generate_flrg">(pyFTS.models.multivariate.mvfts.MVFTS method)</a>, <a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.generate_flrg">[1]</a>
</li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.cvfts.ConditionalVarianceFTS.generate_flrg">(pyFTS.models.nonstationary.cvfts.ConditionalVarianceFTS method)</a>
</li>
@ -698,7 +698,7 @@
</ul></li>
<li><a href="pyFTS.models.html#pyFTS.models.yu.WeightedFTS.generate_FLRG">generate_FLRG() (pyFTS.models.yu.WeightedFTS method)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.generate_flrs">generate_flrs() (pyFTS.models.multivariate.mvfts.MVFTS method)</a>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.generate_flrs">generate_flrs() (pyFTS.models.multivariate.mvfts.MVFTS method)</a>, <a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.generate_flrs">[1]</a>
</li>
<li><a href="pyFTS.data.html#pyFTS.data.artificial.generate_gaussian_linear">generate_gaussian_linear() (in module pyFTS.data.artificial)</a>
</li>
@ -712,7 +712,7 @@
<li><a href="pyFTS.models.html#pyFTS.models.pwfts.ProbabilisticWeightedFTS.generate_lhs_flrg">(pyFTS.models.pwfts.ProbabilisticWeightedFTS method)</a>
</li>
</ul></li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.generate_lhs_flrs">generate_lhs_flrs() (pyFTS.models.multivariate.mvfts.MVFTS method)</a>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.generate_lhs_flrs">generate_lhs_flrs() (pyFTS.models.multivariate.mvfts.MVFTS method)</a>, <a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.generate_lhs_flrs">[1]</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.FLR.generate_non_recurrent_flrs">generate_non_recurrent_flrs() (in module pyFTS.common.FLR)</a>
</li>
@ -1192,7 +1192,7 @@
</li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.msfts.MultiSeasonalFTS">MultiSeasonalFTS (class in pyFTS.models.seasonal.msfts)</a>
</li>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS">MVFTS (class in pyFTS.models.multivariate.mvfts)</a>
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS">MVFTS (class in pyFTS.models.multivariate.mvfts)</a>, <a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS">[1]</a>
</li>
</ul></td>
</tr></table>
@ -1536,7 +1536,7 @@
</li>
<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.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>, <a href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.mvfts">[1]</a>
</li>
<li><a href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.variable">pyFTS.models.multivariate.variable (module)</a>
</li>
@ -1809,7 +1809,7 @@
</li>
<li><a href="pyFTS.models.html#pyFTS.models.ismailefendi.ImprovedWeightedFTS.train">(pyFTS.models.ismailefendi.ImprovedWeightedFTS method)</a>
</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>, <a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.mvfts.MVFTS.train">[1]</a>
</li>
<li><a href="pyFTS.models.nonstationary.html#pyFTS.models.nonstationary.cvfts.ConditionalVarianceFTS.train">(pyFTS.models.nonstationary.cvfts.ConditionalVarianceFTS method)</a>
</li>

View File

@ -137,13 +137,14 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="pyFTS.models.multivariate.html">pyFTS.models.multivariate package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate">Module contents</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#module-pyFTS.models.multivariate.FLR">pyFTS.models.multivariate.FLR module</a></li>
<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.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.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.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">Module contents</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.models.multivariate.html#pyfts-models-multivariate-wmvfts-module">pyFTS.models.multivariate.wmvfts module</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="pyFTS.models.nonstationary.html">pyFTS.models.nonstationary package</a><ul>

View File

@ -64,13 +64,14 @@
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">pyFTS.models.multivariate package</a><ul>
<li><a class="reference internal" href="#module-pyFTS.models.multivariate">Module contents</a></li>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#module-pyFTS.models.multivariate.FLR">pyFTS.models.multivariate.FLR 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.flrg">pyFTS.models.multivariate.flrg 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.variable">pyFTS.models.multivariate.variable module</a></li>
<li><a class="reference internal" href="#module-pyFTS.models.multivariate">Module contents</a></li>
<li><a class="reference internal" href="#pyfts-models-multivariate-wmvfts-module">pyFTS.models.multivariate.wmvfts module</a></li>
</ul>
</li>
</ul>
@ -110,6 +111,10 @@
<div class="section" id="pyfts-models-multivariate-package">
<h1>pyFTS.models.multivariate package<a class="headerlink" href="#pyfts-models-multivariate-package" title="Permalink to this headline"></a></h1>
<div class="section" id="module-pyFTS.models.multivariate">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-pyFTS.models.multivariate" title="Permalink to this headline"></a></h2>
<p>Multivariate Fuzzy Time Series methods</p>
</div>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline"></a></h2>
</div>
@ -358,9 +363,127 @@ transformations and partitioners.</p>
</dd></dl>
</div>
<div class="section" id="module-pyFTS.models.multivariate">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-pyFTS.models.multivariate" title="Permalink to this headline"></a></h2>
<p>Multivariate Fuzzy Time Series methods</p>
<div class="section" id="pyfts-models-multivariate-wmvfts-module">
<h2>pyFTS.models.multivariate.wmvfts module<a class="headerlink" href="#pyfts-models-multivariate-wmvfts-module" title="Permalink to this headline"></a></h2>
<span class="target" id="module-pyFTS.models.multivariate.mvfts"></span><dl class="class">
<dt>
<em class="property">class </em><code class="descclassname">pyFTS.models.multivariate.mvfts.</code><code class="descname">MVFTS</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/mvfts.html#MVFTS"><span class="viewcode-link">[source]</span></a></dt>
<dd><p>Bases: <a class="reference internal" href="pyFTS.common.html#pyFTS.common.fts.FTS" title="pyFTS.common.fts.FTS"><code class="xref py py-class docutils literal notranslate"><span class="pre">pyFTS.common.fts.FTS</span></code></a></p>
<p>Multivariate extension of Chens ConventionalFTS method</p>
<dl class="method">
<dt>
<code class="descname">append_variable</code><span class="sig-paren">(</span><em>var</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/mvfts.html#MVFTS.append_variable"><span class="viewcode-link">[source]</span></a></dt>
<dd><p>Append a new endogenous variable to the model</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>var</strong> variable object</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt>
<code class="descname">apply_transformations</code><span class="sig-paren">(</span><em>data</em>, <em>params=None</em>, <em>updateUoD=False</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/mvfts.html#MVFTS.apply_transformations"><span class="viewcode-link">[source]</span></a></dt>
<dd><p>Apply the data transformations for data preprocessing</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> input data</li>
<li><strong>params</strong> transformation parameters</li>
<li><strong>updateUoD</strong> </li>
<li><strong>kwargs</strong> </li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">preprocessed data</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt>
<code class="descname">clone_parameters</code><span class="sig-paren">(</span><em>model</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/mvfts.html#MVFTS.clone_parameters"><span class="viewcode-link">[source]</span></a></dt>
<dd><p>Import the parameters values from other model</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>model</strong> </td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt>
<code class="descname">forecast</code><span class="sig-paren">(</span><em>data</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/mvfts.html#MVFTS.forecast"><span class="viewcode-link">[source]</span></a></dt>
<dd><p>Point forecast one step ahead</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>data</strong> time series data with the minimal length equal to the max_lag of the model</li>
<li><strong>kwargs</strong> model specific parameters</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">a list with the forecasted values</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt>
<code class="descname">format_data</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/mvfts.html#MVFTS.format_data"><span class="viewcode-link">[source]</span></a></dt>
<dd></dd></dl>
<dl class="method">
<dt>
<code class="descname">generate_flrg</code><span class="sig-paren">(</span><em>flrs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/mvfts.html#MVFTS.generate_flrg"><span class="viewcode-link">[source]</span></a></dt>
<dd></dd></dl>
<dl class="method">
<dt>
<code class="descname">generate_flrs</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/mvfts.html#MVFTS.generate_flrs"><span class="viewcode-link">[source]</span></a></dt>
<dd></dd></dl>
<dl class="method">
<dt>
<code class="descname">generate_lhs_flrs</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/models/multivariate/mvfts.html#MVFTS.generate_lhs_flrs"><span class="viewcode-link">[source]</span></a></dt>
<dd></dd></dl>
<dl class="method">
<dt>
<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/mvfts.html#MVFTS.train"><span class="viewcode-link">[source]</span></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>

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,15 @@
pyFTS.models.multivariate package
=================================
Module contents
---------------
.. automodule:: pyFTS.models.multivariate
:members:
:undoc-members:
:show-inheritance:
Submodules
----------
@ -43,12 +52,12 @@ pyFTS.models.multivariate.variable module
:members:
:undoc-members:
:show-inheritance:
pyFTS.models.multivariate.wmvfts module
--------------------------------------
Module contents
---------------
.. automodule:: pyFTS.models.multivariate
.. automodule:: pyFTS.models.multivariate.mvfts
:members:
:undoc-members:
:show-inheritance:

View File

@ -11,7 +11,7 @@ class MVFTS(fts.FTS):
Multivariate extension of Chen's ConventionalFTS method
"""
def __init__(self, **kwargs):
super(MVFTS, self).__init__(order=1, **kwargs)
super(MVFTS, self).__init__(**kwargs)
self.explanatory_variables = []
self.target_variable = None
self.flrgs = {}

View File

@ -0,0 +1,68 @@
from pyFTS.common import fts, FuzzySet, FLR, Membership, tree
from pyFTS.partitioners import Grid
from pyFTS.models.multivariate import mvfts, FLR as MVFLR, common, flrg as mvflrg
import numpy as np
import pandas as pd
class WeightedFLRG(mvflrg.FLRG):
"""
Weighted Multivariate Fuzzy Logical Rule Group
"""
def __init__(self, **kwargs):
super(WeightedFLRG, self).__init__(**kwargs)
self.order = kwargs.get('order', 1)
self.LHS = kwargs.get('lhs', {})
self.RHS = {}
self.count = 0.0
self.w = None
def append_rhs(self, fset, **kwargs):
if fset not in self.RHS:
self.RHS[fset] = 1.0
else:
self.RHS[fset] += 1.0
self.count += 1.0
def weights(self):
if self.w is None:
self.w = np.array([self.RHS[c] / self.count for c in self.RHS.keys()])
return self.w
def get_midpoint(self, sets):
mp = np.array([sets[c].centroid for c in self.RHS.keys()])
return mp.dot(self.weights())
def __str__(self):
_str = ""
for k in self.RHS.keys():
_str += ", " if len(_str) > 0 else ""
_str += k + " (" + str(round( self.RHS[k] / self.count, 3)) + ")"
return self.get_key() + " -> " + _str
class WeightedMVFTS(mvfts.MVFTS):
"""
Weighted Multivariate FTS
"""
def __init__(self, **kwargs):
super(WeightedMVFTS, self).__init__(order=1, **kwargs)
self.explanatory_variables = []
self.target_variable = None
self.flrgs = {}
self.is_multivariate = True
self.shortname = "WeightedMVFTS"
self.name = "Weighted Multivariate FTS"
def generate_flrg(self, flrs):
for flr in flrs:
flrg = WeightedFLRG(lhs=flr.LHS)
if flrg.get_key() not in self.flrgs:
self.flrgs[flrg.get_key()] = flrg
self.flrgs[flrg.get_key()].append_rhs(flr.RHS)

View File

@ -5,7 +5,7 @@ from pyFTS.common import Transformations
from pyFTS.partitioners import Grid, Util as pUtil
from pyFTS.common import Transformations, Util
from pyFTS.models.multivariate import common, variable, mvfts
from pyFTS.models.multivariate import common, variable, mvfts, wmvfts
from pyFTS.models.seasonal import partitioner as seasonal
from pyFTS.models.seasonal.common import DateTime
@ -16,7 +16,7 @@ from pyFTS.models.multivariate import common, variable, mvfts
from pyFTS.models.seasonal import partitioner as seasonal
from pyFTS.models.seasonal.common import DateTime
#"""
"""
from pyFTS.data import Malaysia
dataset = Malaysia.get_dataframe()
@ -71,9 +71,9 @@ for k in [itertools.combinations(var_list, r) for r in range(2,len(var_list))]:
model.target_variable = vload
model.fit(mv_train)
models.append(model)
#"""
"""
#"""
dataset = pd.read_csv('/home/petronio/Downloads/priceHong')
dataset['hour'] = dataset.index.values % 24
@ -92,16 +92,12 @@ vhour = variable.Variable("Hour", data_label="hour", partitioner=seasonal.TimeGr
vprice = variable.Variable("Price", data_label="price", partitioner=Grid.GridPartitioner, npart=25,
data=train_mv)
model1 = mvfts.MVFTS()
model1 = wmvfts.WeightedMVFTS()
model1.shortname += "1"
model1.append_variable(vhour)
model1.append_variable(vprice)
model1.target_variable = vprice
model1.fit(train_mv)
model2 = mvfts.MVFTS()
model2.shortname += "2"
model2.append_variable(vhour)
model2.target_variable = vprice
model2.fit(train_mv)
"""
print(model1)
#"""