Refactoring and documentation updates

This commit is contained in:
Petrônio Cândido 2023-05-24 20:18:52 -03:00
parent 471d7b2f48
commit 02f6022a53
14 changed files with 150 additions and 23 deletions

Binary file not shown.

Binary file not shown.

View File

@ -94,7 +94,7 @@
<li><a href="pyFTS/models/seasonal/common.html">pyFTS.models.seasonal.common</a></li>
<li><a href="pyFTS/models/seasonal/partitioner.html">pyFTS.models.seasonal.partitioner</a></li>
<li><a href="pyFTS/partitioners/CMeans.html">pyFTS.partitioners.CMeans</a></li>
<li><a href="pyFTS/partitioners/ClassPartitioner.html">pyFTS.partitioners.ClassPartitioner</a></li>
<li><a href="pyFTS/partitioners/Class.html">pyFTS.partitioners.Class</a></li>
<li><a href="pyFTS/partitioners/Entropy.html">pyFTS.partitioners.Entropy</a></li>
<li><a href="pyFTS/partitioners/FCM.html">pyFTS.partitioners.FCM</a></li>
<li><a href="pyFTS/partitioners/Grid.html">pyFTS.partitioners.Grid</a></li>

View File

@ -0,0 +1,126 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>pyFTS.partitioners.Class &#8212; pyFTS 1.7 documentation</title>
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css" />
<link rel="stylesheet" type="text/css" href="../../../_static/bizstyle.css" />
<script data-url_root="../../../" id="documentation_options" src="../../../_static/documentation_options.js"></script>
<script src="../../../_static/jquery.js"></script>
<script src="../../../_static/underscore.js"></script>
<script src="../../../_static/doctools.js"></script>
<script src="../../../_static/bizstyle.js"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<!--[if lt IE 9]>
<script src="_static/css3-mediaqueries.js"></script>
<![endif]-->
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">pyFTS 1.7 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../index.html" accesskey="U">Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">pyFTS.partitioners.Class</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<h1>Source code for pyFTS.partitioners.Class</h1><div class="highlight"><pre>
<span></span><span class="sd">&quot;&quot;&quot;Class Partitioner with Singleton Fuzzy Sets&quot;&quot;&quot;</span>
<span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="kn">import</span> <span class="nn">math</span>
<span class="kn">import</span> <span class="nn">random</span> <span class="k">as</span> <span class="nn">rnd</span>
<span class="kn">import</span> <span class="nn">functools</span><span class="o">,</span> <span class="nn">operator</span>
<span class="kn">from</span> <span class="nn">pyFTS.common</span> <span class="kn">import</span> <span class="n">FuzzySet</span><span class="p">,</span> <span class="n">Membership</span>
<span class="kn">from</span> <span class="nn">pyFTS.partitioners</span> <span class="kn">import</span> <span class="n">partitioner</span>
<div class="viewcode-block" id="ClassPartitioner"><a class="viewcode-back" href="../../../pyFTS.partitioners.html#pyFTS.partitioners.Class.ClassPartitioner">[docs]</a><span class="k">class</span> <span class="nc">ClassPartitioner</span><span class="p">(</span><span class="n">partitioner</span><span class="o">.</span><span class="n">Partitioner</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Class Partitioner: Given a dictionary with class/values pairs, create singleton fuzzy sets for each class&quot;&quot;&quot;</span>
<span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Class Partitioner</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="nb">super</span><span class="p">(</span><span class="n">ClassPartitioner</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s2">&quot;Class&quot;</span><span class="p">,</span> <span class="n">preprocess</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span> <span class="o">=</span> <span class="p">[]</span>
<span class="bp">self</span><span class="o">.</span><span class="n">min</span> <span class="o">=</span> <span class="mi">0</span>
<span class="bp">self</span><span class="o">.</span><span class="n">max</span> <span class="o">=</span> <span class="mi">0</span>
<span class="bp">self</span><span class="o">.</span><span class="n">partitions</span> <span class="o">=</span> <span class="mi">0</span>
<span class="n">classes</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;classes&quot;</span><span class="p">,</span> <span class="p">{})</span>
<span class="k">for</span> <span class="n">k</span><span class="p">,</span><span class="n">v</span> <span class="ow">in</span> <span class="n">classes</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="bp">self</span><span class="o">.</span><span class="n">min</span> <span class="o">=</span> <span class="nb">min</span><span class="p">([</span><span class="bp">self</span><span class="o">.</span><span class="n">min</span><span class="p">,</span> <span class="n">v</span><span class="p">])</span>
<span class="bp">self</span><span class="o">.</span><span class="n">max</span> <span class="o">=</span> <span class="nb">max</span><span class="p">([</span><span class="bp">self</span><span class="o">.</span><span class="n">max</span><span class="p">,</span> <span class="n">v</span><span class="p">])</span>
<span class="bp">self</span><span class="o">.</span><span class="n">partitions</span> <span class="o">+=</span> <span class="mi">1</span>
<span class="bp">self</span><span class="o">.</span><span class="n">sets</span><span class="p">[</span><span class="n">k</span><span class="p">]</span> <span class="o">=</span> <span class="n">FuzzySet</span><span class="o">.</span><span class="n">FuzzySet</span><span class="p">(</span><span class="n">k</span><span class="p">,</span> <span class="n">Membership</span><span class="o">.</span><span class="n">singleton</span><span class="p">,</span> <span class="p">[</span><span class="n">v</span><span class="p">],</span> <span class="n">v</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">ordered_sets</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">k</span><span class="p">)</span>
<div class="viewcode-block" id="ClassPartitioner.build"><a class="viewcode-back" href="../../../pyFTS.partitioners.html#pyFTS.partitioners.Class.ClassPartitioner.build">[docs]</a> <span class="k">def</span> <span class="nf">build</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span> <span class="p">:</span> <span class="nb">list</span><span class="p">):</span>
<span class="k">pass</span></div></div>
</pre></div>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../../index.html">
<img class="logo" src="../../../_static/logo_heading2.png" alt="Logo"/>
</a></p>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../index.html">pyFTS 1.7 documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../index.html" >Module code</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">pyFTS.partitioners.Class</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2022, Machine Intelligence and Data Science Laboratory - UFMG - Brazil.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 4.3.2.
</div>
</body>
</html>

