nlptoolkit-classification 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. package/README.md +1 -0
  2. package/dist/Attribute/DiscreteAttribute.d.ts +1 -1
  3. package/dist/Attribute/DiscreteAttribute.js.map +1 -1
  4. package/dist/Attribute/DiscreteIndexedAttribute.d.ts +2 -2
  5. package/dist/DataSet/DataDefinition.d.ts +11 -0
  6. package/dist/DataSet/DataDefinition.js +11 -0
  7. package/dist/DataSet/DataDefinition.js.map +1 -1
  8. package/dist/Experiment/BootstrapRun.js +2 -2
  9. package/dist/Experiment/BootstrapRun.js.map +1 -1
  10. package/dist/Experiment/Experiment.d.ts +7 -7
  11. package/dist/Experiment/Experiment.js +6 -6
  12. package/dist/Experiment/Experiment.js.map +1 -1
  13. package/dist/Experiment/KFoldRun.d.ts +17 -2
  14. package/dist/Experiment/KFoldRun.js +19 -4
  15. package/dist/Experiment/KFoldRun.js.map +1 -1
  16. package/dist/Experiment/KFoldRunSeparateTest.d.ts +13 -2
  17. package/dist/Experiment/KFoldRunSeparateTest.js +15 -4
  18. package/dist/Experiment/KFoldRunSeparateTest.js.map +1 -1
  19. package/dist/Experiment/MxKFoldRun.js +1 -1
  20. package/dist/Experiment/MxKFoldRun.js.map +1 -1
  21. package/dist/Experiment/MxKFoldRunSeparateTest.js +1 -1
  22. package/dist/Experiment/MxKFoldRunSeparateTest.js.map +1 -1
  23. package/dist/Experiment/SingleRunWithK.d.ts +18 -3
  24. package/dist/Experiment/SingleRunWithK.js +18 -3
  25. package/dist/Experiment/SingleRunWithK.js.map +1 -1
  26. package/dist/Experiment/StratifiedKFoldRun.js +1 -1
  27. package/dist/Experiment/StratifiedKFoldRun.js.map +1 -1
  28. package/dist/Experiment/StratifiedKFoldRunSeparateTest.js +1 -1
  29. package/dist/Experiment/StratifiedKFoldRunSeparateTest.js.map +1 -1
  30. package/dist/Experiment/StratifiedMxKFoldRun.js +1 -1
  31. package/dist/Experiment/StratifiedMxKFoldRun.js.map +1 -1
  32. package/dist/Experiment/StratifiedMxKFoldRunSeparateTest.js +3 -3
  33. package/dist/Experiment/StratifiedMxKFoldRunSeparateTest.js.map +1 -1
  34. package/dist/Experiment/StratifiedSingleRunWithK.js +1 -1
  35. package/dist/Experiment/StratifiedSingleRunWithK.js.map +1 -1
  36. package/dist/Filter/LaryFilter.d.ts +1 -1
  37. package/dist/Filter/LaryFilter.js +1 -1
  38. package/dist/Filter/TrainedFeatureFilter.d.ts +1 -1
  39. package/dist/Filter/TrainedFeatureFilter.js +1 -1
  40. package/dist/InstanceList/Partition.d.ts +45 -0
  41. package/dist/InstanceList/Partition.js +125 -70
  42. package/dist/InstanceList/Partition.js.map +1 -1
  43. package/dist/Model/DecisionTree/DecisionCondition.d.ts +8 -0
  44. package/dist/Model/DecisionTree/DecisionCondition.js +8 -0
  45. package/dist/Model/DecisionTree/DecisionCondition.js.map +1 -1
  46. package/dist/Model/DecisionTree/DecisionNode.d.ts +39 -1
  47. package/dist/Model/DecisionTree/DecisionNode.js +64 -22
  48. package/dist/Model/DecisionTree/DecisionNode.js.map +1 -1
  49. package/dist/Model/DecisionTree/DecisionStump.d.ts +17 -0
  50. package/dist/{Classifier/C45Stump.js → Model/DecisionTree/DecisionStump.js} +13 -10
  51. package/dist/Model/DecisionTree/DecisionStump.js.map +1 -0
  52. package/dist/Model/DecisionTree/DecisionTree.d.ts +24 -9
  53. package/dist/Model/DecisionTree/DecisionTree.js +39 -16
  54. package/dist/Model/DecisionTree/DecisionTree.js.map +1 -1
  55. package/dist/Model/DummyModel.d.ts +28 -3
  56. package/dist/Model/DummyModel.js +36 -23
  57. package/dist/Model/DummyModel.js.map +1 -1
  58. package/dist/{Classifier/Bagging.d.ts → Model/Ensemble/BaggingModel.d.ts} +8 -4
  59. package/dist/{Classifier/Bagging.js → Model/Ensemble/BaggingModel.js} +16 -14
  60. package/dist/Model/Ensemble/BaggingModel.js.map +1 -0
  61. package/dist/{Classifier/RandomForest.d.ts → Model/Ensemble/RandomForestModel.d.ts} +8 -4
  62. package/dist/{Classifier/RandomForest.js → Model/Ensemble/RandomForestModel.js} +16 -14
  63. package/dist/Model/Ensemble/RandomForestModel.js.map +1 -0
  64. package/dist/Model/Ensemble/TreeEnsembleModel.d.ts +32 -0
  65. package/dist/Model/{TreeEnsembleModel.js → Ensemble/TreeEnsembleModel.js} +23 -17
  66. package/dist/Model/Ensemble/TreeEnsembleModel.js.map +1 -0
  67. package/dist/Model/Model.d.ts +52 -0
  68. package/dist/Model/Model.js +84 -1
  69. package/dist/Model/Model.js.map +1 -1
  70. package/dist/Model/NeuralNetwork/DeepNetworkModel.d.ts +47 -0
  71. package/dist/Model/{DeepNetworkModel.js → NeuralNetwork/DeepNetworkModel.js} +55 -55
  72. package/dist/Model/NeuralNetwork/DeepNetworkModel.js.map +1 -0
  73. package/dist/Model/NeuralNetwork/LinearPerceptronModel.d.ts +31 -0
  74. package/dist/Model/NeuralNetwork/LinearPerceptronModel.js +84 -0
  75. package/dist/Model/NeuralNetwork/LinearPerceptronModel.js.map +1 -0
  76. package/dist/Model/NeuralNetwork/MultiLayerPerceptronModel.d.ts +39 -0
  77. package/dist/Model/{MultiLayerPerceptronModel.js → NeuralNetwork/MultiLayerPerceptronModel.js} +41 -37
  78. package/dist/Model/NeuralNetwork/MultiLayerPerceptronModel.js.map +1 -0
  79. package/dist/Model/{NeuralNetworkModel.d.ts → NeuralNetwork/NeuralNetworkModel.d.ts} +19 -5
  80. package/dist/Model/{NeuralNetworkModel.js → NeuralNetwork/NeuralNetworkModel.js} +19 -6
  81. package/dist/Model/NeuralNetwork/NeuralNetworkModel.js.map +1 -0
  82. package/dist/Model/{KnnInstance.d.ts → NonParametric/KnnInstance.d.ts} +1 -1
  83. package/dist/Model/NonParametric/KnnInstance.js.map +1 -0
  84. package/dist/Model/{KnnModel.d.ts → NonParametric/KnnModel.d.ts} +30 -6
  85. package/dist/Model/{KnnModel.js → NonParametric/KnnModel.js} +42 -19
  86. package/dist/Model/NonParametric/KnnModel.js.map +1 -0
  87. package/dist/Model/{GaussianModel.d.ts → Parametric/GaussianModel.d.ts} +20 -2
  88. package/dist/Model/{GaussianModel.js → Parametric/GaussianModel.js} +21 -3
  89. package/dist/Model/Parametric/GaussianModel.js.map +1 -0
  90. package/dist/Model/Parametric/KMeansModel.d.ts +36 -0
  91. package/dist/Model/Parametric/KMeansModel.js +73 -0
  92. package/dist/Model/Parametric/KMeansModel.js.map +1 -0
  93. package/dist/Model/Parametric/LdaModel.d.ts +44 -0
  94. package/dist/Model/Parametric/LdaModel.js +98 -0
  95. package/dist/Model/Parametric/LdaModel.js.map +1 -0
  96. package/dist/Model/{NaiveBayesModel.d.ts → Parametric/NaiveBayesModel.d.ts} +30 -10
  97. package/dist/Model/{NaiveBayesModel.js → Parametric/NaiveBayesModel.js} +64 -27
  98. package/dist/Model/Parametric/NaiveBayesModel.js.map +1 -0
  99. package/dist/Model/Parametric/QdaModel.d.ts +30 -0
  100. package/dist/Model/Parametric/QdaModel.js +84 -0
  101. package/dist/Model/Parametric/QdaModel.js.map +1 -0
  102. package/dist/Model/RandomModel.d.ts +32 -2
  103. package/dist/Model/RandomModel.js +48 -16
  104. package/dist/Model/RandomModel.js.map +1 -1
  105. package/dist/Parameter/C45Parameter.d.ts +2 -2
  106. package/dist/Parameter/DeepNetworkParameter.d.ts +2 -2
  107. package/dist/Parameter/KnnParameter.d.ts +1 -1
  108. package/dist/Parameter/LinearPerceptronParameter.d.ts +4 -4
  109. package/dist/Parameter/MultiLayerPerceptronParameter.d.ts +2 -2
  110. package/dist/Parameter/Parameter.d.ts +1 -1
  111. package/dist/Performance/ConfusionMatrix.d.ts +1 -1
  112. package/dist/StatisticalTest/Combined5x2F.d.ts +12 -0
  113. package/dist/StatisticalTest/Combined5x2F.js +12 -0
  114. package/dist/StatisticalTest/Combined5x2F.js.map +1 -1
  115. package/dist/StatisticalTest/Combined5x2t.d.ts +13 -0
  116. package/dist/StatisticalTest/Combined5x2t.js +13 -0
  117. package/dist/StatisticalTest/Combined5x2t.js.map +1 -1
  118. package/dist/StatisticalTest/Paired5x2t.d.ts +12 -0
  119. package/dist/StatisticalTest/Paired5x2t.js +12 -0
  120. package/dist/StatisticalTest/Paired5x2t.js.map +1 -1
  121. package/dist/StatisticalTest/PairedTest.d.ts +12 -0
  122. package/dist/StatisticalTest/PairedTest.js +12 -0
  123. package/dist/StatisticalTest/PairedTest.js.map +1 -1
  124. package/dist/StatisticalTest/Pairedt.d.ts +12 -0
  125. package/dist/StatisticalTest/Pairedt.js +12 -0
  126. package/dist/StatisticalTest/Pairedt.js.map +1 -1
  127. package/dist/StatisticalTest/Sign.d.ts +17 -0
  128. package/dist/StatisticalTest/Sign.js +17 -0
  129. package/dist/StatisticalTest/Sign.js.map +1 -1
  130. package/dist/StatisticalTest/StatisticalTestResult.d.ts +30 -0
  131. package/dist/StatisticalTest/StatisticalTestResult.js +30 -0
  132. package/dist/StatisticalTest/StatisticalTestResult.js.map +1 -1
  133. package/dist/index.d.ts +88 -0
  134. package/dist/index.js +111 -0
  135. package/dist/index.js.map +1 -0
  136. package/models/bagging-bupa.txt +10346 -0
  137. package/models/bagging-car.txt +40752 -0
  138. package/models/bagging-dermatology.txt +2990 -0
  139. package/models/bagging-iris.txt +1332 -0
  140. package/models/bagging-tictactoe.txt +29442 -0
  141. package/models/c45-bupa.txt +3 -0
  142. package/models/c45-car.txt +212 -0
  143. package/models/c45-carIndexed.txt +92 -0
  144. package/models/c45-dermatology.txt +22 -0
  145. package/models/c45-iris.txt +7 -0
  146. package/models/c45-tictactoe.txt +147 -0
  147. package/models/c45-tictactoeIndexed.txt +79 -0
  148. package/models/c45stump-bupa.txt +6 -0
  149. package/models/c45stump-car.txt +11 -0
  150. package/models/c45stump-chess.txt +35 -0
  151. package/models/c45stump-dermatology.txt +11 -0
  152. package/models/c45stump-iris.txt +5 -0
  153. package/models/c45stump-nursery.txt +10 -0
  154. package/models/c45stump-tictactoe.txt +9 -0
  155. package/models/randomforest-bupa.txt +10346 -0
  156. package/models/randomforest-car.txt +40752 -0
  157. package/models/randomforest-carIndexed.txt +15594 -0
  158. package/models/randomforest-dermatology.txt +2990 -0
  159. package/models/randomforest-iris.txt +1332 -0
  160. package/models/randomforest-tictactoe.txt +29442 -0
  161. package/package.json +7 -7
  162. package/source/Attribute/DiscreteAttribute.ts +1 -1
  163. package/source/Attribute/DiscreteIndexedAttribute.ts +2 -2
  164. package/source/DataSet/DataDefinition.ts +11 -0
  165. package/source/Experiment/BootstrapRun.ts +2 -2
  166. package/source/Experiment/Experiment.ts +10 -10
  167. package/source/Experiment/KFoldRun.ts +20 -5
  168. package/source/Experiment/KFoldRunSeparateTest.ts +16 -5
  169. package/source/Experiment/MxKFoldRun.ts +1 -1
  170. package/source/Experiment/MxKFoldRunSeparateTest.ts +1 -1
  171. package/source/Experiment/SingleRunWithK.ts +20 -5
  172. package/source/Experiment/StratifiedKFoldRun.ts +1 -1
  173. package/source/Experiment/StratifiedKFoldRunSeparateTest.ts +1 -1
  174. package/source/Experiment/StratifiedMxKFoldRun.ts +1 -1
  175. package/source/Experiment/StratifiedMxKFoldRunSeparateTest.ts +3 -3
  176. package/source/Experiment/StratifiedSingleRunWithK.ts +1 -1
  177. package/source/Filter/LaryFilter.ts +1 -1
  178. package/source/Filter/TrainedFeatureFilter.ts +1 -1
  179. package/source/InstanceList/Partition.ts +125 -65
  180. package/source/Model/DecisionTree/DecisionCondition.ts +8 -0
  181. package/source/Model/DecisionTree/DecisionNode.ts +65 -22
  182. package/source/Model/DecisionTree/DecisionStump.ts +26 -0
  183. package/source/Model/DecisionTree/DecisionTree.ts +44 -15
  184. package/source/Model/DummyModel.ts +40 -19
  185. package/source/{Classifier/Bagging.ts → Model/Ensemble/BaggingModel.ts} +15 -12
  186. package/source/{Classifier/RandomForest.ts → Model/Ensemble/RandomForestModel.ts} +14 -12
  187. package/source/Model/{TreeEnsembleModel.ts → Ensemble/TreeEnsembleModel.ts} +26 -18
  188. package/source/Model/Model.ts +92 -0
  189. package/source/Model/{DeepNetworkModel.ts → NeuralNetwork/DeepNetworkModel.ts} +59 -56
  190. package/source/Model/NeuralNetwork/LinearPerceptronModel.ts +81 -0
  191. package/source/Model/{MultiLayerPerceptronModel.ts → NeuralNetwork/MultiLayerPerceptronModel.ts} +46 -39
  192. package/source/Model/{NeuralNetworkModel.ts → NeuralNetwork/NeuralNetworkModel.ts} +20 -7
  193. package/source/Model/{KnnInstance.ts → NonParametric/KnnInstance.ts} +1 -1
  194. package/source/Model/{KnnModel.ts → NonParametric/KnnModel.ts} +48 -19
  195. package/source/Model/{GaussianModel.ts → Parametric/GaussianModel.ts} +21 -3
  196. package/source/Model/Parametric/KMeansModel.ts +72 -0
  197. package/source/Model/Parametric/LdaModel.ts +98 -0
  198. package/source/Model/{NaiveBayesModel.ts → Parametric/NaiveBayesModel.ts} +68 -25
  199. package/source/Model/Parametric/QdaModel.ts +83 -0
  200. package/source/Model/RandomModel.ts +54 -16
  201. package/source/Parameter/C45Parameter.ts +2 -2
  202. package/source/Parameter/DeepNetworkParameter.ts +2 -2
  203. package/source/Parameter/KnnParameter.ts +1 -1
  204. package/source/Parameter/LinearPerceptronParameter.ts +4 -4
  205. package/source/Parameter/MultiLayerPerceptronParameter.ts +2 -2
  206. package/source/Parameter/Parameter.ts +1 -1
  207. package/source/Performance/ConfusionMatrix.ts +1 -1
  208. package/source/StatisticalTest/Combined5x2F.ts +12 -0
  209. package/source/StatisticalTest/Combined5x2t.ts +13 -0
  210. package/source/StatisticalTest/Paired5x2t.ts +12 -0
  211. package/source/StatisticalTest/PairedTest.ts +12 -0
  212. package/source/StatisticalTest/Pairedt.ts +12 -0
  213. package/source/StatisticalTest/Sign.ts +17 -0
  214. package/source/StatisticalTest/StatisticalTestResult.ts +30 -0
  215. package/source/index.ts +88 -0
  216. package/source/tsconfig.json +1 -1
  217. package/tests/Classifier/C45Test.ts +2 -2
  218. package/tests/Classifier/DeepNetworkTest.ts +3 -5
  219. package/tests/Classifier/DummyTest.ts +2 -2
  220. package/tests/Classifier/KMeansTest.ts +2 -2
  221. package/tests/Classifier/KnnTest.ts +2 -2
  222. package/tests/Classifier/LdaTest.ts +2 -2
  223. package/tests/Classifier/LinearPerceptronTest.ts +2 -2
  224. package/tests/Classifier/MultiLayerPerceptronTest.ts +2 -3
  225. package/tests/Classifier/NaiveBayesTest.ts +2 -2
  226. package/tests/Classifier/QdaTest.ts +2 -2
  227. package/tests/Classifier/RandomForestTest.ts +2 -2
  228. package/tsconfig.json +1 -2
  229. package/dist/Classifier/Bagging.js.map +0 -1
  230. package/dist/Classifier/C45.d.ts +0 -14
  231. package/dist/Classifier/C45.js +0 -43
  232. package/dist/Classifier/C45.js.map +0 -1
  233. package/dist/Classifier/C45Stump.d.ts +0 -13
  234. package/dist/Classifier/C45Stump.js.map +0 -1
  235. package/dist/Classifier/Classifier.d.ts +0 -40
  236. package/dist/Classifier/Classifier.js +0 -72
  237. package/dist/Classifier/Classifier.js.map +0 -1
  238. package/dist/Classifier/DeepNetwork.d.ts +0 -14
  239. package/dist/Classifier/DeepNetwork.js +0 -34
  240. package/dist/Classifier/DeepNetwork.js.map +0 -1
  241. package/dist/Classifier/Dummy.d.ts +0 -14
  242. package/dist/Classifier/Dummy.js +0 -32
  243. package/dist/Classifier/Dummy.js.map +0 -1
  244. package/dist/Classifier/KMeans.d.ts +0 -13
  245. package/dist/Classifier/KMeans.js +0 -39
  246. package/dist/Classifier/KMeans.js.map +0 -1
  247. package/dist/Classifier/Knn.d.ts +0 -14
  248. package/dist/Classifier/Knn.js +0 -32
  249. package/dist/Classifier/Knn.js.map +0 -1
  250. package/dist/Classifier/Lda.d.ts +0 -13
  251. package/dist/Classifier/Lda.js +0 -55
  252. package/dist/Classifier/Lda.js.map +0 -1
  253. package/dist/Classifier/LinearPerceptron.d.ts +0 -15
  254. package/dist/Classifier/LinearPerceptron.js +0 -35
  255. package/dist/Classifier/LinearPerceptron.js.map +0 -1
  256. package/dist/Classifier/MultiLayerPerceptron.d.ts +0 -15
  257. package/dist/Classifier/MultiLayerPerceptron.js +0 -35
  258. package/dist/Classifier/MultiLayerPerceptron.js.map +0 -1
  259. package/dist/Classifier/NaiveBayes.d.ts +0 -26
  260. package/dist/Classifier/NaiveBayes.js +0 -70
  261. package/dist/Classifier/NaiveBayes.js.map +0 -1
  262. package/dist/Classifier/Qda.d.ts +0 -13
  263. package/dist/Classifier/Qda.js +0 -53
  264. package/dist/Classifier/Qda.js.map +0 -1
  265. package/dist/Classifier/RandomClassifier.d.ts +0 -13
  266. package/dist/Classifier/RandomClassifier.js +0 -35
  267. package/dist/Classifier/RandomClassifier.js.map +0 -1
  268. package/dist/Classifier/RandomForest.js.map +0 -1
  269. package/dist/Model/DeepNetworkModel.d.ts +0 -45
  270. package/dist/Model/DeepNetworkModel.js.map +0 -1
  271. package/dist/Model/GaussianModel.js.map +0 -1
  272. package/dist/Model/KMeansModel.d.ts +0 -28
  273. package/dist/Model/KMeansModel.js +0 -61
  274. package/dist/Model/KMeansModel.js.map +0 -1
  275. package/dist/Model/KnnInstance.js.map +0 -1
  276. package/dist/Model/KnnModel.js.map +0 -1
  277. package/dist/Model/LdaModel.d.ts +0 -28
  278. package/dist/Model/LdaModel.js +0 -67
  279. package/dist/Model/LdaModel.js.map +0 -1
  280. package/dist/Model/LinearPerceptronModel.d.ts +0 -24
  281. package/dist/Model/LinearPerceptronModel.js +0 -91
  282. package/dist/Model/LinearPerceptronModel.js.map +0 -1
  283. package/dist/Model/MultiLayerPerceptronModel.d.ts +0 -33
  284. package/dist/Model/MultiLayerPerceptronModel.js.map +0 -1
  285. package/dist/Model/NaiveBayesModel.js.map +0 -1
  286. package/dist/Model/NeuralNetworkModel.js.map +0 -1
  287. package/dist/Model/QdaModel.d.ts +0 -27
  288. package/dist/Model/QdaModel.js +0 -63
  289. package/dist/Model/QdaModel.js.map +0 -1
  290. package/dist/Model/TreeEnsembleModel.d.ts +0 -22
  291. package/dist/Model/TreeEnsembleModel.js.map +0 -1
  292. package/index.js +0 -100
  293. package/source/Classifier/C45.ts +0 -34
  294. package/source/Classifier/C45Stump.ts +0 -23
  295. package/source/Classifier/Classifier.ts +0 -72
  296. package/source/Classifier/DeepNetwork.ts +0 -26
  297. package/source/Classifier/Dummy.ts +0 -23
  298. package/source/Classifier/KMeans.ts +0 -30
  299. package/source/Classifier/Knn.ts +0 -25
  300. package/source/Classifier/Lda.ts +0 -47
  301. package/source/Classifier/LinearPerceptron.ts +0 -27
  302. package/source/Classifier/MultiLayerPerceptron.ts +0 -27
  303. package/source/Classifier/NaiveBayes.ts +0 -66
  304. package/source/Classifier/Qda.ts +0 -46
  305. package/source/Classifier/RandomClassifier.ts +0 -26
  306. package/source/Model/KMeansModel.ts +0 -56
  307. package/source/Model/LdaModel.ts +0 -62
  308. package/source/Model/LinearPerceptronModel.ts +0 -83
  309. package/source/Model/QdaModel.ts +0 -57
  310. /package/dist/Model/{KnnInstance.js → NonParametric/KnnInstance.js} +0 -0
