nlptoolkit-classification 1.0.8 → 1.0.9

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 (178) hide show
  1. package/dist/Attribute/Attribute.js +6 -16
  2. package/dist/Attribute/Attribute.js.map +1 -1
  3. package/dist/Attribute/AttributeType.js +22 -32
  4. package/dist/Attribute/AttributeType.js.map +1 -1
  5. package/dist/Attribute/BinaryAttribute.js +14 -24
  6. package/dist/Attribute/BinaryAttribute.js.map +1 -1
  7. package/dist/Attribute/ContinuousAttribute.js +46 -55
  8. package/dist/Attribute/ContinuousAttribute.js.map +1 -1
  9. package/dist/Attribute/DiscreteAttribute.js +38 -48
  10. package/dist/Attribute/DiscreteAttribute.js.map +1 -1
  11. package/dist/Attribute/DiscreteIndexedAttribute.js +47 -55
  12. package/dist/Attribute/DiscreteIndexedAttribute.js.map +1 -1
  13. package/dist/DataSet/DataDefinition.js +115 -123
  14. package/dist/DataSet/DataDefinition.js.map +1 -1
  15. package/dist/DataSet/DataSet.js +268 -245
  16. package/dist/DataSet/DataSet.js.map +1 -1
  17. package/dist/DistanceMetric/DistanceMetric.js +2 -12
  18. package/dist/DistanceMetric/EuclidianDistance.js +27 -37
  19. package/dist/DistanceMetric/EuclidianDistance.js.map +1 -1
  20. package/dist/DistanceMetric/MahalanobisDistance.js +27 -36
  21. package/dist/DistanceMetric/MahalanobisDistance.js.map +1 -1
  22. package/dist/Experiment/BootstrapRun.js +31 -40
  23. package/dist/Experiment/BootstrapRun.js.map +1 -1
  24. package/dist/Experiment/Experiment.js +46 -53
  25. package/dist/Experiment/Experiment.js.map +1 -1
  26. package/dist/Experiment/KFoldRun.js +45 -54
  27. package/dist/Experiment/KFoldRun.js.map +1 -1
  28. package/dist/Experiment/KFoldRunSeparateTest.js +48 -58
  29. package/dist/Experiment/KFoldRunSeparateTest.js.map +1 -1
  30. package/dist/Experiment/MultipleRun.js +2 -12
  31. package/dist/Experiment/MxKFoldRun.js +31 -40
  32. package/dist/Experiment/MxKFoldRun.js.map +1 -1
  33. package/dist/Experiment/MxKFoldRunSeparateTest.js +35 -44
  34. package/dist/Experiment/MxKFoldRunSeparateTest.js.map +1 -1
  35. package/dist/Experiment/SingleRun.js +2 -12
  36. package/dist/Experiment/SingleRunWithK.js +39 -48
  37. package/dist/Experiment/SingleRunWithK.js.map +1 -1
  38. package/dist/Experiment/StratifiedKFoldRun.js +26 -36
  39. package/dist/Experiment/StratifiedKFoldRun.js.map +1 -1
  40. package/dist/Experiment/StratifiedKFoldRunSeparateTest.js +30 -40
  41. package/dist/Experiment/StratifiedKFoldRunSeparateTest.js.map +1 -1
  42. package/dist/Experiment/StratifiedMxKFoldRun.js +29 -39
  43. package/dist/Experiment/StratifiedMxKFoldRun.js.map +1 -1
  44. package/dist/Experiment/StratifiedMxKFoldRunSeparateTest.js +34 -43
  45. package/dist/Experiment/StratifiedMxKFoldRunSeparateTest.js.map +1 -1
  46. package/dist/Experiment/StratifiedSingleRunWithK.js +27 -36
  47. package/dist/Experiment/StratifiedSingleRunWithK.js.map +1 -1
  48. package/dist/FeatureSelection/BackwardSelection.js +26 -36
  49. package/dist/FeatureSelection/BackwardSelection.js.map +1 -1
  50. package/dist/FeatureSelection/FeatureSubSet.js +72 -82
  51. package/dist/FeatureSelection/FeatureSubSet.js.map +1 -1
  52. package/dist/FeatureSelection/FloatingSelection.js +25 -35
  53. package/dist/FeatureSelection/FloatingSelection.js.map +1 -1
  54. package/dist/FeatureSelection/ForwardSelection.js +25 -35
  55. package/dist/FeatureSelection/ForwardSelection.js.map +1 -1
  56. package/dist/FeatureSelection/SubSetSelection.js +69 -78
  57. package/dist/FeatureSelection/SubSetSelection.js.map +1 -1
  58. package/dist/Filter/DiscreteToContinuous.js +50 -60
  59. package/dist/Filter/DiscreteToContinuous.js.map +1 -1
  60. package/dist/Filter/DiscreteToIndexed.js +40 -50
  61. package/dist/Filter/DiscreteToIndexed.js.map +1 -1
  62. package/dist/Filter/FeatureFilter.js +23 -32
  63. package/dist/Filter/FeatureFilter.js.map +1 -1
  64. package/dist/Filter/LaryFilter.js +46 -55
  65. package/dist/Filter/LaryFilter.js.map +1 -1
  66. package/dist/Filter/LaryToBinary.js +48 -58
  67. package/dist/Filter/LaryToBinary.js.map +1 -1
  68. package/dist/Filter/Normalize.js +33 -41
  69. package/dist/Filter/Normalize.js.map +1 -1
  70. package/dist/Filter/Pca.js +86 -96
  71. package/dist/Filter/Pca.js.map +1 -1
  72. package/dist/Filter/TrainedFeatureFilter.js +14 -24
  73. package/dist/Filter/TrainedFeatureFilter.js.map +1 -1
  74. package/dist/Instance/CompositeInstance.js +46 -56
  75. package/dist/Instance/CompositeInstance.js.map +1 -1
  76. package/dist/Instance/Instance.js +145 -154
  77. package/dist/Instance/Instance.js.map +1 -1
  78. package/dist/InstanceList/InstanceList.js +466 -443
  79. package/dist/InstanceList/InstanceList.js.map +1 -1
  80. package/dist/InstanceList/InstanceListOfSameClass.js +23 -32
  81. package/dist/InstanceList/InstanceListOfSameClass.js.map +1 -1
  82. package/dist/InstanceList/Partition.js +167 -177
  83. package/dist/InstanceList/Partition.js.map +1 -1
  84. package/dist/Model/DecisionTree/DecisionCondition.js +71 -80
  85. package/dist/Model/DecisionTree/DecisionCondition.js.map +1 -1
  86. package/dist/Model/DecisionTree/DecisionNode.js +302 -311
  87. package/dist/Model/DecisionTree/DecisionNode.js.map +1 -1
  88. package/dist/Model/DecisionTree/DecisionStump.js +22 -32
  89. package/dist/Model/DecisionTree/DecisionStump.js.map +1 -1
  90. package/dist/Model/DecisionTree/DecisionTree.js +89 -98
  91. package/dist/Model/DecisionTree/DecisionTree.js.map +1 -1
  92. package/dist/Model/DummyModel.js +64 -73
  93. package/dist/Model/DummyModel.js.map +1 -1
  94. package/dist/Model/Ensemble/BaggingModel.js +34 -44
  95. package/dist/Model/Ensemble/BaggingModel.js.map +1 -1
  96. package/dist/Model/Ensemble/RandomForestModel.js +31 -41
  97. package/dist/Model/Ensemble/RandomForestModel.js.map +1 -1
  98. package/dist/Model/Ensemble/TreeEnsembleModel.js +55 -64
  99. package/dist/Model/Ensemble/TreeEnsembleModel.js.map +1 -1
  100. package/dist/Model/Model.js +130 -140
  101. package/dist/Model/Model.js.map +1 -1
  102. package/dist/Model/NeuralNetwork/DeepNetworkModel.js +162 -169
  103. package/dist/Model/NeuralNetwork/DeepNetworkModel.js.map +1 -1
  104. package/dist/Model/NeuralNetwork/LinearPerceptronModel.js +69 -78
  105. package/dist/Model/NeuralNetwork/LinearPerceptronModel.js.map +1 -1
  106. package/dist/Model/NeuralNetwork/MultiLayerPerceptronModel.js +112 -120
  107. package/dist/Model/NeuralNetwork/MultiLayerPerceptronModel.js.map +1 -1
  108. package/dist/Model/NeuralNetwork/NeuralNetworkModel.js +197 -201
  109. package/dist/Model/NeuralNetwork/NeuralNetworkModel.js.map +1 -1
  110. package/dist/Model/NonParametric/KnnInstance.js +21 -29
  111. package/dist/Model/NonParametric/KnnInstance.js.map +1 -1
  112. package/dist/Model/NonParametric/KnnModel.js +101 -108
  113. package/dist/Model/NonParametric/KnnModel.js.map +1 -1
  114. package/dist/Model/Parametric/GaussianModel.js +82 -91
  115. package/dist/Model/Parametric/GaussianModel.js.map +1 -1
  116. package/dist/Model/Parametric/KMeansModel.js +59 -67
  117. package/dist/Model/Parametric/KMeansModel.js.map +1 -1
  118. package/dist/Model/Parametric/LdaModel.js +83 -91
  119. package/dist/Model/Parametric/LdaModel.js.map +1 -1
  120. package/dist/Model/Parametric/NaiveBayesModel.js +119 -132
  121. package/dist/Model/Parametric/NaiveBayesModel.js.map +1 -1
  122. package/dist/Model/Parametric/QdaModel.js +70 -79
  123. package/dist/Model/Parametric/QdaModel.js.map +1 -1
  124. package/dist/Model/RandomModel.js +85 -92
  125. package/dist/Model/RandomModel.js.map +1 -1
  126. package/dist/Model/ValidatedModel.js +21 -31
  127. package/dist/Model/ValidatedModel.js.map +1 -1
  128. package/dist/Parameter/ActivationFunction.js +9 -19
  129. package/dist/Parameter/ActivationFunction.js.map +1 -1
  130. package/dist/Parameter/BaggingParameter.js +24 -33
  131. package/dist/Parameter/BaggingParameter.js.map +1 -1
  132. package/dist/Parameter/C45Parameter.js +34 -42
  133. package/dist/Parameter/C45Parameter.js.map +1 -1
  134. package/dist/Parameter/DeepNetworkParameter.js +48 -56
  135. package/dist/Parameter/DeepNetworkParameter.js.map +1 -1
  136. package/dist/Parameter/KMeansParameter.js +29 -38
  137. package/dist/Parameter/KMeansParameter.js.map +1 -1
  138. package/dist/Parameter/KnnParameter.js +25 -34
  139. package/dist/Parameter/KnnParameter.js.map +1 -1
  140. package/dist/Parameter/LinearPerceptronParameter.js +56 -62
  141. package/dist/Parameter/LinearPerceptronParameter.js.map +1 -1
  142. package/dist/Parameter/MultiLayerPerceptronParameter.js +38 -46
  143. package/dist/Parameter/MultiLayerPerceptronParameter.js.map +1 -1
  144. package/dist/Parameter/Parameter.js +21 -30
  145. package/dist/Parameter/Parameter.js.map +1 -1
  146. package/dist/Parameter/RandomForestParameter.js +25 -34
  147. package/dist/Parameter/RandomForestParameter.js.map +1 -1
  148. package/dist/Performance/ClassificationPerformance.js +24 -33
  149. package/dist/Performance/ClassificationPerformance.js.map +1 -1
  150. package/dist/Performance/ConfusionMatrix.js +149 -158
  151. package/dist/Performance/ConfusionMatrix.js.map +1 -1
  152. package/dist/Performance/DetailedClassificationPerformance.js +23 -32
  153. package/dist/Performance/DetailedClassificationPerformance.js.map +1 -1
  154. package/dist/Performance/ExperimentPerformance.js +184 -161
  155. package/dist/Performance/ExperimentPerformance.js.map +1 -1
  156. package/dist/Performance/Performance.js +21 -30
  157. package/dist/Performance/Performance.js.map +1 -1
  158. package/dist/StatisticalTest/Combined5x2F.js +41 -51
  159. package/dist/StatisticalTest/Combined5x2F.js.map +1 -1
  160. package/dist/StatisticalTest/Combined5x2t.js +42 -52
  161. package/dist/StatisticalTest/Combined5x2t.js.map +1 -1
  162. package/dist/StatisticalTest/Paired5x2t.js +40 -50
  163. package/dist/StatisticalTest/Paired5x2t.js.map +1 -1
  164. package/dist/StatisticalTest/PairedTest.js +31 -41
  165. package/dist/StatisticalTest/PairedTest.js.map +1 -1
  166. package/dist/StatisticalTest/Pairedt.js +38 -48
  167. package/dist/StatisticalTest/Pairedt.js.map +1 -1
  168. package/dist/StatisticalTest/Sign.js +50 -60
  169. package/dist/StatisticalTest/Sign.js.map +1 -1
  170. package/dist/StatisticalTest/StatisticalTestResult.js +65 -73
  171. package/dist/StatisticalTest/StatisticalTestResult.js.map +1 -1
  172. package/dist/StatisticalTest/StatisticalTestResultType.js +11 -21
  173. package/dist/StatisticalTest/StatisticalTestResultType.js.map +1 -1
  174. package/dist/index.js +95 -101
  175. package/dist/index.js.map +1 -1
  176. package/package.json +7 -6
  177. package/tsconfig.json +4 -3
  178. package/source/tsconfig.json +0 -13
