Add method comparing survival dt examples attributes
This will be used to check for duplicates when generating decision tree's examples.
This commit is contained in:
parent
ed58517b82
commit
98f692a6d8
@ -36,3 +36,27 @@ class SurvivalDTExample(DecisionTreeExample):
|
||||
Attribute(SurvivalAttributesDefinitions.restDistanceAttrDef, distFromRestPlace)]
|
||||
|
||||
super().__init__(classification, attributes)
|
||||
|
||||
def compareAttributes(self, anotherExample) -> bool:
|
||||
"""
|
||||
Compares attributes of this example with another example's attributes.
|
||||
|
||||
:param anotherExample:
|
||||
:return: True if attrs are equal, False otherwise
|
||||
"""
|
||||
attrsAreEqual = True
|
||||
|
||||
if self.hungerVal != anotherExample.hungerVal:
|
||||
attrsAreEqual = False
|
||||
elif self.thirstVal != anotherExample.thirstVal:
|
||||
attrsAreEqual = False
|
||||
elif self.staminaVal != anotherExample.staminaVal:
|
||||
attrsAreEqual = False
|
||||
elif self.distFromFood != anotherExample.distFromFood:
|
||||
attrsAreEqual = False
|
||||
elif self.distFromWater != anotherExample.distFromWater:
|
||||
attrsAreEqual = False
|
||||
elif self.distFromRestPlace != anotherExample.distFromRestPlace:
|
||||
attrsAreEqual = False
|
||||
|
||||
return attrsAreEqual
|
||||
|
Loading…
Reference in New Issue
Block a user