choose criterion 2011


/ Published in: C#
Save to your folder(s)

older version of and id3/c45 classifier


Copy this code and paste it in your HTML
  1. protected int GetNextCriterion(Table table)
  2. {
  3. Dictionary<_NodeCriterionInfo, int> filter = GetFilter();
  4. Table rest = table.Filter(filter);
  5.  
  6. List<double> infos = new List<double>();
  7.  
  8. int i;
  9.  
  10. for (i = 0; i < rest.Criteria.Count - 1; i++)
  11. infos.Add(rest.Infos(i));
  12.  
  13.  
  14.  
  15. for (i = 0; i < rest.Criteria.Count - 1; i++)
  16. {
  17. bool containsKey = false;
  18. foreach (KeyValuePair<_NodeCriterionInfo,int> kvp in filter)
  19. if (kvp.Key.Index == i)
  20. {
  21. containsKey = true;
  22. break;
  23. }
  24. if (
  25. !containsKey
  26. ) break;
  27. }
  28.  
  29.  
  30.  
  31. int iMin = i;
  32. double min = infos[iMin];
  33.  
  34.  
  35. for (i = iMin; i < rest.Criteria.Count - 1; i++)
  36. {
  37. bool containsKey = false;
  38. foreach (KeyValuePair<_NodeCriterionInfo, int> kvp in filter)
  39. if (kvp.Key.Index == i)
  40. {
  41. containsKey = true;
  42. break;
  43. }
  44. if (
  45. containsKey
  46. ) continue;
  47.  
  48. if (infos[i] < min)
  49. {
  50. min = infos[i];
  51. iMin = i;
  52. }
  53. }
  54.  
  55.  
  56. return iMin;
  57. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.