def accumulate(self,variable,segment_size=None): """combining adjective values into one set""" self.activated_sets = {} temp = None for name,adjective in variable.adjectives.items(): # get precomputed adjective set temp2 = norm((self.INF or self._INF),adjective.set,adjective.getMembership(),segment_size) self.activated_sets[name] = temp2 # accumulate all adjectives if temp is None: temp = temp2 else: temp = merge((self.ACC or self._ACC),temp,temp2,segment_size) self.accumulated_set = temp return temp
def accumulate(self, variable, segment_size=None): """combining adjective values into one set""" self.activated_sets = {} temp = None for name, adjective in variable.adjectives.items(): # get precomputed adjective set temp2 = norm((self.INF or self._INF), adjective.set, adjective.getMembership(), segment_size) self.activated_sets[name] = temp2 # accumulate all adjectives if temp is None: temp = temp2 else: temp = merge((self.ACC or self._ACC), temp, temp2, segment_size) self.accumulated_set = temp return temp
def getPoints(sets): """Collect all important points of all adjectives in this dict of sets.""" from fuzzy.set.Set import merge # merge them all temp = None for s in sets.values(): if temp is None: temp = s else: temp = merge(max,temp,s) # collect points # >>> result of merge is always a Polygon object points = [p[0] for p in temp.points] # avoid to have same value twice (filter points out where successor is equal) return points[:1] + [p0 for p0,p1 in zip(points[1:],points) if p0!=p1]
def getPoints(sets): """Collect all important points of all adjectives in this dict of sets.""" from fuzzy.set.Set import merge # merge them all temp = None for s in sets.values(): if temp is None: temp = s else: temp = merge(max,temp,s) # collect points # >>> result of merge is always a Polygon object points = [p[0] for p in temp.points] # avoid to have same value twice (filter points out where successor is equal) return points[:1] + [p0 for p0,p1 in zip(points[1:],points) if p0!=p1]