@@ -788,7 +788,7 @@ class DSSMLAssertionCondition(object):
788788 """
789789 Object that represents an assertion condition
790790 Do not create this object directly, use :meth:`dataikuapi.dss.ml.DSSMLAssertionParams.condition`, :meth:`dataikuapi.dss.ml.DSSMLAssertionCondition.from_expected_class(expected_valid_ratio, expected_class)`
791- or :meth:`dataikuapi.dss.ml.DSSMLAssertionCondition.from_expected_range(expected_valid_ratio, expected_range )` instead
791+ or :meth:`dataikuapi.dss.ml.DSSMLAssertionCondition.from_expected_range(expected_valid_ratio, expected_min, expected_max )` instead
792792 """
793793 def __init__ (self , data ):
794794 self ._internal_dict = data
@@ -809,19 +809,22 @@ def from_expected_class(expected_valid_ratio, expected_class):
809809 return assertion_condition
810810
811811 @staticmethod
812- def from_expected_range (expected_valid_ratio , expected_range ):
812+ def from_expected_range (expected_valid_ratio , expected_min , expected_max ):
813813 """
814- Creates an assertion condition from an expected valid ratio and an expected range
814+ Creates an assertion condition from an expected valid ratio and an expected range. The expected range is the
815+ interval between expected_min and expected_max where the predictions and therefore the rows will be considered
816+ valid.
815817
816818 :param float expected_valid_ratio: Assertion passes if this ratio of rows predicted between expected_min and expected_max is attained
817- :param tuple( float,float) expected_range: Range of values (min, max) where the prediction will be considered as
818- valid for the `expected_valid_ratio`
819+ :param float expected_min: Min value of the expected range
820+ :param float expected_max: Max value of the expected range
819821
820822 :rtype: :class:`dataikuapi.dss.ml.DSSMLAssertionCondition`
821823 """
822824 assertion_condition = DSSMLAssertionCondition ({})
823825 assertion_condition .expected_valid_ratio = expected_valid_ratio
824- assertion_condition .expected_range = expected_range
826+ assertion_condition .expected_min = expected_min
827+ assertion_condition .expected_max = expected_max
825828 return assertion_condition
826829
827830 def get_raw (self ):
@@ -834,7 +837,7 @@ def get_raw(self):
834837 @property
835838 def expected_class (self ):
836839 """
837- Returns the expected class on which the valid ratio will be calculated
840+ Returns the expected class on which the valid ratio will be calculated or None if it is not defined
838841 :rtype: str
839842 """
840843 if "expectedClass" in self ._internal_dict :
@@ -844,8 +847,6 @@ def expected_class(self):
844847
845848 @expected_class .setter
846849 def expected_class (self , expected_class ):
847- if self .expected_range is not None :
848- raise ValueError ("Expected class and expected range can't be both set" )
849850 self ._internal_dict ["expectedClass" ] = expected_class
850851
851852 @property
@@ -861,26 +862,34 @@ def expected_valid_ratio(self, expected_valid_ratio):
861862 self ._internal_dict ["successRatio" ] = expected_valid_ratio
862863
863864 @property
864- def expected_range (self ):
865+ def expected_min (self ):
865866 """
866- Returns the expected range on which the valid ratio will be calculated
867- :rtype: tuple(float,float)
867+ Returns the min (included) of the expected range or None if it is not defined
868+ :rtype: float
869+ """
870+ if "expectedMinValue" in self ._internal_dict :
871+ return self ._internal_dict ["expectedMinValue" ]
872+ else :
873+ return None
874+
875+ @expected_min .setter
876+ def expected_min (self , expected_min ):
877+ self ._internal_dict ["expectedMinValue" ] = expected_min
878+
879+ @property
880+ def expected_max (self ):
881+ """
882+ Returns the max (included) of the expected range
883+ :rtype: float
868884 """
869- if "expectedMinValue" in self . _internal_dict and " expectedMaxValue" in self ._internal_dict :
870- return self ._internal_dict ["expectedMinValue" ], self . _internal_dict [ " expectedMaxValue" ]
885+ if "expectedMaxValue" in self ._internal_dict :
886+ return self ._internal_dict ["expectedMaxValue" ]
871887 else :
872888 return None
873889
874- @expected_range .setter
875- def expected_range (self , expected_range ):
876- if not isinstance (expected_range , tuple ):
877- raise ValueError ("Expected range needs to be a tuple" )
878- if self .expected_class is not None :
879- raise ValueError ("Expected class and expected range can't be both set" )
880- if expected_range [0 ] > expected_range :
881- raise ValueError ("Expected range needs to be sorted in ascending order. (min value, max value)" )
882- self ._internal_dict ["expectedMinValue" ] = expected_range [0 ]
883- self ._internal_dict ["expectedMaxValue" ] = expected_range [1 ]
890+ @expected_max .setter
891+ def expected_max (self , expected_max ):
892+ self ._internal_dict ["expectedMaxValue" ] = expected_max
884893
885894
886895class DSSMLAssertionsMetrics (object ):
0 commit comments