Source code for pyFTS.partitioners.Singleton
"""Even Length Grid Partitioner"""
import numpy as np
import math
import random as rnd
import functools, operator
from pyFTS.common import FuzzySet, Membership
from pyFTS.partitioners import partitioner
[docs]class SingletonPartitioner(partitioner.Partitioner):
"""Singleton Partitioner"""
def __init__(self, **kwargs):
"""
Singleton Partitioner
"""
super(SingletonPartitioner, self).__init__(name="Singleton", **kwargs)
[docs] def build(self, data):
sets = {}
for count, instance in enumerate(data):
_name = self.get_name(count)
sets[_name] = FuzzySet.FuzzySet(_name, Membership.singleton, [instance], instance)
kwargs = {'type': self.type, 'variable': self.variable}
return sets