Bugfix in seasonal.partitioners for DateTime.day_of_week
This commit is contained in:
parent
85ff48f48f
commit
e36ce6692e
@ -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)
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user