View File

@ -20,10 +20,10 @@ pyFTS.partitioners.partitioner module
:undoc-members:
:show-inheritance:
pyFTS.partitioners.ClassPartitioner module
-----------------------------------
pyFTS.partitioners.Class module
-------------------------------
.. automodule:: pyFTS.partitioners.ClassPartitioner
.. automodule:: pyFTS.partitioners.Class
:members:
:undoc-members:
:show-inheritance:

View File

@ -159,7 +159,7 @@
</li>
<li><a href="pyFTS.models.seasonal.html#pyFTS.models.seasonal.partitioner.TimeGridPartitioner.build">(pyFTS.models.seasonal.partitioner.TimeGridPartitioner method)</a>
</li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.ClassPartitioner.ClassPartitioner.build">(pyFTS.partitioners.ClassPartitioner.ClassPartitioner method)</a>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.Class.ClassPartitioner.build">(pyFTS.partitioners.Class.ClassPartitioner method)</a>
</li>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.CMeans.CMeansPartitioner.build">(pyFTS.partitioners.CMeans.CMeansPartitioner method)</a>
</li>
@ -216,7 +216,7 @@
</ul></li>
</ul></td>
<td style="width: 33%; vertical-align: top;"><ul>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.ClassPartitioner.ClassPartitioner">ClassPartitioner (class in pyFTS.partitioners.ClassPartitioner)</a>
<li><a href="pyFTS.partitioners.html#pyFTS.partitioners.Class.ClassPartitioner">ClassPartitioner (class in pyFTS.partitioners.Class)</a>
</li>
<li><a href="pyFTS.common.html#pyFTS.common.SortedCollection.SortedCollection.clear">clear() (pyFTS.common.SortedCollection.SortedCollection method)</a>
</li>
@ -876,7 +876,7 @@
</li>
<li><a href="pyFTS.partitioners.html#module-pyFTS.partitioners">pyFTS.partitioners</a>
</li>
<li><a href="pyFTS.partitioners.html#module-pyFTS.partitioners.ClassPartitioner">pyFTS.partitioners.ClassPartitioner</a>
<li><a href="pyFTS.partitioners.html#module-pyFTS.partitioners.Class">pyFTS.partitioners.Class</a>
</li>
<li><a href="pyFTS.partitioners.html#module-pyFTS.partitioners.CMeans">pyFTS.partitioners.CMeans</a>
</li>
@ -1468,10 +1468,10 @@
</li>
</ul></li>
<li>
pyFTS.partitioners.ClassPartitioner
pyFTS.partitioners.Class
<ul>
<li><a href="pyFTS.partitioners.html#module-pyFTS.partitioners.ClassPartitioner">module</a>
<li><a href="pyFTS.partitioners.html#module-pyFTS.partitioners.Class">module</a>
</li>
</ul></li>
<li>

