rename KMeans

This commit is contained in:
Антон Скалкин 2024-08-07 11:19:01 +04:00
parent fac2aa5ca8
commit 619c6ecd15
5 changed files with 9 additions and 9 deletions

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