/ Published in: C#
older version of and id3/c45 classifier
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
protected int GetNextCriterion(Table table) { Dictionary<_NodeCriterionInfo, int> filter = GetFilter(); Table rest = table.Filter(filter); int i; for (i = 0; i < rest.Criteria.Count - 1; i++) infos.Add(rest.Infos(i)); for (i = 0; i < rest.Criteria.Count - 1; i++) { bool containsKey = false; foreach (KeyValuePair<_NodeCriterionInfo,int> kvp in filter) if (kvp.Key.Index == i) { containsKey = true; break; } if ( !containsKey ) break; } int iMin = i; double min = infos[iMin]; for (i = iMin; i < rest.Criteria.Count - 1; i++) { bool containsKey = false; foreach (KeyValuePair<_NodeCriterionInfo, int> kvp in filter) if (kvp.Key.Index == i) { containsKey = true; break; } if ( containsKey ) continue; if (infos[i] < min) { min = infos[i]; iMin = i; } } return iMin; }