Binary file not shown.

View File

@ -389,7 +389,7 @@
<tr class="cg-1">
<td></td>
<td>&#160;&#160;&#160;
<a href="pyFTS.partitioners.html#module-pyFTS.partitioners.ClassPartitioner"><code class="xref">pyFTS.partitioners.ClassPartitioner</code></a></td><td>
<a href="pyFTS.partitioners.html#module-pyFTS.partitioners.Class"><code class="xref">pyFTS.partitioners.Class</code></a></td><td>
<em></em></td></tr>
<tr class="cg-1">
<td></td>

View File

@ -221,7 +221,7 @@
<li class="toctree-l2"><a class="reference internal" href="pyFTS.partitioners.html#module-pyFTS.partitioners">Module contents</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.partitioners.html#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.partitioners.html#module-pyFTS.partitioners.partitioner">pyFTS.partitioners.partitioner module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.partitioners.html#pyfts-partitioners-classpartitioner-module">pyFTS.partitioners.ClassPartitioner module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.partitioners.html#module-pyFTS.partitioners.Class">pyFTS.partitioners.Class module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.partitioners.html#module-pyFTS.partitioners.CMeans">pyFTS.partitioners.CMeans module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.partitioners.html#module-pyFTS.partitioners.Entropy">pyFTS.partitioners.Entropy module</a></li>
<li class="toctree-l2"><a class="reference internal" href="pyFTS.partitioners.html#module-pyFTS.partitioners.FCM">pyFTS.partitioners.FCM module</a></li>

View File

