Skip to content

Commit c17796a

Browse files
committed
diagnostics: rename from hints
1 parent e691b1b commit c17796a

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

dataikuapi/dss/ml.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -253,49 +253,49 @@ def get_algorithm_settings(self, algorithm_name):
253253

254254
return self.mltask_settings["modeling"][algorithm_name.lower()]
255255

256-
def get_hints_settings(self):
256+
def get_diagnostics_settings(self):
257257
"""
258-
Gets the hints settings for a mltask. This returns a reference to the
259-
hints' settings, not a copy, so changes made to the returned object will be reflected when saving.
258+
Gets the diagnostics settings for a mltask. This returns a reference to the
259+
diagnostics' settings, not a copy, so changes made to the returned object will be reflected when saving.
260260
261261
This method returns a dictionary of the settings with:
262-
- 'enabled': indicates if the hints are enabled globally, if False, all hints will be disabled
262+
- 'enabled': indicates if the diagnostics are enabled globally, if False, all diagnostics will be disabled
263263
- 'settings': a list of dict comprised of:
264-
- 'type': the hint type
265-
- 'enabled': indicates if the hint type is enabled, if False, all hints of that type will be disabled
264+
- 'type': the diagnostic type
265+
- 'enabled': indicates if the diagnostic type is enabled, if False, all diagnostics of that type will be disabled
266266
267-
Please refer to the documentation for details on available hints.
267+
Please refer to the documentation for details on available diagnostics.
268268
269-
:return: A dict of hints settings
269+
:return: A dict of diagnostics settings
270270
:rtype: dict
271271
"""
272-
return self.mltask_settings["hintSettings"]
272+
return self.mltask_settings["diagnosticsSettings"]
273273

274-
def set_hints_enabled(self, enabled):
274+
def set_diagnostics_enabled(self, enabled):
275275
"""
276-
Globally enables or disables all hints.
276+
Globally enables or disables all diagnostics.
277277
278-
:param bool enabled: if the hints should be enabled or not
278+
:param bool enabled: if the diagnostics should be enabled or not
279279
"""
280-
settings = self.get_hints_settings()
280+
settings = self.get_diagnostics_settings()
281281
settings["enabled"] = enabled
282282

283-
def set_hint_type_enabled(self, hint_type, enabled):
283+
def set_diagnostic_type_enabled(self, diagnostic_type, enabled):
284284
"""
285-
Enables or disables a hint based on its type.
285+
Enables or disables a diagnostic based on its type.
286286
287-
Please refer to the documentation for details on available hints.
287+
Please refer to the documentation for details on available diagnostics.
288288
289-
:param str hint_type: Name (in capitals) of the hint type.
290-
:param bool enabled: if the hint should be enabled or not
289+
:param str diagnostic_type: Name (in capitals) of the diagnostic type.
290+
:param bool enabled: if the diagnostic should be enabled or not
291291
"""
292-
settings = self.get_hints_settings()["settings"]
293-
hint = [h for h in settings if h["type"] == hint_type]
294-
if len(hint) == 0:
295-
raise ValueError("Hint type '{}' not found in settings".format(hint_type))
296-
if len(hint) > 1:
297-
raise ValueError("Should not happen: multiple hint types '{}' found in settings".format(hint_type))
298-
hint[0]["enabled"] = enabled
292+
settings = self.get_diagnostics_settings()["settings"]
293+
diagnostic = [h for h in settings if h["type"] == diagnostic_type]
294+
if len(diagnostic) == 0:
295+
raise ValueError("Diagnostic type '{}' not found in settings".format(diagnostic_type))
296+
if len(diagnostic) > 1:
297+
raise ValueError("Should not happen: multiple diagnostic types '{}' found in settings".format(diagnostic_type))
298+
diagnostic[0]["enabled"] = enabled
299299

300300
def set_algorithm_enabled(self, algorithm_name, enabled):
301301
"""
@@ -587,45 +587,45 @@ def get_origin_analysis_trained_model(self):
587587
project_key=self.saved_model.project_key)
588588
return origin_ml_task.get_trained_model_details(fmi)
589589

590-
def get_hints(self):
590+
def get_diagnostics(self):
591591
"""
592-
Retrieves hints computed for this trained model
592+
Retrieves diagnostics computed for this trained model
593593
594-
:returns: list of hints
595-
:rtype: list of type `dataikuapi.dss.ml.DSSMLHint`
594+
:returns: list of diagnostics
595+
:rtype: list of type `dataikuapi.dss.ml.DSSMLDiagnostic`
596596
"""
597-
hints = self.details.get("trainHints", {})
598-
return [DSSMLHint(d) for d in hints.get("hints", [])]
597+
diagnostics = self.details.get("trainDiagnostics", {})
598+
return [DSSMLDiagnostic(d) for d in diagnostics.get("diagnostics", [])]
599599

600600

601-
class DSSMLHint(object):
601+
class DSSMLDiagnostic(object):
602602
"""
603-
Object that represents a computed Hint on a trained model
603+
Object that represents a computed Diagnostic on a trained model
604604
605-
Do not create this object directly, use :meth:`DSSTrainedModelDetails.get_hints()` instead
605+
Do not create this object directly, use :meth:`DSSTrainedModelDetails.get_diagnostics()` instead
606606
"""
607607

608608
def __init__(self, data):
609609
self._internal_dict = data
610610

611611
def get_raw(self):
612612
"""
613-
Gets the raw dictionary of the hint
613+
Gets the raw dictionary of the diagnostic
614614
615615
:rtype: dict
616616
"""
617617
return self._internal_dict
618618

619619
def get_type(self):
620620
"""
621-
Returns the base Hint type
621+
Returns the base Diagnostic type
622622
:rtype: str
623623
"""
624624
return self._internal_dict["type"]
625625

626626
def get_type_pretty(self):
627627
"""
628-
Returns the Hint type as displayed in the UI
628+
Returns the Diagnostic type as displayed in the UI
629629
:rtype: str
630630
"""
631631
return self._internal_dict["displayableType"]

0 commit comments

Comments
 (0)