KNN_prune.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef _KNN_prune_h_
  2. #define _KNN_prune_h_
  3. /* KNN_prune.h
  4. *
  5. * Copyright (C) 2007-2008 Ola Söder, 2011,2017 Paul Boersma
  6. *
  7. * This code is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * This code is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this work. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. /*
  21. * os 20080529 Initial release
  22. * pb 2011/03/08 C++
  23. */
  24. /////////////////////////////////////////////////////
  25. // Prune auxs //
  26. /////////////////////////////////////////////////////
  27. #include "KNN.h"
  28. #include "FeatureWeights.h"
  29. #include "OlaP.h"
  30. /////////////////////////////////////////////////////
  31. // Prototypes //
  32. /////////////////////////////////////////////////////
  33. // Prune
  34. integer KNN_prune_prune
  35. (
  36. KNN me, // the classifier to be pruned
  37. double n, // pruning degree: noise, 0 <= n <= 1
  38. double r, // pruning redundancy: noise, 0 <= n <= 1
  39. integer k // k(!)
  40. );
  41. // sort indices according to pruning order defined by rule 2
  42. void KNN_prune_sort
  43. (
  44. PatternList p, // source
  45. Categories c, // source
  46. integer k, // k(!)
  47. integer *indices, // indices of instances to be sorted
  48. integer nindices // the number of instances to be sorted
  49. );
  50. // k-coverage
  51. integer KNN_prune_kCoverage
  52. (
  53. PatternList p, // source
  54. Categories c, // source
  55. integer y, // source instance index
  56. integer k, // k(!)
  57. integer * indices // Out: kCoverage set
  58. );
  59. // testing for superfluousness
  60. int KNN_prune_superfluous
  61. (
  62. PatternList p, // source
  63. Categories c, // source
  64. integer y, // source instance index
  65. integer k, // k(!)
  66. integer skipper // Skipping instance skipper
  67. );
  68. // testing for criticalness
  69. int KNN_prune_critical
  70. (
  71. PatternList p, // source
  72. Categories c, // source
  73. integer y, // source instance index
  74. integer k // k(!)
  75. );
  76. // testing for noisyness
  77. int KNN_prune_noisy
  78. (
  79. PatternList p, // source
  80. Categories c, // source
  81. integer y, // source instance index
  82. integer k // k(!)
  83. );
  84. /* End of file KNN_prune.h */
  85. #endif