diff --git a/pyFTS/common/Composite.py b/pyFTS/common/Composite.py index eea3879..36dadb5 100644 --- a/pyFTS/common/Composite.py +++ b/pyFTS/common/Composite.py @@ -76,3 +76,9 @@ class FuzzySet(FuzzySet.FuzzySet): if self.centroid is None or self.centroid < set.centroid: self.centroid = set.centroid + + def __str__(self): + tmp = str([str(k) for k in self.sets]) + return "{}: {}".format(self.name, tmp) + + diff --git a/pyFTS/models/seasonal/partitioner.py b/pyFTS/models/seasonal/partitioner.py index b894909..8f48af0 100644 --- a/pyFTS/models/seasonal/partitioner.py +++ b/pyFTS/models/seasonal/partitioner.py @@ -50,6 +50,11 @@ class TimeGridPartitioner(partitioner.Partitioner): if self.season == DateTime.year: dlen = (self.max - self.min) partlen = dlen / self.partitions + elif self.season == DateTime.day_of_week: + self.min = 1 + self.max = 8 + partlen = 1 + pl2 = 1 else: partlen = self.season.value / self.partitions pl2 = partlen / 2 diff --git a/pyFTS/tests/multivariate.py b/pyFTS/tests/multivariate.py index d2682b5..3a2f190 100644 --- a/pyFTS/tests/multivariate.py +++ b/pyFTS/tests/multivariate.py @@ -103,13 +103,16 @@ dataset['date'] = pd.to_datetime(dataset["date"], format='%Y-%m-%d %H:%M:%S') train_mv = dataset.iloc[:24505] test_mv = dataset.iloc[24505:] -sp = {'seasonality': DateTime.minute_of_day, 'names': [str(k)+'hs' for k in range(0,24)]} - sp = {'seasonality': DateTime.day_of_week, 'names': ['mon','tue','wed','tur','fri','sat','sun']} vday = variable.Variable("DayOfWeek", data_label="date", partitioner=seasonal.TimeGridPartitioner, npart=7, data=train_mv, partitioner_specific=sp) + +print(vday.partitioner) + + +sp = {'seasonality': DateTime.minute_of_day, 'names': [str(k)+'hs' for k in range(0,24)]} vhour = variable.Variable("Hour", data_label="date", partitioner=seasonal.TimeGridPartitioner, npart=24, data=train_mv, partitioner_specific=sp, data_type=pd.datetime, mask='%Y-%m-%d %H:%M:%S')