Skip to content

Commit 71a71e9

Browse files
committed
add method to check whether there is a time ordering
1 parent c6735c8 commit 71a71e9

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

dataikuapi/dss/ml.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,19 @@ def unset_time_ordering(self):
170170

171171
return self
172172

173+
def has_time_ordering(self):
174+
"""
175+
:return: whether the splitting uses time ordering
176+
:rtype: bool
177+
"""
178+
return 'time' in self.mltask_settings and self.mltask_settings['time']['enabled']
179+
173180
def get_time_ordering_variable(self):
174181
"""
175182
:return: the name of the variable
176183
:rtype: str
177184
"""
178-
if 'time' in self.mltask_settings and self.mltask_settings['time']['enabled']:
185+
if self.has_time_ordering():
179186
return self.mltask_settings['time']['timeVariable']
180187
else:
181188
warnings.warn("Time-based ordering is disabled in the current MLTask")
@@ -185,7 +192,7 @@ def is_time_ordering_ascending(self):
185192
:return: True if the ordering is set to be ascending with respect to the time-ordering variable
186193
:rtype: bool
187194
"""
188-
if 'time' in self.mltask_settings and self.mltask_settings['time']['enabled']:
195+
if self.has_time_ordering():
189196
return self.mltask_settings['time']['ascending']
190197
else:
191198
warnings.warn("Time-based ordering is disabled in the current MLTask")

0 commit comments

Comments
 (0)