Add DecisionTreeExample class
This class will be used in decision trees.
This commit is contained in:
parent
ad791a299e
commit
bdba45de08
15
src/AI/DecisionTrees/DecisionTreeExample.py
Normal file
15
src/AI/DecisionTrees/DecisionTreeExample.py
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user