@@ -15,22 +15,29 @@
15
15
  const Random_1 = require("nlptoolkit-util/dist/Random");
16
16
  const FileContents_1 = require("nlptoolkit-util/dist/FileContents");
17
17
  class RandomModel extends Model_1.Model {
18
- constructor(classLabelsOrFileName, seed) {
19
- super();
20
- if (classLabelsOrFileName instanceof Array) {
21
- this.classLabels = classLabelsOrFileName;
22
- this.random = new Random_1.Random(seed);
23
- this.seed = seed;
24
- }
25
- else {
26
- let input = new FileContents_1.FileContents(classLabelsOrFileName);
27
- seed = parseInt(input.readLine());
28
- this.random = new Random_1.Random(seed);
29
- let size = parseInt(input.readLine());
30
- this.classLabels = new Array();
31
- for (let i = 0; i < size; i++) {
32
- this.classLabels.push(input.readLine());
33
- }
18
+ /**
19
+ * A constructor that sets the class labels.
20
+ *
21
+ * @param classLabels An ArrayList of class labels.
22
+ * @param seed Seed of the random function.
23
+ */
24
+ constructor1(classLabels, seed) {
25
+ this.classLabels = classLabels;
26
+ this.random = new Random_1.Random(seed);
27
+ this.seed = seed;
28
+ }
29
+ /**
30
+ * Loads a random classifier model from an input model file.
31
+ * @param fileName Model file name.
32
+ */
33
+ constructor2(fileName) {
34
+ let input = new FileContents_1.FileContents(fileName);
35
+ this.seed = parseInt(input.readLine());
36
+ this.random = new Random_1.Random(this.seed);
37
+ let size = parseInt(input.readLine());
38
+ this.classLabels = new Array();
39
+ for (let i = 0; i < size; i++) {
40
+ this.classLabels.push(input.readLine());
34
41
  }
35
42
  }
36
43
  /**
@@ -53,6 +60,11 @@
53
60
  return this.classLabels[index];
54
61
  }
55
62
  }
63
+ /**
64
+ * Calculates the posterior probability distribution for the given instance according to random model.
65
+ * @param instance Instance for which posterior probability distribution is calculated.
66
+ * @return Posterior probability distribution for the given instance.
67
+ */
56
68
  predictProbability(instance) {
57
69
  let result = new Map();
58
70
  for (let classLabel of this.classLabels) {
@@ -62,6 +74,26 @@
62
74
  }
63
75
  saveTxt(fileName) {
64
76
  }
77
+ /**
78
+ * Training algorithm for random classifier.
79
+ *
80
+ * @param trainSet Training data given to the algorithm.
81
+ * @param parameters -
82
+ */
83
+ train(trainSet, parameters) {
84
+ let result = new Array();
85
+ for (let s of trainSet.classDistribution().keys()) {
86
+ result.push(s);
87
+ }
88
+ this.constructor1(result, parameters.getSeed());
89
+ }
90
+ /**
91
+ * Loads the random classifier model from an input file.
92
+ * @param fileName File name of the random classifier model.
93
+ */
94
+ loadModel(fileName) {
95
+ this.constructor2(fileName);
96
+ }
65
97
  }
66
98
  exports.RandomModel = RandomModel;
67
99
  });
@@ -1 +1 @@
1
- {"version":3,"file":"RandomModel.js","sourceRoot":"","sources":["../../source/Model/RandomModel.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,mCAA8B;IAE9B,qEAAgE;IAChE,wDAAmD;IACnD,oEAA+D;IAE/D,MAAa,WAAY,SAAQ,aAAK;QAMlC,YAAY,qBAA6C,EAAE,IAAa;YACpE,KAAK,EAAE,CAAC;YACR,IAAI,qBAAqB,YAAY,KAAK,E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CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;QACpD,CAAC;QAED;;;WAGG;QACH,SAAS,CAAC,QAAgB;YACtB,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAA;QAC/B,CAAC;KAEJ;IA3FD,kCA2FC"}
@@ -1,7 +1,7 @@
1
1
  import { Parameter } from "./Parameter";
2
2
  export declare class C45Parameter extends Parameter {
3
- private prune;
4
- private crossValidationRatio;
3
+ private readonly prune;
4
+ private readonly crossValidationRatio;
5
5
  /**
6
6
  * Parameters of the C4.5 univariate decision tree classifier.
7
7
  *
@@ -1,8 +1,8 @@
1
1
  import { LinearPerceptronParameter } from "./LinearPerceptronParameter";
2
2
  import { ActivationFunction } from "./ActivationFunction";
3
3
  export declare class DeepNetworkParameter extends LinearPerceptronParameter {
4
- private hiddenLayers;
5
- private activationFunction;
4
+ private readonly hiddenLayers;
5
+ private readonly activationFunction;
6
6
  /**
7
7
  * Parameters of the deep network classifier.
8
8
  *
@@ -1,7 +1,7 @@
1
1
  import { KMeansParameter } from "./KMeansParameter";
2
2
  import { DistanceMetric } from "../DistanceMetric/DistanceMetric";
3
3
  export declare class KnnParameter extends KMeansParameter {
4
- private k;
4
+ private readonly k;
5
5
  /**
6
6
  * Parameters of the K-nearest neighbor classifier.
7
7
  *
@@ -1,9 +1,9 @@
1
1
  import { Parameter } from "./Parameter";
2
2
  export declare class LinearPerceptronParameter extends Parameter {
3
- private learningRate;
4
- private etaDecrease;
5
- private crossValidationRatio;
6
- private epoch;
3
+ private readonly learningRate;
4
+ private readonly etaDecrease;
5
+ private readonly crossValidationRatio;
6
+ private readonly epoch;
7
7
  /**
8
8
  * Parameters of the linear perceptron algorithm.
9
9
  *
@@ -1,8 +1,8 @@
1
1
  import { LinearPerceptronParameter } from "./LinearPerceptronParameter";
2
2
  import { ActivationFunction } from "./ActivationFunction";
3
3
  export declare class MultiLayerPerceptronParameter extends LinearPerceptronParameter {
4
- private hiddenNodes;
5
- private activationFunction;
4
+ private readonly hiddenNodes;
5
+ private readonly activationFunction;
6
6
  /**
7
7
  * Parameters of the multi layer perceptron algorithm.
8
8
  *
@@ -1,5 +1,5 @@
1
1
  export declare class Parameter {
2
- private seed;
2
+ private readonly seed;
3
3
  /**
4
4
  * Constructor of {@link Parameter} class which assigns given seed value to seed.
5
5
  *
@@ -1,6 +1,6 @@
1
1
  export declare class ConfusionMatrix {
2
2
  private matrix;
3
- private classLabels;
3
+ private readonly classLabels;
4
4
  /**
5
5
  * Constructor that sets the class labels {@link Array} and creates new {@link Map} matrix
6
6
  *
@@ -2,6 +2,18 @@ import { PairedTest } from "./PairedTest";
2
2
  import { ExperimentPerformance } from "../Performance/ExperimentPerformance";
3
3
  import { StatisticalTestResult } from "./StatisticalTestResult";
4
4
  export declare class Combined5x2F extends PairedTest {
5
+ /**
6
+ * Calculates the test statistic of the combined 5x2 cv F test.
7
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
8
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
9
+ * @return Given the performances of two classifiers, the test statistic of the combined 5x2 cv F test.
10
+ */
5
11
  private testStatistic;
12
+ /**
13
+ * Compares two classification algorithms based on their performances (accuracy or error rate) using combined 5x2 cv F test.
14
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
15
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
16
+ * @return Statistical test result of the comparison.
17
+ */
6
18
  compareClassifiers(classifier1: ExperimentPerformance, classifier2: ExperimentPerformance): StatisticalTestResult;
7
19
  }
@@ -14,6 +14,12 @@
14
14
  const StatisticalTestResult_1 = require("./StatisticalTestResult");
15
15
  const Distribution_1 = require("nlptoolkit-math/dist/Distribution");
16
16
  class Combined5x2F extends PairedTest_1.PairedTest {
17
+ /**
18
+ * Calculates the test statistic of the combined 5x2 cv F test.
19
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
20
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
21
+ * @return Given the performances of two classifiers, the test statistic of the combined 5x2 cv F test.
22
+ */
17
23
  testStatistic(classifier1, classifier2) {
18
24
  let difference = new Array();
19
25
  let numerator = 0;
@@ -31,6 +37,12 @@
31
37
  denominator *= 2;
32
38
  return numerator / denominator;
33
39
  }
40
+ /**
41
+ * Compares two classification algorithms based on their performances (accuracy or error rate) using combined 5x2 cv F test.
42
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
43
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
44
+ * @return Statistical test result of the comparison.
45
+ */
34
46
  compareClassifiers(classifier1, classifier2) {
35
47
  let statistic = this.testStatistic(classifier1, classifier2);
36
48
  let degreeOfFreedom1 = classifier1.numberOfExperiments();
@@ -1 +1 @@
1
- {"version":3,"file":"Combined5x2F.js","sourceRoot":"","sources":["../../source/StatisticalTest/Combined5x2F.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,6CAAwC;IAExC,mEAA8D;IAC9D,oEAA+D;IAE/D,MAAa,YAAa,SAAQ,uBAAU;QAEhC,aAAa,CAAC,WAAkC,EAAE,WAAkC;YACxF,IAAI,UAAU,GAAG,IAAI,KAAK,EAAU,CAAC;YACrC,IAAI,SAAS,GAAG,CAAC,CAAA;YACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,mBAAmB,EAAE,EAAE,CAAC,EAAE,EAAC;gBACvD,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC3E,SAAS,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;aAC9C;YACD,IAAI,WAAW,GAAG,CAAC,CAAC;YACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,mBAAmB,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,EAAC;gBAC3D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AAW,CAAC,CAAC;YAC7D,IAAI,gBAAgB,GAAG,WAAW,CAAC,mBAAmB,EAAE,CAAC;YACzD,IAAI,gBAAgB,GAAG,WAAW,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;YAC7D,OAAO,IAAI,6CAAqB,CAAC,2BAAY,CAAC,aAAa,CAAC,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,EAAE,IAAI,CAAC,CAAC;QACtH,CAAC;KAEJ;IAvCD,oCAuCC"}
@@ -2,6 +2,19 @@ import { PairedTest } from "./PairedTest";
2
2
  import { ExperimentPerformance } from "../Performance/ExperimentPerformance";
3
3
  import { StatisticalTestResult } from "./StatisticalTestResult";
4
4
  export declare class Combined5x2t extends PairedTest {
5
+ /**
6
+ * Calculates the test statistic of the combined 5x2 cv t test.
7
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
8
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
9
+ * @return Given the performances of two classifiers, the test statistic of the combined 5x2 cv t test.
10
+ */
5
11
  private testStatistic;
12
+ /**
13
+ * Compares two classification algorithms based on their performances (accuracy or error rate) using combined 5x2
14
+ * cv t test.
15
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
16
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
17
+ * @return Statistical test result of the comparison.
18
+ */
6
19
  compareClassifiers(classifier1: ExperimentPerformance, classifier2: ExperimentPerformance): StatisticalTestResult;
7
20
  }
@@ -14,6 +14,12 @@
14
14
  const StatisticalTestResult_1 = require("./StatisticalTestResult");
15
15
  const Distribution_1 = require("nlptoolkit-math/dist/Distribution");
16
16
  class Combined5x2t extends PairedTest_1.PairedTest {
17
+ /**
18
+ * Calculates the test statistic of the combined 5x2 cv t test.
19
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
20
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
21
+ * @return Given the performances of two classifiers, the test statistic of the combined 5x2 cv t test.
22
+ */
17
23
  testStatistic(classifier1, classifier2) {
18
24
  let difference = new Array();
19
25
  for (let i = 0; i < classifier1.numberOfExperiments(); i++) {
@@ -32,6 +38,13 @@
32
38
  denominator = Math.sqrt(denominator / 5);
33
39
  return numerator / denominator;
34
40
  }
41
+ /**
42
+ * Compares two classification algorithms based on their performances (accuracy or error rate) using combined 5x2
43
+ * cv t test.
44
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
45
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
46
+ * @return Statistical test result of the comparison.
47
+ */
35
48
  compareClassifiers(classifier1, classifier2) {
36
49
  let statistic = this.testStatistic(classifier1, classifier2);
37
50
  let degreeOfFreedom = classifier1.numberOfExperiments() / 2;
@@ -1 +1 @@
1
- {"version":3,"file":"Combined5x2t.js","sourceRoot":"","sources":["../../source/StatisticalTest/Combined5x2t.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,6CAAwC;IAExC,mEAA8D;IAC9D,oEAA+D;IAE/D,MAAa,YAAa,SAAQ,uBAAU;QAEhC,aAAa,CAAC,WAAkC,EAAE,WAAkC;YACxF,IAAI,UAAU,GAAG,IAAI,KAAK,EAAU,CAAC;YACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,mBAAmB,EAAE,EAAE,CAAC,EAAE,EAAC;gBACvD,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;aAC9E;YACD,IAAI,WAAW,GAAG,CAAC,CAAC;YACpB,IAAI,SAAS,GAAG,CAAC,CAAC;YAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,mBAAmB,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,EAAC;gBAC3D,IAAI,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,CA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kC,EAAE,WAAkC;YACrF,IAAI,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YAC7D,IAAI,eAAe,GAAG,WAAW,CAAC,mBAAmB,EAAE,GAAG,CAAC,CAAC;YAC5D,OAAO,IAAI,6CAAqB,CAAC,2BAAY,CAAC,aAAa,CAAC,SAAS,EAAE,eAAe,CAAC,EAAE,KAAK,CAAC,CAAC;QACpG,CAAC;KAEJ;IAxCD,oCAwCC"}
@@ -2,6 +2,18 @@ import { PairedTest } from "./PairedTest";
2
2
  import { ExperimentPerformance } from "../Performance/ExperimentPerformance";
3
3
  import { StatisticalTestResult } from "./StatisticalTestResult";
4
4
  export declare class Paired5x2t extends PairedTest {
5
+ /**
6
+ * Calculates the test statistic of the 5x2 t test.
7
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
8
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
9
+ * @return Given the performances of two classifiers, the test statistic of the 5x2 t test.
10
+ */
5
11
  private testStatistic;
12
+ /**
13
+ * Compares two classification algorithms based on their performances (accuracy or error rate) using 5x2 t test.
14
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
15
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
16
+ * @return Statistical test result of the comparison.
17
+ */
6
18
  compareClassifiers(classifier1: ExperimentPerformance, classifier2: ExperimentPerformance): StatisticalTestResult;
7
19
  }
@@ -14,6 +14,12 @@
14
14
  const StatisticalTestResult_1 = require("./StatisticalTestResult");
15
15
  const Distribution_1 = require("nlptoolkit-math/dist/Distribution");
16
16
  class Paired5x2t extends PairedTest_1.PairedTest {
17
+ /**
18
+ * Calculates the test statistic of the 5x2 t test.
19
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
20
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
21
+ * @return Given the performances of two classifiers, the test statistic of the 5x2 t test.
22
+ */
17
23
  testStatistic(classifier1, classifier2) {
18
24
  let difference = new Array();
19
25
  let sum = 0.0;
@@ -31,6 +37,12 @@
31
37
  denominator = Math.sqrt(denominator / 5);
32
38
  return difference[0] / denominator;
33
39
  }
40
+ /**
41
+ * Compares two classification algorithms based on their performances (accuracy or error rate) using 5x2 t test.
42
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
43
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
44
+ * @return Statistical test result of the comparison.
45
+ */
34
46
  compareClassifiers(classifier1, classifier2) {
35
47
  let statistic = this.testStatistic(classifier1, classifier2);
36
48
  let degreeOfFreedom = classifier1.numberOfExperiments() / 2;
@@ -1 +1 @@
1
- {"version":3,"file":"Paired5x2t.js","sourceRoot":"","sources":["../../source/StatisticalTest/Paired5x2t.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,6CAAwC;IAExC,mEAA8D;IAC9D,oEAA+D;IAE/D,MAAa,UAAW,SAAQ,uBAAU;QAE9B,aAAa,CAAC,WAAkC,EAAE,WAAkC;YACxF,IAAI,UAAU,GAAG,IAAI,KAAK,EAAU,CAAC;YACrC,IAAI,GAAG,GAAG,GAAG,CAAC;YACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,mBAAmB,EAAE,EAAE,CAAC,EAAE,EAAC;gBACvD,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC3E,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;aACxB;YACD,IAAI,WAAW,GAAG,CAAC,CAAC;YACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,mBAAmB,EAAE,GAAG,CAAC,EAAE,CAAC,EAAE,EAAC;gBAC3D,IAAI,IAAI,GAAG,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,GAAG,CAAC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;YAC5D,OAAO,IAAI,6CAAqB,CAAC,2BAAY,CAAC,aAAa,CAAC,SAAS,EAAE,eAAe,CAAC,EAAE,KAAK,CAAC,CAAC;QACpG,CAAC;KAEJ;IAtCD,gCAsCC"}
@@ -2,5 +2,17 @@ import { ExperimentPerformance } from "../Performance/ExperimentPerformance";
2
2
  import { StatisticalTestResult } from "./StatisticalTestResult";
3
3
  export declare abstract class PairedTest {
4
4
  abstract compareClassifiers(classifier1: ExperimentPerformance, classifier2: ExperimentPerformance): StatisticalTestResult;
5
+ /**
6
+ * Compares two classification algorithms based on their performances (accuracy or error rate). The method first
7
+ * checks the null hypothesis mu1 < mu2, if the test rejects this null hypothesis with alpha level of confidence, it
8
+ * decides mu1 > mu2. The algorithm then checks the null hypothesis mu1 > mu2, if the test rejects that null
9
+ * hypothesis with alpha level of confidence, if decides mu1 < mu2. If none of the two tests are rejected, it can not
10
+ * make a decision about the performances of algorithms.
11
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
12
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
13
+ * @param alpha Alpha level defined for the statistical test.
14
+ * @return 1 if the performance of the first algorithm is larger than the second algorithm, -1 if the performance of
15
+ * the second algorithm is larger than the first algorithm, 0 if they have similar performance.
16
+ */
5
17
  compare(classifier1: ExperimentPerformance, classifier2: ExperimentPerformance, alpha: number): number;
6
18
  }
@@ -12,6 +12,18 @@
12
12
  exports.PairedTest = void 0;
13
13
  const StatisticalTestResultType_1 = require("./StatisticalTestResultType");
14
14
  class PairedTest {
15
+ /**
16
+ * Compares two classification algorithms based on their performances (accuracy or error rate). The method first
17
+ * checks the null hypothesis mu1 < mu2, if the test rejects this null hypothesis with alpha level of confidence, it
18
+ * decides mu1 > mu2. The algorithm then checks the null hypothesis mu1 > mu2, if the test rejects that null
19
+ * hypothesis with alpha level of confidence, if decides mu1 < mu2. If none of the two tests are rejected, it can not
20
+ * make a decision about the performances of algorithms.
21
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
22
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
23
+ * @param alpha Alpha level defined for the statistical test.
24
+ * @return 1 if the performance of the first algorithm is larger than the second algorithm, -1 if the performance of
25
+ * the second algorithm is larger than the first algorithm, 0 if they have similar performance.
26
+ */
15
27
  compare(classifier1, classifier2, alpha) {
16
28
  let testResult1 = this.compareClassifiers(classifier1, classifier2);
17
29
  let testResult2 = this.compareClassifiers(classifier2, classifier1);
@@ -1 +1 @@
1
- {"version":3,"file":"PairedTest.js","sourceRoot":"","sources":["../../source/StatisticalTest/PairedTest.ts"],"names":[],"mappings":";;;;;;;;;;;;IAEA,2EAAsE;IAEtE,MAAsB,UAAU;QAI5B,OAAO,CAAC,WAAkC,EAAE,WAAkC,EAAE,KAAa;YACzF,IAAI,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YACpE,IAAI,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YACpE,IAAI,eAAe,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACnD,IAAI,eAAe,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACnD,IAAI,eAAe,IAAI,qDAAyB,CAAC,MAAM,EAAC;gBACpD,OAAO,CAAC,CAAC;aACZ;iBAAM;gBACH,IAAI,eAAe,IAAI,qDAAyB,CAAC,MAAM,EAAC;oBACpD,OAAO,CAAC,CAAC,CAAC;iBACb;qBAAM;oBACH,OAAO,CAAC,CAAC;iBACZ;aACJ;QACL,CAAC;KACJ;IAnBD,gCAmBC"}
1
+ {"version":3,"file":"PairedTest.js","sourceRoot":"","sources":["../../source/StatisticalTest/PairedTest.ts"],"names":[],"mappings":";;;;;;;;;;;;IAEA,2EAAsE;IAEtE,MAAsB,UAAU;QAI5B;;;;;;;;;;;WAWG;QACH,OAAO,CAAC,WAAkC,EAAE,WAAkC,EAAE,KAAa;YACzF,IAAI,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YACpE,IAAI,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;YACpE,IAAI,eAAe,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACnD,IAAI,eAAe,GAAG,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;YACnD,IAAI,eAAe,IAAI,qDAAyB,CAAC,MAAM,EAAC;gBACpD,OAAO,CAAC,CAAC;aACZ;iBAAM;gBACH,IAAI,eAAe,IAAI,qDAAyB,CAAC,MAAM,EAAC;oBACpD,OAAO,CAAC,CAAC,CAAC;iBACb;qBAAM;oBACH,OAAO,CAAC,CAAC;iBACZ;aACJ;QACL,CAAC;KACJ;IA/BD,gCA+BC"}
@@ -2,6 +2,18 @@ import { PairedTest } from "./PairedTest";
2
2
  import { ExperimentPerformance } from "../Performance/ExperimentPerformance";
3
3
  import { StatisticalTestResult } from "./StatisticalTestResult";
4
4
  export declare class Pairedt extends PairedTest {
5
+ /**
6
+ * Calculates the test statistic of the paired t test.
7
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
8
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
9
+ * @return Given the performances of two classifiers, the test statistic of the paired t test.
10
+ */
5
11
  private testStatistic;
12
+ /**
13
+ * Compares two classification algorithms based on their performances (accuracy or error rate) using paired t test.
14
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
15
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
16
+ * @return Statistical test result of the comparison.
17
+ */
6
18
  compareClassifiers(classifier1: ExperimentPerformance, classifier2: ExperimentPerformance): StatisticalTestResult;
7
19
  }
@@ -14,6 +14,12 @@
14
14
  const StatisticalTestResult_1 = require("./StatisticalTestResult");
15
15
  const Distribution_1 = require("nlptoolkit-math/dist/Distribution");
16
16
  class Pairedt extends PairedTest_1.PairedTest {
17
+ /**
18
+ * Calculates the test statistic of the paired t test.
19
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
20
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
21
+ * @return Given the performances of two classifiers, the test statistic of the paired t test.
22
+ */
17
23
  testStatistic(classifier1, classifier2) {
18
24
  let difference = new Array();
19
25
  let sum = 0.0;
@@ -29,6 +35,12 @@
29
35
  let standardDeviation = Math.sqrt(sum / (classifier1.numberOfExperiments() - 1));
30
36
  return Math.sqrt(classifier1.numberOfExperiments()) * mean / standardDeviation;
31
37
  }
38
+ /**
39
+ * Compares two classification algorithms based on their performances (accuracy or error rate) using paired t test.
40
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
41
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
42
+ * @return Statistical test result of the comparison.
43
+ */
32
44
  compareClassifiers(classifier1, classifier2) {
33
45
  let statistic = this.testStatistic(classifier1, classifier2);
34
46
  let degreeOfFreedom = classifier1.numberOfExperiments() - 1;
@@ -1 +1 @@
1
- {"version":3,"file":"Pairedt.js","sourceRoot":"","sources":["../../source/StatisticalTest/Pairedt.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,6CAAwC;IAExC,mEAA8D;IAC9D,oEAA+D;IAE/D,MAAa,OAAQ,SAAQ,uBAAU;QAE3B,aAAa,CAAC,WAAkC,EAAE,WAAkC;YACxF,IAAI,UAAU,GAAG,IAAI,KAAK,EAAU,CAAC;YACrC,IAAI,GAAG,GAAG,GAAG,CAAC;YACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,mBAAmB,EAAE,EAAE,CAAC,EAAE,EAAC;gBACvD,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC3E,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CA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edTest";
2
2
  import { ExperimentPerformance } from "../Performance/ExperimentPerformance";
3
3
  import { StatisticalTestResult } from "./StatisticalTestResult";
4
4
  export declare class Sign extends PairedTest {
5
+ /**
6
+ * Calculates n!.
7
+ * @param n n is n!
8
+ * @return n!.
9
+ */
5
10
  private factorial;
11
+ /**
12
+ * Calculates m of n that is C(n, m)
13
+ * @param m m in C(m, n)
14
+ * @param n n in C(m, n)
15
+ * @return C(m, n)
16
+ */
6
17
  private binomial;
18
+ /**
19
+ * Compares two classification algorithms based on their performances (accuracy or error rate) using sign test.
20
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
21
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
22
+ * @return Statistical test result of the comparison.
23
+ */
7
24
  compareClassifiers(classifier1: ExperimentPerformance, classifier2: ExperimentPerformance): StatisticalTestResult;
8
25
  }
@@ -13,12 +13,23 @@
13
13
  const PairedTest_1 = require("./PairedTest");
14
14
  const StatisticalTestResult_1 = require("./StatisticalTestResult");
15
15
  class Sign extends PairedTest_1.PairedTest {
16
+ /**
17
+ * Calculates n!.
18
+ * @param n n is n!
19
+ * @return n!.
20
+ */
16
21
  factorial(n) {
17
22
  let result = 1;
18
23
  for (let i = 2; i <= n; i++)
19
24
  result *= i;
20
25
  return result;
21
26
  }
27
+ /**
28
+ * Calculates m of n that is C(n, m)
29
+ * @param m m in C(m, n)
30
+ * @param n n in C(m, n)
31
+ * @return C(m, n)
32
+ */
22
33
  binomial(m, n) {
23
34
  if (n == 0 || m == n) {
24
35
  return 1;
@@ -27,6 +38,12 @@
27
38
  return this.factorial(m) / (this.factorial(n) * this.factorial(m - n));
28
39
  }
29
40
  }
41
+ /**
42
+ * Compares two classification algorithms based on their performances (accuracy or error rate) using sign test.
43
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
44
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
45
+ * @return Statistical test result of the comparison.
46
+ */
30
47
  compareClassifiers(classifier1, classifier2) {
31
48
  let plus = 0, minus = 0;
32
49
  for (let i = 0; i < classifier1.numberOfExperiments(); i++) {
@@ -1 +1 @@
1
- {"version":3,"file":"Sign.js","sourceRoot":"","sources":["../../source/StatisticalTest/Sign.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,6CAAwC;IAExC,mEAA8D;IAE9D,MAAa,IAAK,SAAQ,uBAAU;QAExB,SAAS,CAAC,CAAS;YACvB,IAAI,MAAM,GAAG,CAAC,CAAC;YACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;gBACvB,MAAM,IAAI,CAAC,CAAC;YAChB,OAAO,MAAM,CAAC;QAClB,CAAC;QAEO,QAAQ,CAAC,CAAS,EAAE,CAAS;YACjC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC;gBACjB,OAAO,CAAC,CAAC;aACZ;iBAAM;gBACH,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;aAC1E;QACL,CAAC;QAED,kBAAkB,CAAC,WAAkC,EAAE,WAAkC;YACrF,IAAI,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;YACxB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,mBAAmB,EAAE,EAAE,CAAC,EAAE,EAAC;gBACvD,IAAI,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,EAAC;oBAC1D,IAAI,EAAE,CAAC;iBACV;qBAAM;oBACH,IAAI,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,EAAC;wBAC1D,KAAK,EAAE,CAAC;qBACX;iBACJ;aACJ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K,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,mBAAmB,EAAE,EAAE,CAAC,EAAE,EAAC;gBACvD,IAAI,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,EAAC;oBAC1D,IAAI,EAAE,CAAC;iBACV;qBAAM;oBACH,IAAI,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,EAAC;wBAC1D,KAAK,EAAE,CAAC;qBACX;iBACJ;aACJ;YACD,IAAI,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC;YACzB,IAAI,MAAM,GAAG,GAAG,CAAC;YACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,EAAE,EAAC;gBAC3B,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;aAC1D;YACD,OAAO,IAAI,6CAAqB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QACpD,CAAC;KAEJ;IArDD,oBAqDC"}
@@ -2,8 +2,38 @@ import { StatisticalTestResultType } from "./StatisticalTestResultType";
2
2
  export declare class StatisticalTestResult {
3
3
  private readonly pValue;
4
4
  private readonly onlyTwoTailed;
5
+ /**
6
+ * Constructor of the StatisticalTestResult. It sets the attribute values.
7
+ * @param pValue p value of the statistical test result
8
+ * @param onlyTwoTailed True, if this test applicable only two tailed tests, false otherwise.
9
+ */
5
10
  constructor(pValue: number, onlyTwoTailed: boolean);
11
+ /**
12
+ * Returns reject or failed to reject, depending on the alpha level and p value of the statistical test that checks
13
+ * one tailed null hypothesis such as mu1 < mu2. If p value is less than the alpha level, the test rejects the null
14
+ * hypothesis. Otherwise, it fails to reject the null hypothesis.
15
+ * @param alpha Alpha level of the test
16
+ * @return If p value is less than the alpha level, the test rejects the null hypothesis. Otherwise, it fails to
17
+ * reject the null hypothesis.
18
+ */
6
19
  oneTailed(alpha: number): StatisticalTestResultType;
20
+ /**
21
+ * Returns reject or failed to reject, depending on the alpha level and p value of the statistical test that checks
22
+ * one tailed null hypothesis such as mu1 < mu2 or two tailed null hypothesis such as mu1 = mu2. If the null
23
+ * hypothesis is two tailed, and p value is less than the alpha level, the test rejects the null hypothesis.
24
+ * Otherwise, it fails to reject the null hypothesis. If the null hypothesis is one tailed, and p value is less
25
+ * than alpha / 2 or p value is larger than 1 - alpha / 2, the test rejects the null hypothesis. Otherwise, it
26
+ * fails to reject the null hypothesis.
27
+ * @param alpha Alpha level of the test
28
+ * @return If the null hypothesis is two tailed, and p value is less than the alpha level, the test rejects the
29
+ * null hypothesis. Otherwise, it fails to reject the null hypothesis. If the null hypothesis is one tailed, and
30
+ * p value is less than alpha / 2 or p value is larger than 1 - alpha / 2, the test rejects the null hypothesis.
31
+ * Otherwise, it fails to reject the null hypothesis.
32
+ */
7
33
  twoTailed(alpha: number): StatisticalTestResultType;
34
+ /**
35
+ * Accessor for the p value of the statistical test result.
36
+ * @return p value of the statistical test result
37
+ */
8
38
  getPValue(): number;
9
39
  }
@@ -12,10 +12,23 @@
12
12
  exports.StatisticalTestResult = void 0;
13
13
  const StatisticalTestResultType_1 = require("./StatisticalTestResultType");
14
14
  class StatisticalTestResult {
15
+ /**
16
+ * Constructor of the StatisticalTestResult. It sets the attribute values.
17
+ * @param pValue p value of the statistical test result
18
+ * @param onlyTwoTailed True, if this test applicable only two tailed tests, false otherwise.
19
+ */
15
20
  constructor(pValue, onlyTwoTailed) {
16
21
  this.pValue = pValue;
17
22
  this.onlyTwoTailed = onlyTwoTailed;
18
23
  }
24
+ /**
25
+ * Returns reject or failed to reject, depending on the alpha level and p value of the statistical test that checks
26
+ * one tailed null hypothesis such as mu1 < mu2. If p value is less than the alpha level, the test rejects the null
27
+ * hypothesis. Otherwise, it fails to reject the null hypothesis.
28
+ * @param alpha Alpha level of the test
29
+ * @return If p value is less than the alpha level, the test rejects the null hypothesis. Otherwise, it fails to
30
+ * reject the null hypothesis.
31
+ */
19
32
  oneTailed(alpha) {
20
33
  if (!this.onlyTwoTailed) {
21
34
  if (this.pValue < alpha) {
@@ -26,6 +39,19 @@
26
39
  }
27
40
  }
28
41
  }
42
+ /**
43
+ * Returns reject or failed to reject, depending on the alpha level and p value of the statistical test that checks
44
+ * one tailed null hypothesis such as mu1 < mu2 or two tailed null hypothesis such as mu1 = mu2. If the null
45
+ * hypothesis is two tailed, and p value is less than the alpha level, the test rejects the null hypothesis.
46
+ * Otherwise, it fails to reject the null hypothesis. If the null hypothesis is one tailed, and p value is less
47
+ * than alpha / 2 or p value is larger than 1 - alpha / 2, the test rejects the null hypothesis. Otherwise, it
48
+ * fails to reject the null hypothesis.
49
+ * @param alpha Alpha level of the test
50
+ * @return If the null hypothesis is two tailed, and p value is less than the alpha level, the test rejects the
51
+ * null hypothesis. Otherwise, it fails to reject the null hypothesis. If the null hypothesis is one tailed, and
52
+ * p value is less than alpha / 2 or p value is larger than 1 - alpha / 2, the test rejects the null hypothesis.
53
+ * Otherwise, it fails to reject the null hypothesis.
54
+ */
29
55
  twoTailed(alpha) {
30
56
  if (this.onlyTwoTailed) {
31
57
  if (this.pValue < alpha) {
@@ -44,6 +70,10 @@
44
70
  }
45
71
  }
46
72
  }
73
+ /**
74
+ * Accessor for the p value of the statistical test result.
75
+ * @return p value of the statistical test result
76
+ */
47
77
  getPValue() {
48
78
  return this.pValue;
49
79
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StatisticalTestResult.js","sourceRoot":"","sources":["../../source/StatisticalTest/StatisticalTestResult.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,2EAAsE;IAEtE,MAAa,qBAAqB;QAK9B,YAAY,MAAc,EAAE,aAAsB;YAC9C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;YACpB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QACtC,CAAC;QAED,SAAS,CAAC,KAAa;YACnB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAC;gBACpB,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,EAAC;oBACpB,OAAO,qDAAyB,CAAC,MAAM,CAAC;iBAC3C;qBAAM;oBACH,OAAO,qDAAyB,CAAC,gBAAgB,CAAC;iBACrD;aACJ;QACL,CAAC;QAED,SAAS,CAAC,KAAa;YACnB,IAAI,IAAI,CAAC,aAAa,EAAC;gBACnB,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,EAAC;oBACpB,OAAO,qDAAyB,CAAC,MAAM,CAAC;iBAC3C;qBAAM;oBACH,OAAO,qDAAyB,CAAC,gBAAgB,CAAC;iBACrD;aACJ;iBAAM;gBACH,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,EAAC;oBACvD,OAAO,qDAAyB,CAAC,MAAM,CAAC;iBAC3C;qBAAM;oBACH,OAAO,qDAAyB,CAAC,gBAAgB,CAAC;iBACrD;aACJ;QACL,CAAC;QAED,SAAS;YACL,OAAO,IAAI,CAAC,MAAM,CAAA;QACtB,CAAC;KACJ;IAvCD,sDAuCC"}
1
+ {"version":3,"file":"StatisticalTestResult.js","sourceRoot":"","sources":["../../source/StatisticalTest/StatisticalTestResult.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,2EAAsE;IAEtE,MAAa,qBAAqB;QAK9B;;;;WAIG;QACH,YAAY,MAAc,EAAE,aAAsB;YAC9C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;YACpB,IAAI,CAAC,aAAa,GAAG,aAAa,CAAA;QACtC,CAAC;QAED;;;;;;;WAOG;QACH,SAAS,CAAC,KAAa;YACnB,IAAI,CAAC,IAAI,CAAC,aAAa,EAAC;gBACpB,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,EAAC;oBACpB,OAAO,qDAAyB,CAAC,MAAM,CAAC;iBAC3C;qBAAM;oBACH,OAAO,qDAAyB,CAAC,gBAAgB,CAAC;iBACrD;aACJ;QACL,CAAC;QAED;;;;;;;;;;;;WAYG;QACH,SAAS,CAAC,KAAa;YACnB,IAAI,IAAI,CAAC,aAAa,EAAC;gBACnB,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,EAAC;oBACpB,OAAO,qDAAyB,CAAC,MAAM,CAAC;iBAC3C;qBAAM;oBACH,OAAO,qDAAyB,CAAC,gBAAgB,CAAC;iBACrD;aACJ;iBAAM;gBACH,IAAI,IAAI,CAAC,MAAM,GAAG,KAAK,GAAG,CAAC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,EAAC;oBACvD,OAAO,qDAAyB,CAAC,MAAM,CAAC;iBAC3C;qBAAM;oBACH,OAAO,qDAAyB,CAAC,gBAAgB,CAAC;iBACrD;aACJ;QACL,CAAC;QAED;;;WAGG;QACH,SAAS;YACL,OAAO,IAAI,CAAC,MAAM,CAAA;QACtB,CAAC;KACJ;IArED,sDAqEC"}