From 7820d9f2911f5074db7128a2b573719717b29bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=C3=B4nio=20C=C3=A2ndido?= Date: Tue, 3 Nov 2020 14:17:12 -0300 Subject: [PATCH] PrefixedGridPartitioner --- pyFTS/partitioners/Grid.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pyFTS/partitioners/Grid.py b/pyFTS/partitioners/Grid.py index dc93ca0..2b1b14f 100644 --- a/pyFTS/partitioners/Grid.py +++ b/pyFTS/partitioners/Grid.py @@ -40,3 +40,36 @@ class GridPartitioner(partitioner.Partitioner): self.min = self.min - partlen return sets + + +class PreFixedGridPartitioner(GridPartitioner): + """Prefixed UoD with Even Length Grid Partitioner""" + + def __init__(self, **kwargs): + """ + Fixed UoD with Even Length Grid Partitioner + """ + + kwargs['preprocess'] = False + + super(GridPartitioner, self).__init__(name="Grid", **kwargs) + + self.max = kwargs.get('max', None) + self.min = kwargs.get('min', None) + + if self.max is None or self.min is None: + raise Exception("It is mandatory to inform the max and min parameters!") + + self.sets = self.build(None) + + self.partitions = len(self.sets) + + if self.ordered_sets is None and self.setnames is not None: + self.ordered_sets = self.setnames[:len(self.sets)] + else: + self.ordered_sets = FuzzySet.set_ordered(self.sets) + + + + +