/*********************************************************************/ /// <summary> /// Sucht nach einem Attribut, welches für den Knoten optimal ist /// </summary> /// <param name="vertex">Vertex für den der Typ gefunden werden soll</param> /// <returns>gefundener AttributTyp</returns> private CAttributeType findBestAttribute(CTreeVertex vertex) { double bestEntropy = double.MaxValue; CAttributeType bestAttrType = null; List <CAttributeType> attrTypeList = mTableLogic.getAttributeTypes(); foreach (CAttributeType type in attrTypeList) { if ((type.Used == true) && (type.TargetAttribute == false) && (mTreeLogic.isAttributeUsedByParent(vertex, type) == false)) { mTreeLogic.setVertexAttribute(vertex, type); mTreeLogic.updateVertexValues(); // Verhindern das ein Kindknoten alle Einträge enthält wie der Parent, // dann können wir uns das auch sparen if (childDoesOwnAllParentObjects(vertex) == false) { double entropy = calculateWeightedEntropy(vertex); if (entropy < bestEntropy) { bestEntropy = entropy; bestAttrType = type; } } } } return(bestAttrType); }
/*********************************************************************/ #region Funktionen Identifikationsfenster /*********************************************************************/ /*********************************************************************/ /// <summary> /// Holt die Liste aller AttributTypen und gibt diese zurück. /// Auch die nicht verwendeten! /// </summary> /// <returns>Liste mit allen Attributtypen</returns> public List <CAttributeType> getAttributeTypes() { return(mTableLogic.getAttributeTypes()); }