Documentation update
This commit is contained in:
parent
bb983b53dd
commit
8d15dfa7c3
BIN
docs/build/doctrees/environment.pickle
vendored
BIN
docs/build/doctrees/environment.pickle
vendored
Binary file not shown.
BIN
docs/build/doctrees/index.doctree
vendored
BIN
docs/build/doctrees/index.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/pyFTS.common.doctree
vendored
BIN
docs/build/doctrees/pyFTS.common.doctree
vendored
Binary file not shown.
BIN
docs/build/doctrees/pyFTS.data.doctree
vendored
BIN
docs/build/doctrees/pyFTS.data.doctree
vendored
Binary file not shown.
168
docs/build/html/_modules/pyFTS/common/FuzzySet.html
vendored
168
docs/build/html/_modules/pyFTS/common/FuzzySet.html
vendored
@ -126,137 +126,207 @@
|
||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">+</span> <span class="s2">": "</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">mf</span><span class="o">.</span><span class="vm">__name__</span><span class="p">)</span> <span class="o">+</span> <span class="s2">"("</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parameters</span><span class="p">)</span> <span class="o">+</span> <span class="s2">")"</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="set_ordered"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.set_ordered">[docs]</a><span class="k">def</span> <span class="nf">set_ordered</span><span class="p">(</span><span class="n">fuzzySets</span><span class="p">):</span>
|
||||
<span class="sd">"""Order a fuzzy set list by their centroids"""</span>
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">fuzzySets</span><span class="p">)</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="n">tmp1</span> <span class="o">=</span> <span class="p">[</span><span class="n">fuzzySets</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">fuzzySets</span><span class="o">.</span><span class="n">keys</span><span class="p">()]</span>
|
||||
<span class="k">def</span> <span class="nf">__binary_search</span><span class="p">(</span><span class="n">x</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="sd">"""</span>
|
||||
<span class="sd"> Search for elegible fuzzy sets to fuzzyfy x</span>
|
||||
|
||||
<span class="sd"> :param x: input value to be fuzzyfied</span>
|
||||
<span class="sd"> :param fuzzy_sets: a dictionary where the key is the fuzzy set name and the value is the fuzzy set object.</span>
|
||||
<span class="sd"> :param ordered_sets: a list with the fuzzy sets names ordered by their centroids.</span>
|
||||
<span class="sd"> :return: A list with the best fuzzy sets that may contain x</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">max_len</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">fuzzy_sets</span><span class="p">)</span>
|
||||
<span class="n">first</span> <span class="o">=</span> <span class="mi">0</span>
|
||||
<span class="n">last</span> <span class="o">=</span> <span class="n">max_len</span>
|
||||
|
||||
<span class="k">while</span> <span class="n">first</span> <span class="o"><=</span> <span class="n">last</span><span class="p">:</span>
|
||||
<span class="n">midpoint</span> <span class="o">=</span> <span class="p">(</span><span class="n">first</span> <span class="o">+</span> <span class="n">last</span><span class="p">)</span> <span class="o">//</span> <span class="mi">2</span>
|
||||
<span class="n">fs</span> <span class="o">=</span> <span class="n">ordered_sets</span><span class="p">[</span><span class="n">midpoint</span><span class="p">]</span>
|
||||
<span class="n">fs1</span> <span class="o">=</span> <span class="n">ordered_sets</span><span class="p">[</span><span class="n">midpoint</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span> <span class="k">if</span> <span class="n">midpoint</span> <span class="o">></span> <span class="mi">0</span> <span class="k">else</span> <span class="n">ordered_sets</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
|
||||
<span class="n">fs2</span> <span class="o">=</span> <span class="n">ordered_sets</span><span class="p">[</span><span class="n">midpoint</span> <span class="o">+</span> <span class="mi">1</span><span class="p">]</span> <span class="k">if</span> <span class="n">midpoint</span> <span class="o"><</span> <span class="n">max_len</span> <span class="k">else</span> <span class="n">ordered_sets</span><span class="p">[</span><span class="n">max_len</span><span class="p">]</span>
|
||||
<span class="k">if</span> <span class="n">fuzzy_sets</span><span class="p">[</span><span class="n">fs1</span><span class="p">]</span><span class="o">.</span><span class="n">centroid</span> <span class="o"><=</span> <span class="n">x</span> <span class="o"><=</span> <span class="n">fuzzy_sets</span><span class="p">[</span><span class="n">fs2</span><span class="p">]</span><span class="o">.</span><span class="n">centroid</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="p">(</span><span class="n">midpoint</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">midpoint</span><span class="p">,</span> <span class="n">midpoint</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">x</span> <span class="o"><</span> <span class="n">fuzzy_sets</span><span class="p">[</span><span class="n">fs</span><span class="p">]</span><span class="o">.</span><span class="n">centroid</span><span class="p">:</span>
|
||||
<span class="n">last</span> <span class="o">=</span> <span class="n">midpoint</span> <span class="o">-</span> <span class="mi">1</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="n">first</span> <span class="o">=</span> <span class="n">midpoint</span> <span class="o">+</span> <span class="mi">1</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="fuzzyfy"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.fuzzyfy">[docs]</a><span class="k">def</span> <span class="nf">fuzzyfy</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">partitioner</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> A general method for fuzzyfication.</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 kwargs: dict, optional arguments</span>
|
||||
|
||||
<span class="sd"> :keyword alpha_cut: the minimal membership value to be considered on fuzzyfication (only for mode='sets')</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 values for all fuzzy sets)</span>
|
||||
<span class="sd"> :returns a list with the fuzzyfied values, depending on the mode</span>
|
||||
<span class="sd"> """</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">'alpha_cut'</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">'mode'</span><span class="p">,</span> <span class="s1">'sets'</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">'method'</span><span class="p">,</span> <span class="s1">'fuzzy'</span><span class="p">)</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="k">if</span> <span class="n">mode</span> <span class="o">==</span> <span class="s1">'vector'</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">fuzzyfy_instances</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="n">sets</span><span class="p">,</span> <span class="n">partitioner</span><span class="o">.</span><span class="n">ordered_sets</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">fuzzyfy_series</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="n">sets</span><span class="p">,</span> <span class="n">method</span><span class="p">,</span> <span class="n">alpha_cut</span><span class="p">,</span> <span class="n">partitioner</span><span class="o">.</span><span class="n">ordered_sets</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">mode</span> <span class="o">==</span> <span class="s1">'vector'</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">fuzzyfy_instance</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="n">sets</span><span class="p">,</span> <span class="n">partitioner</span><span class="o">.</span><span class="n">ordered_sets</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">get_fuzzysets</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="n">sets</span><span class="p">,</span> <span class="n">partitioner</span><span class="o">.</span><span class="n">ordered_sets</span><span class="p">,</span> <span class="n">alpha_cut</span><span class="p">)</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="set_ordered"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.set_ordered">[docs]</a><span class="k">def</span> <span class="nf">set_ordered</span><span class="p">(</span><span class="n">fuzzy_sets</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Order a fuzzy set list by their centroids</span>
|
||||
|
||||
<span class="sd"> :param fuzzy_sets: a dictionary where the key is the fuzzy set name and the value is the fuzzy set object.</span>
|
||||
<span class="sd"> :return: a list with the fuzzy sets names ordered by their centroids.</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">fuzzy_sets</span><span class="p">)</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="n">tmp1</span> <span class="o">=</span> <span class="p">[</span><span class="n">fuzzy_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="n">fuzzy_sets</span><span class="o">.</span><span class="n">keys</span><span class="p">()]</span>
|
||||
<span class="k">return</span> <span class="p">[</span><span class="n">k</span><span class="o">.</span><span class="n">name</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">tmp1</span><span class="p">,</span> <span class="n">key</span><span class="o">=</span><span class="k">lambda</span> <span class="n">x</span><span class="p">:</span> <span class="n">x</span><span class="o">.</span><span class="n">centroid</span><span class="p">)]</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="fuzzyfy_instance"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.fuzzyfy_instance">[docs]</a><span class="k">def</span> <span class="nf">fuzzyfy_instance</span><span class="p">(</span><span class="n">inst</span><span class="p">,</span> <span class="n">fuzzySets</span><span class="p">,</span> <span class="n">ordered_sets</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<div class="viewcode-block" id="fuzzyfy_instance"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.fuzzyfy_instance">[docs]</a><span class="k">def</span> <span class="nf">fuzzyfy_instance</span><span class="p">(</span><span class="n">inst</span><span class="p">,</span> <span class="n">fuzzy_sets</span><span class="p">,</span> <span class="n">ordered_sets</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Calculate the membership values for a data point given fuzzy sets</span>
|
||||
|
||||
<span class="sd"> :param inst: data point</span>
|
||||
<span class="sd"> :param fuzzySets: dict of fuzzy sets</span>
|
||||
<span class="sd"> :param fuzzy_sets: a dictionary where the key is the fuzzy set name and the value is the fuzzy set object.</span>
|
||||
<span class="sd"> :param ordered_sets: a list with the fuzzy sets names ordered by their centroids.</span>
|
||||
<span class="sd"> :return: array of membership values</span>
|
||||
<span class="sd"> """</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">ordered_sets</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">ordered_sets</span> <span class="o">=</span> <span class="n">set_ordered</span><span class="p">(</span><span class="n">fuzzySets</span><span class="p">)</span>
|
||||
<span class="n">ordered_sets</span> <span class="o">=</span> <span class="n">set_ordered</span><span class="p">(</span><span class="n">fuzzy_sets</span><span class="p">)</span>
|
||||
|
||||
<span class="n">mv</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">ordered_sets</span><span class="p">:</span>
|
||||
<span class="n">mv</span><span class="o">.</span><span class="n">append</span><span class="p">(</span> <span class="n">fuzzySets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span><span class="o">.</span><span class="n">membership</span><span class="p">(</span><span class="n">inst</span><span class="p">))</span>
|
||||
<span class="k">return</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">(</span><span class="n">mv</span><span class="p">)</span></div>
|
||||
<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="nb">len</span><span class="p">(</span><span class="n">fuzzy_sets</span><span class="p">))</span>
|
||||
|
||||
<span class="k">for</span> <span class="n">ix</span> <span class="ow">in</span> <span class="n">__binary_search</span><span class="p">(</span><span class="n">inst</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="n">mv</span><span class="p">[</span><span class="n">ix</span><span class="p">]</span> <span class="o">=</span> <span class="n">fuzzy_sets</span><span class="p">[</span><span class="n">ordered_sets</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">inst</span><span class="p">)</span>
|
||||
|
||||
<span class="k">return</span> <span class="n">mv</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="fuzzyfy_instances"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.fuzzyfy_instances">[docs]</a><span class="k">def</span> <span class="nf">fuzzyfy_instances</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">fuzzySets</span><span class="p">,</span> <span class="n">ordered_sets</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<div class="viewcode-block" id="fuzzyfy_instances"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.fuzzyfy_instances">[docs]</a><span class="k">def</span> <span class="nf">fuzzyfy_instances</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="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Calculate the membership values for a data point given fuzzy sets</span>
|
||||
|
||||
<span class="sd"> :param inst: data point</span>
|
||||
<span class="sd"> :param fuzzySets: dict of fuzzy sets</span>
|
||||
<span class="sd"> :param fuzzy_sets: a dictionary where the key is the fuzzy set name and the value is the fuzzy set object.</span>
|
||||
<span class="sd"> :param ordered_sets: a list with the fuzzy sets names ordered by their centroids.</span>
|
||||
<span class="sd"> :return: array of membership values</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">ret</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">if</span> <span class="n">ordered_sets</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">ordered_sets</span> <span class="o">=</span> <span class="n">set_ordered</span><span class="p">(</span><span class="n">fuzzySets</span><span class="p">)</span>
|
||||
<span class="n">ordered_sets</span> <span class="o">=</span> <span class="n">set_ordered</span><span class="p">(</span><span class="n">fuzzy_sets</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="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">fuzzySets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span><span class="o">.</span><span class="n">membership</span><span class="p">(</span><span class="n">inst</span><span class="p">)</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">ordered_sets</span><span class="p">])</span>
|
||||
<span class="n">mv</span> <span class="o">=</span> <span class="n">fuzzyfy_instance</span><span class="p">(</span><span class="n">inst</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="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></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="get_fuzzysets"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.get_fuzzysets">[docs]</a><span class="k">def</span> <span class="nf">get_fuzzysets</span><span class="p">(</span><span class="n">inst</span><span class="p">,</span> <span class="n">fuzzySets</span><span class="p">,</span> <span class="n">ordered_sets</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">alpha_cut</span><span class="o">=</span><span class="mf">0.0</span><span class="p">):</span>
|
||||
<div class="viewcode-block" id="get_fuzzysets"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.get_fuzzysets">[docs]</a><span class="k">def</span> <span class="nf">get_fuzzysets</span><span class="p">(</span><span class="n">inst</span><span class="p">,</span> <span class="n">fuzzy_sets</span><span class="p">,</span> <span class="n">ordered_sets</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">alpha_cut</span><span class="o">=</span><span class="mf">0.0</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Return the fuzzy sets which membership value for a inst is greater than the alpha_cut</span>
|
||||
|
||||
<span class="sd"> :param inst: data point</span>
|
||||
<span class="sd"> :param fuzzySets: dict of fuzzy sets</span>
|
||||
<span class="sd"> :param fuzzy_sets: a dictionary where the key is the fuzzy set name and the value is the fuzzy set object.</span>
|
||||
<span class="sd"> :param ordered_sets: a list with the fuzzy sets names ordered by their centroids.</span>
|
||||
<span class="sd"> :param alpha_cut: Minimal membership to be considered on fuzzyfication process</span>
|
||||
<span class="sd"> :return: array of membership values</span>
|
||||
<span class="sd"> """</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">ordered_sets</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">ordered_sets</span> <span class="o">=</span> <span class="n">set_ordered</span><span class="p">(</span><span class="n">fuzzySets</span><span class="p">)</span>
|
||||
<span class="n">ordered_sets</span> <span class="o">=</span> <span class="n">set_ordered</span><span class="p">(</span><span class="n">fuzzy_sets</span><span class="p">)</span>
|
||||
|
||||
<span class="n">fs</span> <span class="o">=</span> <span class="p">[</span><span class="n">key</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">ordered_sets</span> <span class="k">if</span> <span class="n">fuzzySets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span><span class="o">.</span><span class="n">membership</span><span class="p">(</span><span class="n">inst</span><span class="p">)</span> <span class="o">></span> <span class="n">alpha_cut</span><span class="p">]</span>
|
||||
<span class="n">fs</span> <span class="o">=</span> <span class="p">[</span><span class="n">ordered_sets</span><span class="p">[</span><span class="n">ix</span><span class="p">]</span>
|
||||
<span class="k">for</span> <span class="n">ix</span> <span class="ow">in</span> <span class="n">__binary_search</span><span class="p">(</span><span class="n">inst</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">fuzzy_sets</span><span class="p">[</span><span class="n">ordered_sets</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">inst</span><span class="p">)</span> <span class="o">></span> <span class="n">alpha_cut</span><span class="p">]</span>
|
||||
<span class="k">return</span> <span class="n">fs</span></div>
|
||||
|
||||
<div class="viewcode-block" id="get_maximum_membership_fuzzyset"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.get_maximum_membership_fuzzyset">[docs]</a><span class="k">def</span> <span class="nf">get_maximum_membership_fuzzyset</span><span class="p">(</span><span class="n">inst</span><span class="p">,</span> <span class="n">fuzzySets</span><span class="p">,</span> <span class="n">ordered_sets</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
|
||||
<div class="viewcode-block" id="get_maximum_membership_fuzzyset"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.get_maximum_membership_fuzzyset">[docs]</a><span class="k">def</span> <span class="nf">get_maximum_membership_fuzzyset</span><span class="p">(</span><span class="n">inst</span><span class="p">,</span> <span class="n">fuzzy_sets</span><span class="p">,</span> <span class="n">ordered_sets</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Fuzzify a data point, returning the fuzzy set with maximum membership value</span>
|
||||
|
||||
<span class="sd"> :param inst: data point</span>
|
||||
<span class="sd"> :param fuzzySets: dict of fuzzy sets</span>
|
||||
<span class="sd"> :param fuzzy_sets: a dictionary where the key is the fuzzy set name and the value is the fuzzy set object.</span>
|
||||
<span class="sd"> :param ordered_sets: a list with the fuzzy sets names ordered by their centroids.</span>
|
||||
<span class="sd"> :return: fuzzy set with maximum membership</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">if</span> <span class="n">ordered_sets</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">ordered_sets</span> <span class="o">=</span> <span class="n">set_ordered</span><span class="p">(</span><span class="n">fuzzySets</span><span class="p">)</span>
|
||||
<span class="n">mv</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">fuzzySets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span><span class="o">.</span><span class="n">membership</span><span class="p">(</span><span class="n">inst</span><span class="p">)</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">ordered_sets</span><span class="p">])</span>
|
||||
<span class="n">ordered_sets</span> <span class="o">=</span> <span class="n">set_ordered</span><span class="p">(</span><span class="n">fuzzy_sets</span><span class="p">)</span>
|
||||
<span class="n">mv</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">fuzzy_sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span><span class="o">.</span><span class="n">membership</span><span class="p">(</span><span class="n">inst</span><span class="p">)</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">ordered_sets</span><span class="p">])</span>
|
||||
<span class="n">key</span> <span class="o">=</span> <span class="n">ordered_sets</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="nb">max</span><span class="p">(</span><span class="n">mv</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">return</span> <span class="n">fuzzySets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span></div>
|
||||
<span class="k">return</span> <span class="n">fuzzy_sets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="get_maximum_membership_fuzzyset_index"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.get_maximum_membership_fuzzyset_index">[docs]</a><span class="k">def</span> <span class="nf">get_maximum_membership_fuzzyset_index</span><span class="p">(</span><span class="n">inst</span><span class="p">,</span> <span class="n">fuzzySets</span><span class="p">):</span>
|
||||
<div class="viewcode-block" id="get_maximum_membership_fuzzyset_index"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.get_maximum_membership_fuzzyset_index">[docs]</a><span class="k">def</span> <span class="nf">get_maximum_membership_fuzzyset_index</span><span class="p">(</span><span class="n">inst</span><span class="p">,</span> <span class="n">fuzzy_sets</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Fuzzify a data point, returning the fuzzy set with maximum membership value</span>
|
||||
|
||||
<span class="sd"> :param inst: data point</span>
|
||||
<span class="sd"> :param fuzzySets: dict of fuzzy sets</span>
|
||||
<span class="sd"> :param fuzzy_sets: dict of fuzzy sets</span>
|
||||
<span class="sd"> :return: fuzzy set with maximum membership</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="n">mv</span> <span class="o">=</span> <span class="n">fuzzyfy_instance</span><span class="p">(</span><span class="n">inst</span><span class="p">,</span> <span class="n">fuzzySets</span><span class="p">)</span>
|
||||
<span class="n">mv</span> <span class="o">=</span> <span class="n">fuzzyfy_instance</span><span class="p">(</span><span class="n">inst</span><span class="p">,</span> <span class="n">fuzzy_sets</span><span class="p">)</span>
|
||||
<span class="k">return</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="nb">max</span><span class="p">(</span><span class="n">mv</span><span class="p">))[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">]</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="fuzzyfy_series_old"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.fuzzyfy_series_old">[docs]</a><span class="k">def</span> <span class="nf">fuzzyfy_series_old</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">fuzzySets</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">'maximum'</span><span class="p">):</span>
|
||||
<div class="viewcode-block" id="fuzzyfy_series_old"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.fuzzyfy_series_old">[docs]</a><span class="k">def</span> <span class="nf">fuzzyfy_series_old</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">method</span><span class="o">=</span><span class="s1">'maximum'</span><span class="p">):</span>
|
||||
<span class="n">fts</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">item</span> <span class="ow">in</span> <span class="n">data</span><span class="p">:</span>
|
||||
<span class="n">fts</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">get_maximum_membership_fuzzyset</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">fuzzySets</span><span class="p">)</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
|
||||
<span class="n">fts</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">get_maximum_membership_fuzzyset</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">fuzzy_sets</span><span class="p">)</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">fts</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="fuzzyfy_series"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.fuzzyfy_series">[docs]</a><span class="k">def</span> <span class="nf">fuzzyfy_series</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">fuzzySets</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">'maximum'</span><span class="p">,</span> <span class="n">alpha_cut</span><span class="o">=</span><span class="mf">0.0</span><span class="p">):</span>
|
||||
<div class="viewcode-block" id="fuzzyfy_series"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.fuzzyfy_series">[docs]</a><span class="k">def</span> <span class="nf">fuzzyfy_series</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">method</span><span class="o">=</span><span class="s1">'maximum'</span><span class="p">,</span> <span class="n">alpha_cut</span><span class="o">=</span><span class="mf">0.0</span><span class="p">,</span> <span class="n">ordered_sets</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
|
||||
<span class="n">fts</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="n">ordered_sets</span> <span class="o">=</span> <span class="n">set_ordered</span><span class="p">(</span><span class="n">fuzzySets</span><span class="p">)</span>
|
||||
<span class="k">if</span> <span class="n">ordered_sets</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
|
||||
<span class="n">ordered_sets</span> <span class="o">=</span> <span class="n">set_ordered</span><span class="p">(</span><span class="n">fuzzy_sets</span><span class="p">)</span>
|
||||
<span class="k">for</span> <span class="n">t</span><span class="p">,</span> <span class="n">i</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">data</span><span class="p">):</span>
|
||||
<span class="n">mv</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">fuzzySets</span><span class="p">[</span><span class="n">key</span><span class="p">]</span><span class="o">.</span><span class="n">membership</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">ordered_sets</span><span class="p">])</span>
|
||||
<span class="n">mv</span> <span class="o">=</span> <span class="n">fuzzyfy_instance</span><span class="p">(</span><span class="n">i</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="nb">len</span><span class="p">(</span><span class="n">mv</span><span class="p">)</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
|
||||
<span class="n">sets</span> <span class="o">=</span> <span class="n">check_bounds</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">fuzzySets</span><span class="o">.</span><span class="n">items</span><span class="p">(),</span> <span class="n">ordered_sets</span><span class="p">)</span>
|
||||
<span class="n">sets</span> <span class="o">=</span> <span class="n">check_bounds</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">fuzzy_sets</span><span class="o">.</span><span class="n">items</span><span class="p">(),</span> <span class="n">ordered_sets</span><span class="p">)</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">method</span> <span class="o">==</span> <span class="s1">'fuzzy'</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">alpha_cut</span><span class="p">))</span>
|
||||
<span class="n">sets</span> <span class="o">=</span> <span class="p">[</span><span class="n">fuzzySets</span><span class="p">[</span><span class="n">ordered_sets</span><span class="p">[</span><span class="n">i</span><span class="p">]]</span><span class="o">.</span><span class="n">name</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="n">sets</span> <span class="o">=</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="n">i</span><span class="p">]]</span><span class="o">.</span><span class="n">name</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">elif</span> <span class="n">method</span> <span class="o">==</span> <span class="s1">'maximum'</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="n">sets</span> <span class="o">=</span> <span class="n">fuzzySets</span><span class="p">[</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="o">.</span><span class="n">name</span>
|
||||
<span class="n">sets</span> <span class="o">=</span> <span class="n">fuzzy_sets</span><span class="p">[</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="o">.</span><span class="n">name</span>
|
||||
<span class="n">fts</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">sets</span><span class="p">)</span>
|
||||
<span class="k">return</span> <span class="n">fts</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="grant_bounds"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.grant_bounds">[docs]</a><span class="k">def</span> <span class="nf">grant_bounds</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">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"><</span> <span class="n">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">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="k">elif</span> <span class="n">data</span> <span class="o">></span> <span class="n">sets</span><span class="p">[</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="o">.</span><span class="n">upper</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">sets</span><span class="p">[</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="o">.</span><span class="n">upper</span>
|
||||
<div class="viewcode-block" id="grant_bounds"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.grant_bounds">[docs]</a><span class="k">def</span> <span class="nf">grant_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"><</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="o">.</span><span class="n">lower</span>
|
||||
<span class="k">elif</span> <span class="n">data</span> <span class="o">></span> <span class="n">fuzzy_sets</span><span class="p">[</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="o">.</span><span class="n">upper</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="o">-</span><span class="mi">1</span><span class="p">]]</span><span class="o">.</span><span class="n">upper</span>
|
||||
<span class="k">else</span><span class="p">:</span>
|
||||
<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">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"><</span> <span class="n">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">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">elif</span> <span class="n">data</span> <span class="o">></span> <span class="n">sets</span><span class="p">[</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="o">.</span><span class="n">upper</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">sets</span><span class="p">[</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="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"><</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">elif</span> <span class="n">data</span> <span class="o">></span> <span class="n">fuzzy_sets</span><span class="p">[</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="o">.</span><span class="n">upper</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="o">-</span><span class="mi">1</span><span class="p">]]</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="check_bounds_index"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.check_bounds_index">[docs]</a><span class="k">def</span> <span class="nf">check_bounds_index</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">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"><</span> <span class="n">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">get_lower</span><span class="p">():</span>
|
||||
<div class="viewcode-block" id="check_bounds_index"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.FuzzySet.check_bounds_index">[docs]</a><span class="k">def</span> <span class="nf">check_bounds_index</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"><</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">get_lower</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">></span> <span class="n">sets</span><span class="p">[</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="o">.</span><span class="n">get_upper</span><span class="p">():</span>
|
||||
<span class="k">return</span> <span class="nb">len</span><span class="p">(</span><span class="n">sets</span><span class="p">)</span> <span class="o">-</span><span class="mi">1</span></div>
|
||||
<span class="k">elif</span> <span class="n">data</span> <span class="o">></span> <span class="n">fuzzy_sets</span><span class="p">[</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="o">.</span><span class="n">get_upper</span><span class="p">():</span>
|
||||
<span class="k">return</span> <span class="nb">len</span><span class="p">(</span><span class="n">fuzzy_sets</span><span class="p">)</span> <span class="o">-</span> <span class="mi">1</span></div>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
@ -140,6 +140,17 @@
|
||||
<span class="sd"> :return:</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="mi">1</span> <span class="o">/</span> <span class="p">(</span><span class="mi">1</span> <span class="o">+</span> <span class="n">math</span><span class="o">.</span><span class="n">exp</span><span class="p">(</span><span class="o">-</span><span class="n">parameters</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">*</span> <span class="p">(</span><span class="n">x</span> <span class="o">-</span> <span class="n">parameters</span><span class="p">[</span><span class="mi">1</span><span class="p">])))</span></div>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="singleton"><a class="viewcode-back" href="../../../pyFTS.common.html#pyFTS.common.Membership.singleton">[docs]</a><span class="k">def</span> <span class="nf">singleton</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">parameters</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Singleton membership function, a single value fuzzy function</span>
|
||||
|
||||
<span class="sd"> :param x:</span>
|
||||
<span class="sd"> :param parameters: a list with one real value</span>
|
||||
<span class="sd"> :returns</span>
|
||||
<span class="sd"> """</span>
|
||||
<span class="k">return</span> <span class="n">x</span> <span class="o">==</span> <span class="n">parameters</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span></div>
|
||||
</pre></div>
|
||||
|
||||
</div>
|
||||
|
10
docs/build/html/_modules/pyFTS/common/fts.html
vendored
10
docs/build/html/_modules/pyFTS/common/fts.html
vendored
@ -252,15 +252,19 @@
|
||||
<span class="sd"> :param kwargs: model specific parameters</span>
|
||||
<span class="sd"> :return: a list with the forecasted values</span>
|
||||
<span class="sd"> """</span>
|
||||
|
||||
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">data</span><span class="p">,</span> <span class="n">np</span><span class="o">.</span><span class="n">ndarray</span><span class="p">):</span>
|
||||
<span class="n">data</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">tolist</span><span class="p">()</span>
|
||||
|
||||
<span class="n">ret</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="n">steps</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</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="o">-</span><span class="bp">self</span><span class="o">.</span><span class="n">order</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="bp">self</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="o">-</span><span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">:],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">tmp</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">tmp</span> <span class="o">=</span> <span class="n">tmp</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
|
||||
<span class="n">tmp</span> <span class="o">=</span> <span class="n">tmp</span><span class="p">[</span><span class="o">-</span><span class="mi">1</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">tmp</span><span class="p">)</span>
|
||||
<span class="n">data</span><span class="o">.</span><span class="n">append_rhs</span><span class="p">(</span><span class="n">tmp</span><span class="p">)</span>
|
||||
<span class="n">data</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="k">return</span> <span class="n">ret</span></div>
|
||||
|
||||
|
@ -75,7 +75,7 @@
|
||||
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="get_data"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.Bitcoin.get_data">[docs]</a><span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="n">field</span><span class="o">=</span><span class="s1">'avg'</span><span class="p">):</span>
|
||||
<div class="viewcode-block" id="get_data"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.Bitcoin.get_data">[docs]</a><span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="n">field</span><span class="o">=</span><span class="s1">'AVG'</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Get the univariate time series data.</span>
|
||||
|
||||
|
@ -75,7 +75,7 @@
|
||||
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="get_data"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.DowJones.get_data">[docs]</a><span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="n">field</span><span class="o">=</span><span class="s1">'avg'</span><span class="p">):</span>
|
||||
<div class="viewcode-block" id="get_data"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.DowJones.get_data">[docs]</a><span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="n">field</span><span class="o">=</span><span class="s1">'AVG'</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Get the univariate time series data.</span>
|
||||
|
||||
|
@ -75,7 +75,7 @@
|
||||
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
||||
|
||||
|
||||
<div class="viewcode-block" id="get_data"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.Ethereum.get_data">[docs]</a><span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="n">field</span><span class="o">=</span><span class="s1">'avg'</span><span class="p">):</span>
|
||||
<div class="viewcode-block" id="get_data"><a class="viewcode-back" href="../../../pyFTS.data.html#pyFTS.data.Ethereum.get_data">[docs]</a><span class="k">def</span> <span class="nf">get_data</span><span class="p">(</span><span class="n">field</span><span class="o">=</span><span class="s1">'AVG'</span><span class="p">):</span>
|
||||
<span class="sd">"""</span>
|
||||
<span class="sd"> Get the univariate time series data.</span>
|
||||
|
||||
|
@ -131,8 +131,7 @@
|
||||
<span class="n">flrgs</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
|
||||
<span class="k">for</span> <span class="n">ct</span><span class="p">,</span> <span class="n">o</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">lags</span><span class="p">):</span>
|
||||
<span class="n">lhs</span> <span class="o">=</span> <span class="p">[</span><span class="n">key</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">partitioner</span><span class="o">.</span><span class="n">ordered_sets</span>
|
||||
<span class="k">if</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="o">.</span><span class="n">membership</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="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">alpha_cut</span><span class="p">]</span>
|
||||
<span class="n">lhs</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">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">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">mode</span><span class="o">=</span><span class="s2">"sets"</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">lags</span><span class="p">[</span><span class="n">ct</span><span class="p">]</span> <span class="o">=</span> <span class="n">lhs</span>
|
||||
|
||||
<span class="n">root</span> <span class="o">=</span> <span class="n">tree</span><span class="o">.</span><span class="n">FLRGTreeNode</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span>
|
||||
@ -158,8 +157,7 @@
|
||||
|
||||
<span class="n">sample</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="n">k</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">:</span> <span class="n">k</span><span class="p">]</span>
|
||||
|
||||
<span class="n">rhs</span> <span class="o">=</span> <span class="p">[</span><span class="n">key</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">partitioner</span><span class="o">.</span><span class="n">ordered_sets</span>
|
||||
<span class="k">if</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="o">.</span><span class="n">membership</span><span class="p">(</span><span class="n">data</span><span class="p">[</span><span class="n">k</span><span class="p">])</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">rhs</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">k</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">mode</span><span class="o">=</span><span class="s2">"sets"</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">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>
|
||||
|
||||
@ -180,7 +178,7 @@
|
||||
|
||||
<span class="n">l</span> <span class="o">=</span> <span class="nb">len</span><span class="p">(</span><span class="n">ndata</span><span class="p">)</span>
|
||||
|
||||
<span class="k">if</span> <span class="n">l</span> <span class="o"><=</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">:</span>
|
||||
<span class="k">if</span> <span class="n">l</span> <span class="o"><</span> <span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">:</span>
|
||||
<span class="k">return</span> <span class="n">ndata</span>
|
||||
|
||||
<span class="k">for</span> <span class="n">k</span> <span class="ow">in</span> <span class="n">np</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">max_lag</span><span class="p">,</span> <span class="n">l</span><span class="o">+</span><span class="mi">1</span><span class="p">):</span>
|
||||
|
@ -63,13 +63,11 @@
|
||||
<h1>Source code for pyFTS.models.multivariate.common</h1><div class="highlight"><pre>
|
||||
<span></span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
|
||||
<span class="kn">import</span> <span class="nn">pandas</span> <span class="k">as</span> <span class="nn">pd</span>
|
||||
|
||||
<span class="kn">from</span> <span class="nn">pyFTS.common</span> <span class="k">import</span> <span class="n">FuzzySet</span>
|
||||
|
||||
<div class="viewcode-block" id="fuzzyfy_instance"><a class="viewcode-back" href="../../../../pyFTS.models.multivariate.html#pyFTS.models.multivariate.common.fuzzyfy_instance">[docs]</a><span class="k">def</span> <span class="nf">fuzzyfy_instance</span><span class="p">(</span><span class="n">data_point</span><span class="p">,</span> <span class="n">var</span><span class="p">):</span>
|
||||
<span class="n">mv</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="n">var</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="n">key</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="k">for</span> <span class="n">key</span> <span class="ow">in</span> <span class="n">var</span><span class="o">.</span><span class="n">partitioner</span><span class="o">.</span><span class="n">ordered_sets</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">var</span><span class="o">.</span><span class="n">alpha_cut</span><span class="p">))</span>
|
||||
<span class="n">sets</span> <span class="o">=</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">var</span><span class="o">.</span><span class="n">partitioner</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></div>
|
||||
<span class="k">return</span> <span class="n">FuzzySet</span><span class="o">.</span><span class="n">fuzzyfy</span><span class="p">(</span><span class="n">data_point</span><span class="p">,</span> <span class="n">var</span><span class="o">.</span><span class="n">partitioner</span><span class="p">,</span> <span class="n">mode</span><span class="o">=</span><span class="s1">'sets'</span><span class="p">,</span> <span class="n">method</span><span class="o">=</span><span class="s1">'fuzzy'</span><span class="p">,</span> <span class="n">alpha_cut</span><span class="o">=</span><span class="n">var</span><span class="o">.</span><span class="n">alpha_cut</span><span class="p">)</span></div>
|
||||
|
||||
|
||||
|
||||
</pre></div>
|
||||
|
@ -191,8 +191,8 @@
|
||||
<span class="n">flrgs</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
|
||||
<span class="k">for</span> <span class="n">ct</span><span class="p">,</span> <span class="n">o</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">lags</span><span class="p">):</span>
|
||||
<span class="n">lhs</span> <span class="o">=</span> <span class="p">[</span><span class="n">key</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">partitioner</span><span class="o">.</span><span class="n">ordered_sets</span>
|
||||
<span class="k">if</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="o">.</span><span class="n">membership</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="o">></span> <span class="bp">self</span><span class="o">.</span><span class="n">alpha_cut</span><span class="p">]</span>
|
||||
<span class="n">lhs</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">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">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">mode</span><span class="o">=</span><span class="s2">"sets"</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">lags</span><span class="p">[</span><span class="n">ct</span><span class="p">]</span> <span class="o">=</span> <span class="n">lhs</span>
|
||||
|
||||
<span class="n">root</span> <span class="o">=</span> <span class="n">tree</span><span class="o">.</span><span class="n">FLRGTreeNode</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span>
|
||||
|
22
docs/build/html/_sources/index.rst.txt
vendored
22
docs/build/html/_sources/index.rst.txt
vendored
@ -4,8 +4,8 @@
|
||||
contain the root `toctree` directive.
|
||||
|
||||
|
||||
Welcome to pyFTS's documentation!
|
||||
=================================
|
||||
pyFTS - Fuzzy Time Series for Python
|
||||
====================================
|
||||
|
||||
What is pyFTS Library?
|
||||
----------------------
|
||||
@ -14,6 +14,18 @@ What is pyFTS Library?
|
||||
.. image:: https://img.shields.io/badge/License-GPLv3-blue.svg
|
||||
.. image:: https://img.shields.io/badge/Made%20with-Python-1f425f.svg
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<style>
|
||||
#forkongithub a{ background:#000; color:#fff; text-decoration:none; font-family:arial,sans-serif;
|
||||
text-align:center;font-weight:bold;padding:5px 40px;font-size:1rem;line-height:2rem;position:relative;transition:0.5s;}#forkongithub a:hover{background:#c11;color:#fff;}
|
||||
#forkongithub a::before,#forkongithub a::after{content:"";width:100%;display:block;position:absolute;top:1px;left:0;height:1px;background:#fff;}
|
||||
#forkongithub a::after{bottom:1px;top:auto;}@media screen and (min-width:800px){
|
||||
#forkongithub{position:fixed;display:block;top:0;right:0;width:200px;overflow:hidden;height:200px;z-index:9999;}
|
||||
#forkongithub a{width:200px;position:absolute;top:60px;right:-60px;transform:rotate(45deg);-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);-moz-transform:rotate(45deg);-o-transform:rotate(45deg);box-shadow:4px 4px 10px rgba(0,0,0,0.8);}}
|
||||
</style>
|
||||
<span id="forkongithub"><a href="https://github.com/PYFTS/pyFTS">Fork me on GitHub</a></span>
|
||||
|
||||
This package is intended for students, researchers, data scientists or whose want to exploit the Fuzzy Time Series methods. These methods provide simple, easy to use, computationally cheap and human-readable models, suitable from statistic laymans to experts.
|
||||
|
||||
This tool is developed on `MINDS Lab <http://www.minds.eng.ufmg.br/>`_,
|
||||
@ -50,11 +62,11 @@ North of Minas Gerais (IFNMG) <http://www.ifnmg.edu.br>`_ and `Federal Institute
|
||||
How to reference pyFTS?
|
||||
-----------------------
|
||||
|
||||
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.1405817.svg
|
||||
:target: https://doi.org/10.5281/zenodo.1405817
|
||||
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.597359.svg
|
||||
:target: https://doi.org/10.5281/zenodo.597359
|
||||
|
||||
|
||||
Silva, P. C. L. et al. *pyFTS: Fuzzy Time Series for Python (Version v4.0).* Belo Horizonte. 2018. DOI: 10.5281/zenodo.1405817. Url: <https://doi.org/10.5281/zenodo.1405817>
|
||||
Silva, P. C. L. et al. *pyFTS: Fuzzy Time Series for Python.* Belo Horizonte. 2018. DOI: 10.5281/zenodo.597359. Url: <https://doi.org/10.5281/zenodo.597359>
|
||||
|
||||
|
||||
Indexes
|
||||
|
8
docs/build/html/genindex.html
vendored
8
docs/build/html/genindex.html
vendored
@ -604,6 +604,8 @@
|
||||
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.FCM.fuzzy_cmeans">fuzzy_cmeans() (in module pyFTS.partitioners.FCM)</a>
|
||||
</li>
|
||||
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.FCM.fuzzy_distance">fuzzy_distance() (in module pyFTS.partitioners.FCM)</a>
|
||||
</li>
|
||||
<li><a href="pyFTS.common.html#pyFTS.common.FuzzySet.fuzzyfy">fuzzyfy() (in module pyFTS.common.FuzzySet)</a>
|
||||
</li>
|
||||
<li><a href="pyFTS.common.html#pyFTS.common.FuzzySet.fuzzyfy_instance">fuzzyfy_instance() (in module pyFTS.common.FuzzySet)</a>
|
||||
|
||||
@ -1659,10 +1661,10 @@
|
||||
</ul></li>
|
||||
<li><a href="pyFTS.common.html#pyFTS.common.FuzzySet.set_ordered">set_ordered() (in module pyFTS.common.FuzzySet)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<li><a href="pyFTS.models.multivariate.html#pyFTS.models.multivariate.FLR.FLR.set_rhs">set_rhs() (pyFTS.models.multivariate.FLR.FLR method)</a>
|
||||
</li>
|
||||
</ul></td>
|
||||
<td style="width: 33%; vertical-align: top;"><ul>
|
||||
<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>
|
||||
@ -1688,6 +1690,8 @@
|
||||
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.benchmarks.simpleSearch_RMSE">simpleSearch_RMSE() (in module pyFTS.benchmarks.benchmarks)</a>
|
||||
</li>
|
||||
<li><a href="pyFTS.benchmarks.html#pyFTS.benchmarks.ResidualAnalysis.single_plot_residuals">single_plot_residuals() (in module pyFTS.benchmarks.ResidualAnalysis)</a>
|
||||
</li>
|
||||
<li><a href="pyFTS.common.html#pyFTS.common.Membership.singleton">singleton() (in module pyFTS.common.Membership)</a>
|
||||
</li>
|
||||
<li><a href="pyFTS.common.html#pyFTS.common.Util.sliding_window">sliding_window() (in module pyFTS.common.Util)</a>
|
||||
</li>
|
||||
|
22
docs/build/html/index.html
vendored
22
docs/build/html/index.html
vendored
@ -6,7 +6,7 @@
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Welcome to pyFTS’s documentation! — pyFTS 1.2.3 documentation</title>
|
||||
<title>pyFTS - Fuzzy Time Series for Python — pyFTS 1.2.3 documentation</title>
|
||||
<link rel="stylesheet" href="_static/bizstyle.css" type="text/css" />
|
||||
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
||||
<script type="text/javascript" src="_static/documentation_options.js"></script>
|
||||
@ -45,7 +45,7 @@
|
||||
</a></p>
|
||||
<h3><a href="#">Table Of Contents</a></h3>
|
||||
<ul>
|
||||
<li><a class="reference internal" href="#">Welcome to pyFTS’s documentation!</a><ul>
|
||||
<li><a class="reference internal" href="#">pyFTS - Fuzzy Time Series for Python</a><ul>
|
||||
<li><a class="reference internal" href="#what-is-pyfts-library">What is pyFTS Library?</a></li>
|
||||
<li><a class="reference internal" href="#how-to-reference-pyfts">How to reference pyFTS?</a></li>
|
||||
<li><a class="reference internal" href="#indexes">Indexes</a></li>
|
||||
@ -83,12 +83,20 @@
|
||||
<div class="bodywrapper">
|
||||
<div class="body" role="main">
|
||||
|
||||
<div class="section" id="welcome-to-pyfts-s-documentation">
|
||||
<h1>Welcome to pyFTS’s documentation!<a class="headerlink" href="#welcome-to-pyfts-s-documentation" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="pyfts-fuzzy-time-series-for-python">
|
||||
<h1>pyFTS - Fuzzy Time Series for Python<a class="headerlink" href="#pyfts-fuzzy-time-series-for-python" title="Permalink to this headline">¶</a></h1>
|
||||
<div class="section" id="what-is-pyfts-library">
|
||||
<h2>What is pyFTS Library?<a class="headerlink" href="#what-is-pyfts-library" title="Permalink to this headline">¶</a></h2>
|
||||
<img alt="https://badges.frapsoft.com/os/v2/open-source.png?v=103" src="https://badges.frapsoft.com/os/v2/open-source.png?v=103" />
|
||||
<img alt="https://img.shields.io/badge/License-GPLv3-blue.svg" src="https://img.shields.io/badge/License-GPLv3-blue.svg" /><img alt="https://img.shields.io/badge/Made%20with-Python-1f425f.svg" src="https://img.shields.io/badge/Made%20with-Python-1f425f.svg" /><p>This package is intended for students, researchers, data scientists or whose want to exploit the Fuzzy Time Series methods. These methods provide simple, easy to use, computationally cheap and human-readable models, suitable from statistic laymans to experts.</p>
|
||||
<img alt="https://img.shields.io/badge/License-GPLv3-blue.svg" src="https://img.shields.io/badge/License-GPLv3-blue.svg" /><img alt="https://img.shields.io/badge/Made%20with-Python-1f425f.svg" src="https://img.shields.io/badge/Made%20with-Python-1f425f.svg" /><style>
|
||||
#forkongithub a{ background:#000; color:#fff; text-decoration:none; font-family:arial,sans-serif;
|
||||
text-align:center;font-weight:bold;padding:5px 40px;font-size:1rem;line-height:2rem;position:relative;transition:0.5s;}#forkongithub a:hover{background:#c11;color:#fff;}
|
||||
#forkongithub a::before,#forkongithub a::after{content:"";width:100%;display:block;position:absolute;top:1px;left:0;height:1px;background:#fff;}
|
||||
#forkongithub a::after{bottom:1px;top:auto;}@media screen and (min-width:800px){
|
||||
#forkongithub{position:fixed;display:block;top:0;right:0;width:200px;overflow:hidden;height:200px;z-index:9999;}
|
||||
#forkongithub a{width:200px;position:absolute;top:60px;right:-60px;transform:rotate(45deg);-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);-moz-transform:rotate(45deg);-o-transform:rotate(45deg);box-shadow:4px 4px 10px rgba(0,0,0,0.8);}}
|
||||
</style>
|
||||
<span id="forkongithub"><a href="https://github.com/PYFTS/pyFTS">Fork me on GitHub</a></span><p>This package is intended for students, researchers, data scientists or whose want to exploit the Fuzzy Time Series methods. These methods provide simple, easy to use, computationally cheap and human-readable models, suitable from statistic laymans to experts.</p>
|
||||
<p>This tool is developed on <a class="reference external" href="http://www.minds.eng.ufmg.br/">MINDS Lab</a>,
|
||||
headed by Prof. Frederico Gadelha Guimarães from <a class="reference external" href="https://www.ppgee.ufmg.br/">Electrical
|
||||
Engineering Departament</a> of <a class="reference external" href="https://ufmg.br/">Federal University
|
||||
@ -133,8 +141,8 @@ src="http://www.ifmg.edu.br/portal/imagens/logovertical.jpg" alt="IFMG" width="1
|
||||
</div>
|
||||
<div class="section" id="how-to-reference-pyfts">
|
||||
<h2>How to reference pyFTS?<a class="headerlink" href="#how-to-reference-pyfts" title="Permalink to this headline">¶</a></h2>
|
||||
<a class="reference external image-reference" href="https://doi.org/10.5281/zenodo.1405817"><img alt="https://zenodo.org/badge/DOI/10.5281/zenodo.1405817.svg" src="https://zenodo.org/badge/DOI/10.5281/zenodo.1405817.svg" /></a>
|
||||
<p>Silva, P. C. L. et al. <em>pyFTS: Fuzzy Time Series for Python (Version v4.0).</em> Belo Horizonte. 2018. DOI: 10.5281/zenodo.1405817. Url: <<a class="reference external" href="https://doi.org/10.5281/zenodo.1405817">https://doi.org/10.5281/zenodo.1405817</a>></p>
|
||||
<a class="reference external image-reference" href="https://doi.org/10.5281/zenodo.597359"><img alt="https://zenodo.org/badge/DOI/10.5281/zenodo.597359.svg" src="https://zenodo.org/badge/DOI/10.5281/zenodo.597359.svg" /></a>
|
||||
<p>Silva, P. C. L. et al. <em>pyFTS: Fuzzy Time Series for Python.</em> Belo Horizonte. 2018. DOI: 10.5281/zenodo.597359. Url: <<a class="reference external" href="https://doi.org/10.5281/zenodo.597359">https://doi.org/10.5281/zenodo.597359</a>></p>
|
||||
</div>
|
||||
<div class="section" id="indexes">
|
||||
<h2>Indexes<a class="headerlink" href="#indexes" title="Permalink to this headline">¶</a></h2>
|
||||
|
35
docs/build/html/modules.html
vendored
35
docs/build/html/modules.html
vendored
@ -117,21 +117,28 @@
|
||||
<li class="toctree-l3"><a class="reference internal" href="pyFTS.data.html">pyFTS.data package</a><ul>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data">Module contents</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#submodules">Submodules</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.AirPassengers">pyFTS.data.AirPassengers module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.Enrollments">pyFTS.data.Enrollments module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.INMET">pyFTS.data.INMET module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.NASDAQ">pyFTS.data.NASDAQ module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.SONDA">pyFTS.data.SONDA module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.SP500">pyFTS.data.SP500 module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.TAIEX">pyFTS.data.TAIEX module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.artificial">pyFTS.data.artificial module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.common">pyFTS.data.common module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.henon">pyFTS.data.henon module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.logistic_map">pyFTS.data.logistic_map module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.lorentz">pyFTS.data.lorentz module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.mackey_glass">pyFTS.data.mackey_glass module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.rossler">pyFTS.data.rossler module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.sunspots">pyFTS.data.sunspots module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#datasets">Datasets</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.AirPassengers">AirPassengers dataset</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.Bitcoin">Bitcoin dataset</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.DowJones">DowJones dataset</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.Enrollments">Enrollments dataset</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.Ethereum">Ethereum dataset</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.EURGBP">EUR-GBP dataset</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.EURUSD">EUR-USD dataset</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.GBPUSD">GBP-USD dataset</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.INMET">INMET dataset</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.NASDAQ">NASDAQ module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.SONDA">SONDA dataset</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.SP500">S&P 500 dataset</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.TAIEX">TAIEX dataset</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.artificial">pyFTS.data.artificial module</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.henon">Henon chaotic time series</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.logistic_map">Logistic_map chaotic time series</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.lorentz">Lorentz chaotic time series</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.mackey_glass">Mackey-Glass chaotic time series</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.rossler">Rossler chaotic time series</a></li>
|
||||
<li class="toctree-l4"><a class="reference internal" href="pyFTS.data.html#module-pyFTS.data.sunspots">Sunspots dataset</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l3"><a class="reference internal" href="pyFTS.models.html">pyFTS.models package</a><ul>
|
||||
|
BIN
docs/build/html/objects.inv
vendored
BIN
docs/build/html/objects.inv
vendored
Binary file not shown.
88
docs/build/html/pyFTS.common.html
vendored
88
docs/build/html/pyFTS.common.html
vendored
@ -381,17 +381,40 @@
|
||||
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.common.FuzzySet.check_bounds">
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">check_bounds</code><span class="sig-paren">(</span><em>data</em>, <em>sets</em>, <em>ordered_sets</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#check_bounds"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.check_bounds" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">check_bounds</code><span class="sig-paren">(</span><em>data</em>, <em>fuzzy_sets</em>, <em>ordered_sets</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#check_bounds"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.check_bounds" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.common.FuzzySet.check_bounds_index">
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">check_bounds_index</code><span class="sig-paren">(</span><em>data</em>, <em>sets</em>, <em>ordered_sets</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#check_bounds_index"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.check_bounds_index" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">check_bounds_index</code><span class="sig-paren">(</span><em>data</em>, <em>fuzzy_sets</em>, <em>ordered_sets</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#check_bounds_index"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.check_bounds_index" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.common.FuzzySet.fuzzyfy">
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">fuzzyfy</code><span class="sig-paren">(</span><em>data</em>, <em>partitioner</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#fuzzyfy"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.fuzzyfy" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>A general method for fuzzyfication.</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>partitioner</strong> – a trained pyFTS.partitioners.Partitioner object</li>
|
||||
<li><strong>kwargs</strong> – dict, optional arguments</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 values for all fuzzy sets)</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>:returns a list with the fuzzyfied values, depending on the mode</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.common.FuzzySet.fuzzyfy_instance">
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">fuzzyfy_instance</code><span class="sig-paren">(</span><em>inst</em>, <em>fuzzySets</em>, <em>ordered_sets=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#fuzzyfy_instance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.fuzzyfy_instance" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">fuzzyfy_instance</code><span class="sig-paren">(</span><em>inst</em>, <em>fuzzy_sets</em>, <em>ordered_sets=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#fuzzyfy_instance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.fuzzyfy_instance" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Calculate the membership values for a data point given fuzzy sets</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -399,7 +422,8 @@
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||
<li><strong>inst</strong> – data point</li>
|
||||
<li><strong>fuzzySets</strong> – dict of fuzzy sets</li>
|
||||
<li><strong>fuzzy_sets</strong> – a dictionary where the key is the fuzzy set name and the value is the fuzzy set object.</li>
|
||||
<li><strong>ordered_sets</strong> – a list with the fuzzy sets names ordered by their centroids.</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -412,7 +436,7 @@
|
||||
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.common.FuzzySet.fuzzyfy_instances">
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">fuzzyfy_instances</code><span class="sig-paren">(</span><em>data</em>, <em>fuzzySets</em>, <em>ordered_sets=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#fuzzyfy_instances"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.fuzzyfy_instances" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">fuzzyfy_instances</code><span class="sig-paren">(</span><em>data</em>, <em>fuzzy_sets</em>, <em>ordered_sets=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#fuzzyfy_instances"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.fuzzyfy_instances" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Calculate the membership values for a data point given fuzzy sets</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -420,7 +444,8 @@
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||
<li><strong>inst</strong> – data point</li>
|
||||
<li><strong>fuzzySets</strong> – dict of fuzzy sets</li>
|
||||
<li><strong>fuzzy_sets</strong> – a dictionary where the key is the fuzzy set name and the value is the fuzzy set object.</li>
|
||||
<li><strong>ordered_sets</strong> – a list with the fuzzy sets names ordered by their centroids.</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -433,17 +458,17 @@
|
||||
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.common.FuzzySet.fuzzyfy_series">
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">fuzzyfy_series</code><span class="sig-paren">(</span><em>data</em>, <em>fuzzySets</em>, <em>method='maximum'</em>, <em>alpha_cut=0.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#fuzzyfy_series"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.fuzzyfy_series" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">fuzzyfy_series</code><span class="sig-paren">(</span><em>data</em>, <em>fuzzy_sets</em>, <em>method='maximum'</em>, <em>alpha_cut=0.0</em>, <em>ordered_sets=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#fuzzyfy_series"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.fuzzyfy_series" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.common.FuzzySet.fuzzyfy_series_old">
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">fuzzyfy_series_old</code><span class="sig-paren">(</span><em>data</em>, <em>fuzzySets</em>, <em>method='maximum'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#fuzzyfy_series_old"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.fuzzyfy_series_old" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">fuzzyfy_series_old</code><span class="sig-paren">(</span><em>data</em>, <em>fuzzy_sets</em>, <em>method='maximum'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#fuzzyfy_series_old"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.fuzzyfy_series_old" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.common.FuzzySet.get_fuzzysets">
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">get_fuzzysets</code><span class="sig-paren">(</span><em>inst</em>, <em>fuzzySets</em>, <em>ordered_sets=None</em>, <em>alpha_cut=0.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#get_fuzzysets"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.get_fuzzysets" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">get_fuzzysets</code><span class="sig-paren">(</span><em>inst</em>, <em>fuzzy_sets</em>, <em>ordered_sets=None</em>, <em>alpha_cut=0.0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#get_fuzzysets"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.get_fuzzysets" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Return the fuzzy sets which membership value for a inst is greater than the alpha_cut</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -451,7 +476,8 @@
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||
<li><strong>inst</strong> – data point</li>
|
||||
<li><strong>fuzzySets</strong> – dict of fuzzy sets</li>
|
||||
<li><strong>fuzzy_sets</strong> – a dictionary where the key is the fuzzy set name and the value is the fuzzy set object.</li>
|
||||
<li><strong>ordered_sets</strong> – a list with the fuzzy sets names ordered by their centroids.</li>
|
||||
<li><strong>alpha_cut</strong> – Minimal membership to be considered on fuzzyfication process</li>
|
||||
</ul>
|
||||
</td>
|
||||
@ -465,7 +491,7 @@
|
||||
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.common.FuzzySet.get_maximum_membership_fuzzyset">
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">get_maximum_membership_fuzzyset</code><span class="sig-paren">(</span><em>inst</em>, <em>fuzzySets</em>, <em>ordered_sets=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#get_maximum_membership_fuzzyset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.get_maximum_membership_fuzzyset" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">get_maximum_membership_fuzzyset</code><span class="sig-paren">(</span><em>inst</em>, <em>fuzzy_sets</em>, <em>ordered_sets=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#get_maximum_membership_fuzzyset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.get_maximum_membership_fuzzyset" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Fuzzify a data point, returning the fuzzy set with maximum membership value</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -473,7 +499,8 @@
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||
<li><strong>inst</strong> – data point</li>
|
||||
<li><strong>fuzzySets</strong> – dict of fuzzy sets</li>
|
||||
<li><strong>fuzzy_sets</strong> – a dictionary where the key is the fuzzy set name and the value is the fuzzy set object.</li>
|
||||
<li><strong>ordered_sets</strong> – a list with the fuzzy sets names ordered by their centroids.</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -486,7 +513,7 @@
|
||||
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.common.FuzzySet.get_maximum_membership_fuzzyset_index">
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">get_maximum_membership_fuzzyset_index</code><span class="sig-paren">(</span><em>inst</em>, <em>fuzzySets</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#get_maximum_membership_fuzzyset_index"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.get_maximum_membership_fuzzyset_index" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">get_maximum_membership_fuzzyset_index</code><span class="sig-paren">(</span><em>inst</em>, <em>fuzzy_sets</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#get_maximum_membership_fuzzyset_index"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.get_maximum_membership_fuzzyset_index" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Fuzzify a data point, returning the fuzzy set with maximum membership value</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -494,7 +521,7 @@
|
||||
<tbody valign="top">
|
||||
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
|
||||
<li><strong>inst</strong> – data point</li>
|
||||
<li><strong>fuzzySets</strong> – dict of fuzzy sets</li>
|
||||
<li><strong>fuzzy_sets</strong> – dict of fuzzy sets</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
@ -507,13 +534,23 @@
|
||||
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.common.FuzzySet.grant_bounds">
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">grant_bounds</code><span class="sig-paren">(</span><em>data</em>, <em>sets</em>, <em>ordered_sets</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#grant_bounds"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.grant_bounds" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">grant_bounds</code><span class="sig-paren">(</span><em>data</em>, <em>fuzzy_sets</em>, <em>ordered_sets</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#grant_bounds"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.grant_bounds" title="Permalink to this definition">¶</a></dt>
|
||||
<dd></dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.common.FuzzySet.set_ordered">
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">set_ordered</code><span class="sig-paren">(</span><em>fuzzySets</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#set_ordered"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.set_ordered" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">pyFTS.common.FuzzySet.</code><code class="descname">set_ordered</code><span class="sig-paren">(</span><em>fuzzy_sets</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/FuzzySet.html#set_ordered"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.FuzzySet.set_ordered" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Order a fuzzy set list by their centroids</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>fuzzy_sets</strong> – a dictionary where the key is the fuzzy set name and the value is the fuzzy set object.</td>
|
||||
</tr>
|
||||
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a list with the fuzzy sets names ordered by their centroids.</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
</div>
|
||||
@ -583,6 +620,25 @@
|
||||
</table>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.common.Membership.singleton">
|
||||
<code class="descclassname">pyFTS.common.Membership.</code><code class="descname">singleton</code><span class="sig-paren">(</span><em>x</em>, <em>parameters</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/Membership.html#singleton"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.Membership.singleton" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Singleton membership function, a single value fuzzy function</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>x</strong> – </li>
|
||||
<li><strong>parameters</strong> – a list with one real value</li>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>:returns</p>
|
||||
</dd></dl>
|
||||
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.common.Membership.trapmf">
|
||||
<code class="descclassname">pyFTS.common.Membership.</code><code class="descname">trapmf</code><span class="sig-paren">(</span><em>x</em>, <em>parameters</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/common/Membership.html#trapmf"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.common.Membership.trapmf" title="Permalink to this definition">¶</a></dt>
|
||||
|
6
docs/build/html/pyFTS.data.html
vendored
6
docs/build/html/pyFTS.data.html
vendored
@ -194,7 +194,7 @@ If the file don’t already exists, it will be downloaded and decompressed.</p>
|
||||
<p>Source: <a class="reference external" href="https://finance.yahoo.com/quote/BTC-USD?p=BTC-USD">https://finance.yahoo.com/quote/BTC-USD?p=BTC-USD</a></p>
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.data.Bitcoin.get_data">
|
||||
<code class="descclassname">pyFTS.data.Bitcoin.</code><code class="descname">get_data</code><span class="sig-paren">(</span><em>field='avg'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/Bitcoin.html#get_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.Bitcoin.get_data" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">pyFTS.data.Bitcoin.</code><code class="descname">get_data</code><span class="sig-paren">(</span><em>field='AVG'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/Bitcoin.html#get_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.Bitcoin.get_data" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Get the univariate time series data.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -230,7 +230,7 @@ If the file don’t already exists, it will be downloaded and decompressed.</p>
|
||||
<p>Source: <a class="reference external" href="https://finance.yahoo.com/quote/%5EGSPC/history?p=%5EGSPC">https://finance.yahoo.com/quote/%5EGSPC/history?p=%5EGSPC</a></p>
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.data.DowJones.get_data">
|
||||
<code class="descclassname">pyFTS.data.DowJones.</code><code class="descname">get_data</code><span class="sig-paren">(</span><em>field='avg'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/DowJones.html#get_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.DowJones.get_data" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">pyFTS.data.DowJones.</code><code class="descname">get_data</code><span class="sig-paren">(</span><em>field='AVG'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/DowJones.html#get_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.DowJones.get_data" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Get the univariate time series data.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
@ -289,7 +289,7 @@ If the file don’t already exists, it will be downloaded and decompressed.</p>
|
||||
<p>Source: <a class="reference external" href="https://finance.yahoo.com/quote/ETH-USD?p=ETH-USD">https://finance.yahoo.com/quote/ETH-USD?p=ETH-USD</a></p>
|
||||
<dl class="function">
|
||||
<dt id="pyFTS.data.Ethereum.get_data">
|
||||
<code class="descclassname">pyFTS.data.Ethereum.</code><code class="descname">get_data</code><span class="sig-paren">(</span><em>field='avg'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/Ethereum.html#get_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.Ethereum.get_data" title="Permalink to this definition">¶</a></dt>
|
||||
<code class="descclassname">pyFTS.data.Ethereum.</code><code class="descname">get_data</code><span class="sig-paren">(</span><em>field='AVG'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/data/Ethereum.html#get_data"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyFTS.data.Ethereum.get_data" title="Permalink to this definition">¶</a></dt>
|
||||
<dd><p>Get the univariate time series data.</p>
|
||||
<table class="docutils field-list" frame="void" rules="none">
|
||||
<col class="field-name" />
|
||||
|
8
docs/build/html/quickstart.html
vendored
8
docs/build/html/quickstart.html
vendored
@ -18,7 +18,7 @@
|
||||
<link rel="index" title="Index" href="genindex.html" />
|
||||
<link rel="search" title="Search" href="search.html" />
|
||||
<link rel="next" title="pyFTS" href="modules.html" />
|
||||
<link rel="prev" title="Welcome to pyFTS’s documentation!" href="index.html" />
|
||||
<link rel="prev" title="pyFTS - Fuzzy Time Series for Python" href="index.html" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<!--[if lt IE 9]>
|
||||
<script type="text/javascript" src="_static/css3-mediaqueries.js"></script>
|
||||
@ -37,7 +37,7 @@
|
||||
<a href="modules.html" title="pyFTS"
|
||||
accesskey="N">next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="index.html" title="Welcome to pyFTS’s documentation!"
|
||||
<a href="index.html" title="pyFTS - Fuzzy Time Series for Python"
|
||||
accesskey="P">previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="index.html">pyFTS 1.2.3 documentation</a> »</li>
|
||||
</ul>
|
||||
@ -60,7 +60,7 @@
|
||||
|
||||
<h4>Previous topic</h4>
|
||||
<p class="topless"><a href="index.html"
|
||||
title="previous chapter">Welcome to pyFTS’s documentation!</a></p>
|
||||
title="previous chapter">pyFTS - Fuzzy Time Series for Python</a></p>
|
||||
<h4>Next topic</h4>
|
||||
<p class="topless"><a href="modules.html"
|
||||
title="next chapter">pyFTS</a></p>
|
||||
@ -195,7 +195,7 @@
|
||||
<a href="modules.html" title="pyFTS"
|
||||
>next</a> |</li>
|
||||
<li class="right" >
|
||||
<a href="index.html" title="Welcome to pyFTS’s documentation!"
|
||||
<a href="index.html" title="pyFTS - Fuzzy Time Series for Python"
|
||||
>previous</a> |</li>
|
||||
<li class="nav-item nav-item-0"><a href="index.html">pyFTS 1.2.3 documentation</a> »</li>
|
||||
</ul>
|
||||
|
2
docs/build/html/searchindex.js
vendored
2
docs/build/html/searchindex.js
vendored
File diff suppressed because one or more lines are too long
@ -4,8 +4,8 @@
|
||||
contain the root `toctree` directive.
|
||||
|
||||
|
||||
Welcome to pyFTS's documentation!
|
||||
=================================
|
||||
pyFTS - Fuzzy Time Series for Python
|
||||
====================================
|
||||
|
||||
What is pyFTS Library?
|
||||
----------------------
|
||||
@ -14,6 +14,18 @@ What is pyFTS Library?
|
||||
.. image:: https://img.shields.io/badge/License-GPLv3-blue.svg
|
||||
.. image:: https://img.shields.io/badge/Made%20with-Python-1f425f.svg
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<style>
|
||||
#forkongithub a{ background:#000; color:#fff; text-decoration:none; font-family:arial,sans-serif;
|
||||
text-align:center;font-weight:bold;padding:5px 40px;font-size:1rem;line-height:2rem;position:relative;transition:0.5s;}#forkongithub a:hover{background:#c11;color:#fff;}
|
||||
#forkongithub a::before,#forkongithub a::after{content:"";width:100%;display:block;position:absolute;top:1px;left:0;height:1px;background:#fff;}
|
||||
#forkongithub a::after{bottom:1px;top:auto;}@media screen and (min-width:800px){
|
||||
#forkongithub{position:fixed;display:block;top:0;right:0;width:200px;overflow:hidden;height:200px;z-index:9999;}
|
||||
#forkongithub a{width:200px;position:absolute;top:60px;right:-60px;transform:rotate(45deg);-webkit-transform:rotate(45deg);-ms-transform:rotate(45deg);-moz-transform:rotate(45deg);-o-transform:rotate(45deg);box-shadow:4px 4px 10px rgba(0,0,0,0.8);}}
|
||||
</style>
|
||||
<span id="forkongithub"><a href="https://github.com/PYFTS/pyFTS">Fork me on GitHub</a></span>
|
||||
|
||||
This package is intended for students, researchers, data scientists or whose want to exploit the Fuzzy Time Series methods. These methods provide simple, easy to use, computationally cheap and human-readable models, suitable from statistic laymans to experts.
|
||||
|
||||
This tool is developed on `MINDS Lab <http://www.minds.eng.ufmg.br/>`_,
|
||||
|
@ -91,6 +91,18 @@ def __binary_search(x, fuzzy_sets, ordered_sets):
|
||||
|
||||
|
||||
def fuzzyfy(data, partitioner, **kwargs):
|
||||
"""
|
||||
A general method for fuzzyfication.
|
||||
|
||||
:param data: input value to be fuzzyfied
|
||||
:param partitioner: a trained pyFTS.partitioners.Partitioner object
|
||||
:param kwargs: dict, optional arguments
|
||||
|
||||
:keyword alpha_cut: the minimal membership value to be considered on fuzzyfication (only for mode='sets')
|
||||
:keyword method: the fuzzyfication method (fuzzy: all fuzzy memberships, maximum: only the maximum membership)
|
||||
:keyword mode: the fuzzyfication mode (sets: return the fuzzy sets names, vector: return a vector with the membership values for all fuzzy sets)
|
||||
:returns a list with the fuzzyfied values, depending on the mode
|
||||
"""
|
||||
alpha_cut = kwargs.get('alpha_cut', 0.)
|
||||
mode = kwargs.get('mode', 'sets')
|
||||
method = kwargs.get('method', 'fuzzy')
|
||||
|
29
pyFTS/partitioners/Singleton.py
Normal file
29
pyFTS/partitioners/Singleton.py
Normal file
@ -0,0 +1,29 @@
|
||||
"""Even Length Grid Partitioner"""
|
||||
|
||||
import numpy as np
|
||||
import math
|
||||
import random as rnd
|
||||
import functools, operator
|
||||
from pyFTS.common import FuzzySet, Membership
|
||||
from pyFTS.partitioners import partitioner
|
||||
|
||||
|
||||
class SingletonPartitioner(partitioner.Partitioner):
|
||||
"""Singleton Partitioner"""
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
"""
|
||||
Singleton Partitioner
|
||||
"""
|
||||
super(SingletonPartitioner, self).__init__(name="Singleton", **kwargs)
|
||||
|
||||
def build(self, data):
|
||||
sets = {}
|
||||
|
||||
for count, instance in enumerate(data):
|
||||
_name = self.get_name(count)
|
||||
sets[_name] = FuzzySet.FuzzySet(_name, Membership.singleton, [instance], instance)
|
||||
|
||||
kwargs = {'type': self.type, 'variable': self.variable}
|
||||
|
||||
return sets
|
Loading…
Reference in New Issue
Block a user