Compare commits
No commits in common. "a8fb849bc8d2d5b7dee6c61a0c40f1634d3adc2c" and "619c6ecd15894d8e50e7b75fea38eb14826ceae9" have entirely different histories.
a8fb849bc8
...
619c6ecd15
@ -36,7 +36,7 @@ def fuzzy_cmeans(k, data, size, m, deltadist=0.001):
|
||||
centroids = [data[rnd.randint(0, data_length - 1)] for kk in range(0, k)]
|
||||
|
||||
# Membership table
|
||||
membership_table = np.zeros((data_length, k))
|
||||
membership_table = np.zeros((k, data_length)) #[[0 for kk in range(0, k)] for xx in range(0, data_length)]
|
||||
|
||||
mean_change = 1000
|
||||
|
||||
@ -50,12 +50,12 @@ def fuzzy_cmeans(k, data, size, m, deltadist=0.001):
|
||||
inst_count = 0
|
||||
for instance in data:
|
||||
|
||||
dist_groups = np.zeros(k)
|
||||
dist_groups = np.zeros(k) #[0 for xx in range(0, k)]
|
||||
|
||||
for group_count, group in enumerate(centroids):
|
||||
dist_groups[group_count] = fuzzy_distance(group, instance)
|
||||
|
||||
# dist_groups_total = functools.reduce(operator.add, [xk for xk in dist_groups])
|
||||
dist_groups_total = functools.reduce(operator.add, [xk for xk in dist_groups])
|
||||
|
||||
for grp in range(0, k):
|
||||
if dist_groups[grp] == 0:
|
||||
|
@ -87,9 +87,9 @@ class KMeansPartitioner(partitioner.Partitioner):
|
||||
kwargs = {'type': self.type, 'variable': self.variable}
|
||||
|
||||
centroides = k_means(self.partitions, data, 1)
|
||||
centroides = [v[0] for v in centroides]
|
||||
centroides.append(self.max)
|
||||
centroides.append(self.min)
|
||||
centroides = list(set(centroides))
|
||||
centroides.sort()
|
||||
for c in range(1, len(centroides) - 1):
|
||||
_name = self.get_name(c)
|
||||
|
@ -24,14 +24,13 @@ def plot_sets(sets: dict, titles : list, size=[12, 10], save=False, file=None, a
|
||||
|
||||
"""
|
||||
num = len(sets)
|
||||
num_cols_plot = 1
|
||||
|
||||
if axis is None:
|
||||
fig, axes = plt.subplots(nrows=num, ncols=num_cols_plot, figsize=size, squeeze=False)
|
||||
for k in range(num):
|
||||
fig, axes = plt.subplots(nrows=num, ncols=1, figsize=size)
|
||||
for k in np.arange(0,num):
|
||||
ticks = []
|
||||
x = []
|
||||
ax = axes[k, num_cols_plot-1] if axis is None else axis
|
||||
ax = axes[k] if axis is None else axis
|
||||
ax.set_title(titles[k])
|
||||
ax.set_ylim([0, 1.1])
|
||||
for key in sets[k].keys():
|
||||
|
@ -1,7 +1,6 @@
|
||||
from pyFTS.common import FuzzySet, Membership
|
||||
import numpy as np
|
||||
from scipy.spatial import KDTree
|
||||
import warnings
|
||||
|
||||
|
||||
class Partitioner(object):
|
||||
@ -46,9 +45,6 @@ class Partitioner(object):
|
||||
if kwargs.get('preprocess',True):
|
||||
|
||||
data = kwargs.get('data',[None])
|
||||
|
||||
if len(data.shape) > 1:
|
||||
warnings.warn(f"An ndarray of dimension greater than 1 is used. shape.len(): {len(data.shape)}")
|
||||
|
||||
if self.indexer is not None:
|
||||
ndata = self.indexer.get_data(data)
|
||||
|
Loading…
Reference in New Issue
Block a user