1.0 MiB
1.0 MiB
Exploring the Universe of Discourse Partitioners¶
Environment Setup¶
Library install/update¶
In [1]:
# !pip install -U --force-reinstall --no-deps -e git+https://git.athene.tech/sam/pyFTS.git#egg=pyFTS
External libraries import¶
In [2]:
import warnings
warnings.filterwarnings('ignore')
import matplotlib.pylab as plt
%pylab inline
Common pyFTS imports¶
In [3]:
from pyFTS.partitioners import KMeans, Grid, FCM, Huarng, Entropy, Util as pUtil
from pyFTS.common import Membership as mf
from pyFTS.benchmarks import benchmarks as bchmk
from pyFTS.data import Enrollments
Common data transformations¶
In [4]:
from pyFTS.common import Transformations
tdiff = Transformations.Differential(1)
Dataset¶
Data Loading¶
In [5]:
from pyFTS.data import TAIEX
dataset = TAIEX.get_data()
dataset_diff = tdiff.apply(dataset)
Visualization¶
In [6]:
fig, ax = plt.subplots(nrows=2, ncols=1, figsize=[10,5])
ax[0].plot(dataset)
ax[1].plot(dataset_diff)
Out[6]:
Exploring partitioning schemes¶
Same method with different membership functions¶
In [7]:
part = pUtil.explore_partitioners(dataset, 20, methods=[Grid.GridPartitioner],
mf=[mf.trimf, mf.trapmf, mf.gaussmf])
In [8]:
# for p in part:
# print(p)
Same mathod with different membership functions and transformation¶
In [9]:
part = pUtil.explore_partitioners(dataset, 10, methods=[Grid.GridPartitioner],
mf=[mf.trimf, mf.trapmf, mf.gaussmf], transformation=tdiff)
In [10]:
# for p in part:
# print(p)
Several different mathods¶
In [13]:
# part = pUtil.explore_partitioners(dataset, 10, methods=[Huarng.HuarngPartitioner],
# mf=[mf.trimf], transformation=tdiff)
In [14]:
part = pUtil.explore_partitioners(dataset, 10, methods=[Grid.GridPartitioner,
KMeans.KMeansPartitioner,
FCM.FCMPartitioner,
Entropy.EntropyPartitioner],
mf=[mf.trimf])
In [15]:
for p in part:
print(p)