@ -299,17 +299,17 @@ overlapped fuzzy sets.</p>
</dd></dl>
</section>
<section id="pyfts-partitioners-classpartitioner-module">
<h2>pyFTS.partitioners.ClassPartitioner module<a class="headerlink" href="#pyfts-partitioners-classpartitioner-module" title="Permalink to this headline"></a></h2>
<span class="target" id="module-pyFTS.partitioners.ClassPartitioner"></span><p>Class Partitioner with Singleton Fuzzy Sets</p>
<section id="module-pyFTS.partitioners.Class">
<span id="pyfts-partitioners-class-module"></span><h2>pyFTS.partitioners.Class module<a class="headerlink" href="#module-pyFTS.partitioners.Class" title="Permalink to this headline"></a></h2>
<p>Class Partitioner with Singleton Fuzzy Sets</p>
<dl class="py class">
<dt class="sig sig-object py" id="pyFTS.partitioners.ClassPartitioner.ClassPartitioner">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pyFTS.partitioners.ClassPartitioner.</span></span><span class="sig-name descname"><span class="pre">ClassPartitioner</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/partitioners/ClassPartitioner.html#ClassPartitioner"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pyFTS.partitioners.ClassPartitioner.ClassPartitioner" title="Permalink to this definition"></a></dt>
<dt class="sig sig-object py" id="pyFTS.partitioners.Class.ClassPartitioner">
<em class="property"><span class="pre">class</span><span class="w"> </span></em><span class="sig-prename descclassname"><span class="pre">pyFTS.partitioners.Class.</span></span><span class="sig-name descname"><span class="pre">ClassPartitioner</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">kwargs</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/partitioners/Class.html#ClassPartitioner"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pyFTS.partitioners.Class.ClassPartitioner" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#pyFTS.partitioners.partitioner.Partitioner" title="pyFTS.partitioners.partitioner.Partitioner"><code class="xref py py-class docutils literal notranslate"><span class="pre">pyFTS.partitioners.partitioner.Partitioner</span></code></a></p>
<p>Class Partitioner: Given a dictionary with class/values pairs, create singleton fuzzy sets for each class</p>
<dl class="py method">
<dt class="sig sig-object py" id="pyFTS.partitioners.ClassPartitioner.ClassPartitioner.build">
<span class="sig-name descname"><span class="pre">build</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.11)"><span class="pre">list</span></a></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/partitioners/ClassPartitioner.html#ClassPartitioner.build"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pyFTS.partitioners.ClassPartitioner.ClassPartitioner.build" title="Permalink to this definition"></a></dt>
<dt class="sig sig-object py" id="pyFTS.partitioners.Class.ClassPartitioner.build">
<span class="sig-name descname"><span class="pre">build</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">data</span></span><span class="p"><span class="pre">:</span></span><span class="w"> </span><span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.11)"><span class="pre">list</span></a></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/pyFTS/partitioners/Class.html#ClassPartitioner.build"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#pyFTS.partitioners.Class.ClassPartitioner.build" title="Permalink to this definition"></a></dt>
<dd><p>Perform the partitioning of the Universe of Discourse</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
@ -604,7 +604,7 @@ Comput. Math. Appl., vol. 56, no. 12, pp. 30523063, Dec. 2008. DOI: 10.1016/j
<li><a class="reference internal" href="#module-pyFTS.partitioners">Module contents</a></li>
<li><a class="reference internal" href="#submodules">Submodules</a></li>
<li><a class="reference internal" href="#module-pyFTS.partitioners.partitioner">pyFTS.partitioners.partitioner module</a></li>
<li><a class="reference internal" href="#pyfts-partitioners-classpartitioner-module">pyFTS.partitioners.ClassPartitioner module</a></li>
<li><a class="reference internal" href="#module-pyFTS.partitioners.Class">pyFTS.partitioners.Class module</a></li>
<li><a class="reference internal" href="#module-pyFTS.partitioners.CMeans">pyFTS.partitioners.CMeans module</a></li>
<li><a class="reference internal" href="#module-pyFTS.partitioners.Entropy">pyFTS.partitioners.Entropy module</a></li>
<li><a class="reference internal" href="#module-pyFTS.partitioners.FCM">pyFTS.partitioners.FCM module</a></li>

File diff suppressed because one or more lines are too long

View File

@ -20,10 +20,10 @@ pyFTS.partitioners.partitioner module
:undoc-members:
:show-inheritance:
pyFTS.partitioners.ClassPartitioner module
-----------------------------------
pyFTS.partitioners.Class module
-------------------------------
.. automodule:: pyFTS.partitioners.ClassPartitioner
.. automodule:: pyFTS.partitioners.Class
:members:
:undoc-members:
:show-inheritance:

View File

@ -25,6 +25,7 @@ setuptools.setup(
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.10',
'Intended Audience :: Science/Research',
'Intended Audience :: Developers',
'Intended Audience :: Education',