Compare commits

...

3 Commits

Author SHA1 Message Date
sam
619c6ecd15 rename KMeans 2024-08-07 11:19:01 +04:00
sam
fac2aa5ca8 add python 3.11 support 2024-08-07 11:18:21 +04:00
sam
0329e7b83f copy .gitignore to root 2024-08-07 10:30:46 +04:00
7 changed files with 67 additions and 9 deletions

57
.gitignore vendored Normal file
View File

@ -0,0 +1,57 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/

View File

@ -104,7 +104,7 @@ pyFTS/models/seasonal/common.py
pyFTS/models/seasonal/msfts.py
pyFTS/models/seasonal/partitioner.py
pyFTS/models/seasonal/sfts.py
pyFTS/partitioners/CMeans.py
pyFTS/partitioners/KMeans.py
pyFTS/partitioners/Entropy.py
pyFTS/partitioners/FCM.py
pyFTS/partitioners/Grid.py

View File

@ -38,7 +38,7 @@ Fuzzy Time Series (FTS) are non parametric methods for time series forecasting b
2. **Universe of Discourse Partitioning**: This is the most important step. Here, the range of values of the numerical time series *Y(t)* will be splited in overlapped intervals and for each interval will be created a Fuzzy Set. This step is performed by pyFTS.partition module and its classes (for instance GridPartitioner, EntropyPartitioner, etc). The main parameters are:
- the number of intervals
- which fuzzy membership function (on [pyFTS.common.Membership](https://github.com/PYFTS/pyFTS/blob/master/pyFTS/common/Membership.py))
- partition scheme ([GridPartitioner](https://github.com/PYFTS/pyFTS/blob/master/pyFTS/partitioners/Grid.py), [EntropyPartitioner](https://github.com/PYFTS/pyFTS/blob/master/pyFTS/partitioners/Entropy.py)[3], [FCMPartitioner](https://github.com/PYFTS/pyFTS/blob/master/pyFTS/partitioners/FCM.py), [CMeansPartitioner](https://github.com/PYFTS/pyFTS/blob/master/pyFTS/partitioners/CMeans.py), [HuarngPartitioner](https://github.com/PYFTS/pyFTS/blob/master/pyFTS/partitioners/Huarng.py)[4])
- partition scheme ([GridPartitioner](https://github.com/PYFTS/pyFTS/blob/master/pyFTS/partitioners/Grid.py), [EntropyPartitioner](https://github.com/PYFTS/pyFTS/blob/master/pyFTS/partitioners/Entropy.py)[3], [FCMPartitioner](https://github.com/PYFTS/pyFTS/blob/master/pyFTS/partitioners/FCM.py), [KMeansPartitioner](https://github.com/PYFTS/pyFTS/blob/master/pyFTS/partitioners/KMeans.py), [HuarngPartitioner](https://github.com/PYFTS/pyFTS/blob/master/pyFTS/partitioners/Huarng.py)[4])
Check out the jupyter notebook on [notebooks/Partitioners.ipynb](https://github.com/PYFTS/notebooks/blob/master/Partitioners.ipynb) for sample codes.

View File

@ -28,10 +28,10 @@ pyFTS.partitioners.Class module
:undoc-members:
:show-inheritance:
pyFTS.partitioners.CMeans module
pyFTS.partitioners.KMeans module
--------------------------------
.. automodule:: pyFTS.partitioners.CMeans
.. automodule:: pyFTS.partitioners.KMeans
:members:
:undoc-members:
:show-inheritance:

View File

@ -14,7 +14,7 @@ def distance(x, y):
return math.sqrt(tmp)
def c_means(k, dados, tam):
def k_means(k, dados, tam):
# Инициализирует центроиды, выбирая случайные элементы из множества
centroides = [dados[rnd.randint(0, len(dados)-1)] for kk in range(0, k)]
@ -77,16 +77,16 @@ def c_means(k, dados, tam):
return centroides
class CMeansPartitioner(partitioner.Partitioner):
class KMeansPartitioner(partitioner.Partitioner):
def __init__(self, **kwargs):
super(CMeansPartitioner, self).__init__(name="CMeans", **kwargs)
super(KMeansPartitioner, self).__init__(name="KMeans", **kwargs)
def build(self, data):
sets = {}
kwargs = {'type': self.type, 'variable': self.variable}
centroides = c_means(self.partitions, data, 1)
centroides = k_means(self.partitions, data, 1)
centroides = [v[0] for v in centroides]
centroides.append(self.max)
centroides.append(self.min)

View File

@ -11,7 +11,7 @@ from mpl_toolkits.mplot3d import Axes3D
import datetime
import pandas as pd
from pyFTS.partitioners import Grid, CMeans, FCM, Entropy
from pyFTS.partitioners import Grid, KMeans, FCM, Entropy
from pyFTS.common import FLR, FuzzySet, Membership, Transformations, Util, fts
from pyFTS import sfts
from pyFTS.models import msfts

View File

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