Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
e3586ca
Add assertions settings public api methods
Dec 2, 2020
067a9a5
Fix typo
Dec 2, 2020
7013c5f
Add assertion results methods
Dec 2, 2020
4d599c5
Clean up
Dec 3, 2020
e276feb
Clean up
Dec 3, 2020
ab5f5dc
Clean up
Dec 3, 2020
190676c
Wording
Dec 4, 2020
fe84039
Clarify expected_valid_ratio parameter docstring
Dec 4, 2020
da7a645
Wording
Dec 4, 2020
7b56a08
Simplify exception message
Dec 4, 2020
4bfcf0d
Clarify exception message
Dec 4, 2020
537cd67
Wording
Dec 4, 2020
15343ea
Remove checks for assertion names uniqueness and reanme param to para…
Dec 7, 2020
5d2ab2d
Fix typo
Dec 7, 2020
56ae941
Remove leftover check
Dec 7, 2020
6604136
Rename create_from_* methods to from_*
Dec 7, 2020
86a7c9a
Change expected_range to expected_min and expected_max
Dec 7, 2020
7aeafa2
Wording
Dec 7, 2020
c740435
Rename functions and clean up
Dec 7, 2020
314cbd2
Fix some wording and indent
Dec 8, 2020
0a5d7c6
Clean up
Dec 8, 2020
852eb31
Clean up
Dec 8, 2020
1d541a3
Clean up
Dec 8, 2020
0f883c5
Update variables names after dip variables renaming
Dec 11, 2020
39981e9
Rename from_parts to from_params and fix return types
Dec 14, 2020
62a47bd
Add repr to conditon and assertionParam
Dec 14, 2020
be2dbd2
Add repr to assertionMetrics
Dec 14, 2020
7942ac6
Unify class references
Dec 14, 2020
5c79555
Unify method references
Dec 14, 2020
a04634f
Add blank lines before :param
Dec 16, 2020
cc2b382
Add blank lines before :rtype when no other keyword
Dec 16, 2020
0599c60
Remove breaklines in reprs
Dec 16, 2020
c8f3679
Change metric to metrics
Dec 16, 2020
e020979
Replace access to internal dict by get raw
Dec 16, 2020
8317ada
Add two missing reprs and fix one
Dec 16, 2020
591d6aa
Add comment to help build condition filter
Dec 16, 2020
b10aa6f
Fix typos
Dec 16, 2020
75a755e
Add get_assertions_names
Dec 16, 2020
339cbc9
Fix typo
Dec 16, 2020
c655c56
Unify reprs
Dec 16, 2020
018bed2
Wording
Dec 16, 2020
f2a1886
Nitpicks
Dec 18, 2020
5eecb22
Add forgotten :meth:
Dec 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 11 additions & 22 deletions dataikuapi/dss/ml.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,15 +434,15 @@ def get_split_params(self):
@property
def assertions_params(self):
"""
Retrieves the assertions params for this ml task
Retrieves the assertions parameters for this ml task

:rtype: :class:`dataikuapi.dss.ml.DSSMLAssertionsParams`
"""
return self.get_assertions_params()

def get_assertions_params(self):
"""
Retrieves the assertions params for this ml task
Retrieves the assertions parameters for this ml task

:rtype: :class:`dataikuapi.dss.ml.DSSMLAssertionsParams`
"""
Expand Down Expand Up @@ -666,31 +666,19 @@ class DSSMLAssertionsParams(object):
Do not create this object directly, use :meth:`DSSPredictionMLTaskSettings.get_assertions_params()` instead
"""

@staticmethod
def check_assertion_names_are_uniq(assertion_params_list):
_ = {}
for assertion_dict in assertion_params_list:
if 'name' not in assertion_dict:
raise ValueError('No name provided for assertion')
if assertion_dict['name'] in _:
raise ValueError('Assertion names must be unique, but got multiple instances of: {}'.format(
assertion_dict['name']))
_[assertion_dict['name']] = True

def __init__(self, data):
self._internal_dict = data
self.check_assertion_names_are_uniq(data["assertions"])

def get_raw(self):
"""
Gets the raw dictionary of the assertions params
Gets the raw dictionary of the assertions parameters
:rtype: dict
"""
return self._internal_dict

def get_assertion(self, assertion_name):
"""
Gets a :class:`dataikuapi.dss.ml.DSSMLAssertionParams` representing the params of the assertion with the
Gets a :class:`dataikuapi.dss.ml.DSSMLAssertionParams` representing the parameters of the assertion with the
provided name (or None if no assertion has that name)
:param str assertion_name: Name of the assertion
:rtype: :class:`dataikuapi.dss.ml.DSSMLAssertionParams` or None
Expand All @@ -702,18 +690,19 @@ def get_assertion(self, assertion_name):

def add_assertion(self, assertion_params):
"""
Adds params of an assertion to the assertions params of the ml task.
Adds parameters of an assertion to the assertions parameters of the ml task.
Raises a ValueError if an assertion with the same name already exists
:param object assertion_params: A :class:`~dataikuapi.dss.utils.DSSMLAssertionParams` representing parameters of the assertion
"""
if not isinstance(assertion_params, DSSMLAssertionParams):
raise ValueError('Wrong type for assertion params: {}'.format(type(assertion_params)))
raise ValueError('Wrong type for assertion parameters: {}'.format(type(assertion_params)))
self.check_assertion_names_are_uniq(self._internal_dict["assertions"] + [assertion_params._internal_dict])

self._internal_dict["assertions"].append(assertion_params._internal_dict)

def delete_assertion(self, assertion_name):
"""
Deletes the assertion params of the assertion with the provided name from the `dataikuapi.dss.ml.DSSMLAssertionsParams`
Deletes the assertion parameters of the assertion with the provided name from the `dataikuapi.dss.ml.DSSMLAssertionsParams`
Raises a ValueError if no assertion with the provided name was found
:param str assertion_name: Name of the assertion
"""
Expand All @@ -736,7 +725,7 @@ def __init__(self, data):
@staticmethod
def create_from_parts(name, a_filter, condition):
"""
Creates assertion params from name, filter and condition
Creates assertion parameters from name, filter and condition

:param str name: Name of the assertion
:param object a_filter: A :class:`~dataikuapi.dss.utils.DSSFilter` to select assertion population
Expand All @@ -752,7 +741,7 @@ def create_from_parts(name, a_filter, condition):

def get_raw(self):
"""
Gets the raw dictionary of the assertion params
Gets the raw dictionary of the assertion parameters
:rtype: dict
"""
return self._internal_dict
Expand Down Expand Up @@ -792,7 +781,7 @@ def condition(self):
@condition.setter
def condition(self, condition):
if not isinstance(condition, DSSMLAssertionCondition):
raise ValueError('Wrong type for assertion condition: {}.format(type(condition)))
raise ValueError('Wrong type for assertion condition: {}.format(type(condition))')
self._internal_dict["assertionCondition"] = condition._internal_dict


Expand Down