From bdba45de08dcddb81b70bfb0495b3f1989a87897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czeka=C5=84ski?= Date: Thu, 21 May 2020 16:52:48 +0200 Subject: [PATCH] Add DecisionTreeExample class This class will be used in decision trees. --- src/AI/DecisionTrees/DecisionTreeExample.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/AI/DecisionTrees/DecisionTreeExample.py diff --git a/src/AI/DecisionTrees/DecisionTreeExample.py b/src/AI/DecisionTrees/DecisionTreeExample.py new file mode 100644 index 0000000..cc65681 --- /dev/null +++ b/src/AI/DecisionTrees/DecisionTreeExample.py @@ -0,0 +1,15 @@ +from typing import List + +from src.AI.DecisionTrees.Attribute import Attribute +from src.AI.DecisionTrees.AttributeDefinition import AttributeDefinition + + +class DecisionTreeExample: + def __init__(self, classification, attributes: List[Attribute]): + self.attributes = attributes + self.classification = classification + + def getAttributeWithDefinition(self, attributeDefinition: AttributeDefinition): + for attr in self.attributes: + if attr.attributeDefinition.id == attributeDefinition.id: + return attr