@@ -1,176 +1,199 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
5
7
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./Performance", "fs", "./DetailedClassificationPerformance", "./ClassificationPerformance"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ExperimentPerformance = void 0;
13
- const Performance_1 = require("./Performance");
14
- const fs = require("fs");
15
- const DetailedClassificationPerformance_1 = require("./DetailedClassificationPerformance");
16
- const ClassificationPerformance_1 = require("./ClassificationPerformance");
17
- class ExperimentPerformance {
18
- /**
19
- * A constructor that takes a file name as an input and takes the inputs from that file assigns these inputs to the
20
- * errorRate and adds them to the results {@link Array} as a new {@link Performance}.
21
- *
22
- * @param fileName String input.
23
- */
24
- constructor(fileName) {
25
- this.results = new Array();
26
- this.containsDetails = true;
27
- this.classification = true;
28
- if (fileName != undefined) {
29
- let data = fs.readFileSync(fileName, 'utf8');
30
- let lines = data.split("\n");
31
- for (let line of lines) {
32
- this.results.push(new Performance_1.Performance(Number.parseFloat(line)));
33
- }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ExperimentPerformance = void 0;
37
+ const Performance_1 = require("./Performance");
38
+ const fs = __importStar(require("fs"));
39
+ const DetailedClassificationPerformance_1 = require("./DetailedClassificationPerformance");
40
+ const ClassificationPerformance_1 = require("./ClassificationPerformance");
41
+ class ExperimentPerformance {
42
+ results = new Array();
43
+ containsDetails = true;
44
+ classification = true;
45
+ /**
46
+ * A constructor that takes a file name as an input and takes the inputs from that file assigns these inputs to the
47
+ * errorRate and adds them to the results {@link Array} as a new {@link Performance}.
48
+ *
49
+ * @param fileName String input.
50
+ */
51
+ constructor(fileName) {
52
+ if (fileName != undefined) {
53
+ let data = fs.readFileSync(fileName, 'utf8');
54
+ let lines = data.split("\n");
55
+ for (let line of lines) {
56
+ this.results.push(new Performance_1.Performance(Number.parseFloat(line)));
34
57
  }
35
58
  }
36
- /**
37
- * The add method takes a {@link Performance} as an input and adds it to the results {@link Array}.
38
- *
39
- * @param performance {@link Performance} input.
40
- */
41
- add(performance) {
42
- if (!(performance instanceof DetailedClassificationPerformance_1.DetailedClassificationPerformance)) {
43
- this.containsDetails = false;
44
- }
45
- if (!(performance instanceof ClassificationPerformance_1.ClassificationPerformance)) {
46
- this.classification = false;
47
- }
48
- this.results.push(performance);
59
+ }
60
+ /**
61
+ * The add method takes a {@link Performance} as an input and adds it to the results {@link Array}.
62
+ *
63
+ * @param performance {@link Performance} input.
64
+ */
65
+ add(performance) {
66
+ if (!(performance instanceof DetailedClassificationPerformance_1.DetailedClassificationPerformance)) {
67
+ this.containsDetails = false;
49
68
  }
50
- /**
51
- * The numberOfExperiments method returns the size of the results {@link Array}.
52
- *
53
- * @return The results {@link Array}.
54
- */
55
- numberOfExperiments() {
56
- return this.results.length;
69
+ if (!(performance instanceof ClassificationPerformance_1.ClassificationPerformance)) {
70
+ this.classification = false;
57
71
  }
58
- /**
59
- * The getErrorRate method takes an index as an input and returns the errorRate at given index of
60
- * results {@link Array}.
61
- *
62
- * @param index Index of results {@link Array} to retrieve.
63
- * @return The errorRate at given index of results {@link Array}.
64
- */
65
- getErrorRate(index) {
66
- return this.results[index].getErrorRate();
72
+ this.results.push(performance);
73
+ }
74
+ /**
75
+ * The numberOfExperiments method returns the size of the results {@link Array}.
76
+ *
77
+ * @return The results {@link Array}.
78
+ */
79
+ numberOfExperiments() {
80
+ return this.results.length;
81
+ }
82
+ /**
83
+ * The getErrorRate method takes an index as an input and returns the errorRate at given index of
84
+ * results {@link Array}.
85
+ *
86
+ * @param index Index of results {@link Array} to retrieve.
87
+ * @return The errorRate at given index of results {@link Array}.
88
+ */
89
+ getErrorRate(index) {
90
+ return this.results[index].getErrorRate();
91
+ }
92
+ /**
93
+ * The getAccuracy method takes an index as an input. It returns the accuracy of a {@link Performance} at given
94
+ * index of results {@link Array}.
95
+ *
96
+ * @param index Index of results {@link Array} to retrieve.
97
+ * @return The accuracy of a {@link Performance} at given index of results {@link Array}.
98
+ */
99
+ getAccuracy(index) {
100
+ if (this.results[index] instanceof ClassificationPerformance_1.ClassificationPerformance) {
101
+ return this.results[index].getAccuracy();
67
102
  }
68
- /**
69
- * The getAccuracy method takes an index as an input. It returns the accuracy of a {@link Performance} at given
70
- * index of results {@link Array}.
71
- *
72
- * @param index Index of results {@link Array} to retrieve.
73
- * @return The accuracy of a {@link Performance} at given index of results {@link Array}.
74
- */
75
- getAccuracy(index) {
76
- if (this.results[index] instanceof ClassificationPerformance_1.ClassificationPerformance) {
77
- return this.results[index].getAccuracy();
78
- }
103
+ }
104
+ /**
105
+ * The meanPerformance method loops through the performances of results {@link Array} and sums up the errorRates
106
+ * of each then returns a new {@link Performance} with the mean of that summation.
107
+ *
108
+ * @return A new {@link Performance} with the mean of the summation of errorRates.
109
+ */
110
+ meanPerformance() {
111
+ let sumError = 0;
112
+ for (let performance of this.results) {
113
+ sumError += performance.getErrorRate();
79
114
  }
80
- /**
81
- * The meanPerformance method loops through the performances of results {@link Array} and sums up the errorRates
82
- * of each then returns a new {@link Performance} with the mean of that summation.
83
- *
84
- * @return A new {@link Performance} with the mean of the summation of errorRates.
85
- */
86
- meanPerformance() {
87
- let sumError = 0;
88
- for (let performance of this.results) {
89
- sumError += performance.getErrorRate();
90
- }
91
- return new Performance_1.Performance(sumError / this.results.length);
115
+ return new Performance_1.Performance(sumError / this.results.length);
116
+ }
117
+ /**
118
+ * The meanClassificationPerformance method loops through the performances of results {@link Array} and sums up the
119
+ * accuracy of each classification performance, then returns a new classificationPerformance with the mean of that
120
+ * summation.
121
+ *
122
+ * @return A new classificationPerformance with the mean of that summation.
123
+ */
124
+ meanClassificationPerformance() {
125
+ if (this.results.length == 0 || !this.classification) {
126
+ return undefined;
92
127
  }
93
- /**
94
- * The meanClassificationPerformance method loops through the performances of results {@link Array} and sums up the
95
- * accuracy of each classification performance, then returns a new classificationPerformance with the mean of that
96
- * summation.
97
- *
98
- * @return A new classificationPerformance with the mean of that summation.
99
- */
100
- meanClassificationPerformance() {
101
- if (this.results.length == 0 || !this.classification) {
102
- return undefined;
103
- }
104
- let sumAccuracy = 0;
105
- for (let performance of this.results) {
106
- let classificationPerformance = performance;
107
- sumAccuracy += classificationPerformance.getAccuracy();
108
- }
109
- return new ClassificationPerformance_1.ClassificationPerformance(sumAccuracy / this.results.length);
128
+ let sumAccuracy = 0;
129
+ for (let performance of this.results) {
130
+ let classificationPerformance = performance;
131
+ sumAccuracy += classificationPerformance.getAccuracy();
110
132
  }
111
- /**
112
- * The meanDetailedPerformance method gets the first confusion matrix of results {@link Array}.
113
- * Then, it adds new confusion matrices as the {@link DetailedClassificationPerformance} of
114
- * other elements of results ArrayList' confusion matrices as a {@link DetailedClassificationPerformance}.
115
- *
116
- * @return A new {@link DetailedClassificationPerformance} with the {@link ConfusionMatrix} sum.
117
- */
118
- meanDetailedPerformance() {
119
- if (this.results.length == 0 || !this.containsDetails) {
120
- return undefined;
121
- }
122
- let sum = this.results[0].getConfusionMatrix();
123
- for (let i = 1; i < this.results.length; i++) {
124
- sum.addConfusionMatrix(this.results[i].getConfusionMatrix());
125
- }
126
- return new DetailedClassificationPerformance_1.DetailedClassificationPerformance(sum);
133
+ return new ClassificationPerformance_1.ClassificationPerformance(sumAccuracy / this.results.length);
134
+ }
135
+ /**
136
+ * The meanDetailedPerformance method gets the first confusion matrix of results {@link Array}.
137
+ * Then, it adds new confusion matrices as the {@link DetailedClassificationPerformance} of
138
+ * other elements of results ArrayList' confusion matrices as a {@link DetailedClassificationPerformance}.
139
+ *
140
+ * @return A new {@link DetailedClassificationPerformance} with the {@link ConfusionMatrix} sum.
141
+ */
142
+ meanDetailedPerformance() {
143
+ if (this.results.length == 0 || !this.containsDetails) {
144
+ return undefined;
127
145
  }
128
- /**
129
- * The standardDeviationPerformance method loops through the {@link Performance}s of results {@link Array} and
130
- * returns a new Performance with the standard deviation.
131
- *
132
- * @return A new Performance with the standard deviation.
133
- */
134
- standardDeviationPerformance() {
135
- let sumErrorRate = 0;
136
- let averagePerformance = this.meanPerformance();
137
- for (let performance of this.results) {
138
- sumErrorRate += Math.pow(performance.getErrorRate() - averagePerformance.getErrorRate(), 2);
139
- }
140
- return new Performance_1.Performance(Math.sqrt(sumErrorRate / (this.results.length - 1)));
146
+ let sum = this.results[0].getConfusionMatrix();
147
+ for (let i = 1; i < this.results.length; i++) {
148
+ sum.addConfusionMatrix(this.results[i].getConfusionMatrix());
141
149
  }
142
- /**
143
- * The standardDeviationClassificationPerformance method loops through the {@link Performance}s of results {@link ArrayList} and
144
- * returns a new {@link ClassificationPerformance} with standard deviation.
145
- *
146
- * @return A new {@link ClassificationPerformance} with standard deviation.
147
- */
148
- standardDeviationClassificationPerformance() {
149
- if (this.results.length == 0 || !this.classification) {
150
- return undefined;
151
- }
152
- let sumAccuracy = 0, sumErrorRate = 0;
153
- let averageClassificationPerformance = this.meanClassificationPerformance();
154
- for (let performance of this.results) {
155
- let classificationPerformance = performance;
156
- sumAccuracy += Math.pow(classificationPerformance.getAccuracy() - averageClassificationPerformance.getAccuracy(), 2);
157
- sumErrorRate += Math.pow(classificationPerformance.getErrorRate() - averageClassificationPerformance.getErrorRate(), 2);
158
- }
159
- return new ClassificationPerformance_1.ClassificationPerformance(Math.sqrt(sumAccuracy / (this.results.length - 1)), Math.sqrt(sumErrorRate / (this.results.length - 1)));
150
+ return new DetailedClassificationPerformance_1.DetailedClassificationPerformance(sum);
151
+ }
152
+ /**
153
+ * The standardDeviationPerformance method loops through the {@link Performance}s of results {@link Array} and
154
+ * returns a new Performance with the standard deviation.
155
+ *
156
+ * @return A new Performance with the standard deviation.
157
+ */
158
+ standardDeviationPerformance() {
159
+ let sumErrorRate = 0;
160
+ let averagePerformance = this.meanPerformance();
161
+ for (let performance of this.results) {
162
+ sumErrorRate += Math.pow(performance.getErrorRate() - averagePerformance.getErrorRate(), 2);
163
+ }
164
+ return new Performance_1.Performance(Math.sqrt(sumErrorRate / (this.results.length - 1)));
165
+ }
166
+ /**
167
+ * The standardDeviationClassificationPerformance method loops through the {@link Performance}s of results {@link ArrayList} and
168
+ * returns a new {@link ClassificationPerformance} with standard deviation.
169
+ *
170
+ * @return A new {@link ClassificationPerformance} with standard deviation.
171
+ */
172
+ standardDeviationClassificationPerformance() {
173
+ if (this.results.length == 0 || !this.classification) {
174
+ return undefined;
160
175
  }
161
- /**
162
- * The isBetter method takes an {@link ExperimentPerformance} as an input and returns true if the result of compareTo method is positive
163
- * and false otherwise.
164
- *
165
- * @param experimentPerformance {@link ExperimentPerformance} input.
166
- * @return True if the result of compareTo method is positive and false otherwise.
167
- */
168
- isBetter(experimentPerformance) {
169
- let accuracy1 = this.meanClassificationPerformance().getAccuracy();
170
- let accuracy2 = experimentPerformance.meanClassificationPerformance().getAccuracy();
171
- return accuracy1 > accuracy2;
176
+ let sumAccuracy = 0, sumErrorRate = 0;
177
+ let averageClassificationPerformance = this.meanClassificationPerformance();
178
+ for (let performance of this.results) {
179
+ let classificationPerformance = performance;
180
+ sumAccuracy += Math.pow(classificationPerformance.getAccuracy() - averageClassificationPerformance.getAccuracy(), 2);
181
+ sumErrorRate += Math.pow(classificationPerformance.getErrorRate() - averageClassificationPerformance.getErrorRate(), 2);
172
182
  }
183
+ return new ClassificationPerformance_1.ClassificationPerformance(Math.sqrt(sumAccuracy / (this.results.length - 1)), Math.sqrt(sumErrorRate / (this.results.length - 1)));
173
184
  }
174
- exports.ExperimentPerformance = ExperimentPerformance;
175
- });
185
+ /**
186
+ * The isBetter method takes an {@link ExperimentPerformance} as an input and returns true if the result of compareTo method is positive
187
+ * and false otherwise.
188
+ *
189
+ * @param experimentPerformance {@link ExperimentPerformance} input.
190
+ * @return True if the result of compareTo method is positive and false otherwise.
191
+ */
192
+ isBetter(experimentPerformance) {
193
+ let accuracy1 = this.meanClassificationPerformance().getAccuracy();
194
+ let accuracy2 = experimentPerformance.meanClassificationPerformance().getAccuracy();
195
+ return accuracy1 > accuracy2;
196
+ }
197
+ }
198
+ exports.ExperimentPerformance = ExperimentPerformance;
176
199
  //# sourceMappingURL=ExperimentPerformance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExperimentPerformance.js","sourceRoot":"","sources":["../../source/Performance/ExperimentPerformance.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,+CAA0C;IAC1C,yBAAyB;IACzB,2FAAsF;IACtF,2EAAsE;IAEtE,MAAa,qBAAqB;QAM9B;;;;;WAKG;QACH,YAAY,QAAiB;YAVrB,YAAO,GAAuB,IAAI,KAAK,EAAe,CAAA;YACtD,oBAAe,GAAY,IAAI,CAAA;YAC/B,mBAAc,GAAY,IAAI,CAAA;YASlC,IAAI,QAAQ,IAAI,SAAS,EAAC;gBACtB,IAAI,IAAI,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;gBAC5C,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;gBAC5B,KAAK,IAAI,IAAI,IAAI,KAAK,EAAC;oBACnB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,yBAAW,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;iBAC9D;aACJ;QACL,CAAC;QAED;;;;WAIG;QACH,GAAG,CAAC,WAAwB;YACxB,IAAI,CAAC,CAAC,WAAW,YAAY,qEAAiC,CAAC,EAAC;gBAC5D,IAAI,CAAC,eAAe,GAAG,KAAK,CAAA;aAC/B;YACD,IAAI,CAAC,CAAC,WAAW,YAAY,qDAAyB,CAAC,EAAC;gBACpD,IAAI,CAAC,cAAc,GAAG,KAAK,CAAA;aAC9B;YACD,IAAI,CAAC,OAAO,CAAC,IAAI,C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M,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;OAMG;IACH,QAAQ,CAAC,qBAA4C;QACjD,IAAI,SAAS,GAAG,IAAI,CAAC,6BAA6B,EAAE,CAAC,WAAW,EAAE,CAAC;QACnE,IAAI,SAAS,GAAG,qBAAqB,CAAC,6BAA6B,EAAE,CAAC,WAAW,EAAE,CAAC;QACpF,OAAO,SAAS,GAAG,SAAS,CAAA;IAChC,CAAC;CACJ;AAzKD,sDAyKC"}
@@ -1,33 +1,24 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Performance = void 0;
4
+ class Performance {
5
+ errorRate;
6
+ /**
7
+ * Constructor that sets the error rate.
8
+ *
9
+ * @param errorRate Double input.
10
+ */
11
+ constructor(errorRate) {
12
+ this.errorRate = errorRate;
5
13
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports"], factory);
14
+ /**
15
+ * Accessor for the error rate.
16
+ *
17
+ * @return Double errorRate.
18
+ */
19
+ getErrorRate() {
20
+ return this.errorRate;
8
21
  }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Performance = void 0;
13
- class Performance {
14
- /**
15
- * Constructor that sets the error rate.
16
- *
17
- * @param errorRate Double input.
18
- */
19
- constructor(errorRate) {
20
- this.errorRate = errorRate;
21
- }
22
- /**
23
- * Accessor for the error rate.
24
- *
25
- * @return Double errorRate.
26
- */
27
- getErrorRate() {
28
- return this.errorRate;
29
- }
30
- }
31
- exports.Performance = Performance;
32
- });
22
+ }
23
+ exports.Performance = Performance;
33
24
  //# sourceMappingURL=Performance.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Performance.js","sourceRoot":"","sources":["../../source/Performance/Performance.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,MAAa,WAAW;QAIpB;;;;WAIG;QACH,YAAY,SAAiB;YACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC9B,CAAC;QAED;;;;WAIG;QACH,YAAY;YACR,OAAO,IAAI,CAAC,SAAS,CAAA;QACzB,CAAC;KACJ;IArBD,kCAqBC"}
1
+ {"version":3,"file":"Performance.js","sourceRoot":"","sources":["../../source/Performance/Performance.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAW;IAEV,SAAS,CAAQ;IAE3B;;;;OAIG;IACH,YAAY,SAAiB;QACzB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC9B,CAAC;IAED;;;;OAIG;IACH,YAAY;QACR,OAAO,IAAI,CAAC,SAAS,CAAA;IACzB,CAAC;CACJ;AArBD,kCAqBC"}
@@ -1,55 +1,45 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
5
- }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "./PairedTest", "./StatisticalTestResult", "nlptoolkit-math/dist/Distribution"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Combined5x2F = void 0;
13
- const PairedTest_1 = require("./PairedTest");
14
- const StatisticalTestResult_1 = require("./StatisticalTestResult");
15
- const Distribution_1 = require("nlptoolkit-math/dist/Distribution");
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
- */
23
- testStatistic(classifier1, classifier2) {
24
- let difference = new Array();
25
- let numerator = 0;
26
- for (let i = 0; i < classifier1.numberOfExperiments(); i++) {
27
- difference.push(classifier1.getErrorRate(i) - classifier2.getErrorRate(i));
28
- numerator += difference[i] * difference[i];
29
- }
30
- let denominator = 0;
31
- for (let i = 0; i < classifier1.numberOfExperiments() / 2; i++) {
32
- let mean = (difference[2 * i] + difference[2 * i + 1]) / 2;
33
- let variance = (difference[2 * i] - mean) * (difference[2 * i] - mean) +
34
- (difference[2 * i + 1] - mean) * (difference[2 * i + 1] - mean);
35
- denominator += variance;
36
- }
37
- denominator *= 2;
38
- return numerator / denominator;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Combined5x2F = void 0;
4
+ const PairedTest_1 = require("./PairedTest");
5
+ const StatisticalTestResult_1 = require("./StatisticalTestResult");
6
+ const Distribution_1 = require("nlptoolkit-math/dist/Distribution");
7
+ class Combined5x2F extends PairedTest_1.PairedTest {
8
+ /**
9
+ * Calculates the test statistic of the combined 5x2 cv F test.
10
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
11
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
12
+ * @return Given the performances of two classifiers, the test statistic of the combined 5x2 cv F test.
13
+ */
14
+ testStatistic(classifier1, classifier2) {
15
+ let difference = new Array();
16
+ let numerator = 0;
17
+ for (let i = 0; i < classifier1.numberOfExperiments(); i++) {
18
+ difference.push(classifier1.getErrorRate(i) - classifier2.getErrorRate(i));
19
+ numerator += difference[i] * difference[i];
39
20
  }
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
- */
46
- compareClassifiers(classifier1, classifier2) {
47
- let statistic = this.testStatistic(classifier1, classifier2);
48
- let degreeOfFreedom1 = classifier1.numberOfExperiments();
49
- let degreeOfFreedom2 = classifier1.numberOfExperiments() / 2;
50
- return new StatisticalTestResult_1.StatisticalTestResult(Distribution_1.Distribution.fDistribution(statistic, degreeOfFreedom1, degreeOfFreedom2), true);
21
+ let denominator = 0;
22
+ for (let i = 0; i < classifier1.numberOfExperiments() / 2; i++) {
23
+ let mean = (difference[2 * i] + difference[2 * i + 1]) / 2;
24
+ let variance = (difference[2 * i] - mean) * (difference[2 * i] - mean) +
25
+ (difference[2 * i + 1] - mean) * (difference[2 * i + 1] - mean);
26
+ denominator += variance;
51
27
  }
28
+ denominator *= 2;
29
+ return numerator / denominator;
30
+ }
31
+ /**
32
+ * Compares two classification algorithms based on their performances (accuracy or error rate) using combined 5x2 cv F test.
33
+ * @param classifier1 Performance (error rate or accuracy) results of the first classifier.
34
+ * @param classifier2 Performance (error rate or accuracy) results of the second classifier.
35
+ * @return Statistical test result of the comparison.
36
+ */
37
+ compareClassifiers(classifier1, classifier2) {
38
+ let statistic = this.testStatistic(classifier1, classifier2);
39
+ let degreeOfFreedom1 = classifier1.numberOfExperiments();
40
+ let degreeOfFreedom2 = classifier1.numberOfExperiments() / 2;
41
+ return new StatisticalTestResult_1.StatisticalTestResult(Distribution_1.Distribution.fDistribution(statistic, degreeOfFreedom1, degreeOfFreedom2), true);
52
42
  }
53
- exports.Combined5x2F = Combined5x2F;
54
- });
43
+ }
44
+ exports.Combined5x2F = Combined5x2F;
55
45
  //# sourceMappingURL=Combined5x2F.js.map
@@ -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;QAExC;;;;;WAKG;QACK,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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