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.
- package/dist/Attribute/Attribute.js +6 -16
- package/dist/Attribute/Attribute.js.map +1 -1
- package/dist/Attribute/AttributeType.js +22 -32
- package/dist/Attribute/AttributeType.js.map +1 -1
- package/dist/Attribute/BinaryAttribute.js +14 -24
- package/dist/Attribute/BinaryAttribute.js.map +1 -1
- package/dist/Attribute/ContinuousAttribute.js +46 -55
- package/dist/Attribute/ContinuousAttribute.js.map +1 -1
- package/dist/Attribute/DiscreteAttribute.js +38 -48
- package/dist/Attribute/DiscreteAttribute.js.map +1 -1
- package/dist/Attribute/DiscreteIndexedAttribute.js +47 -55
- package/dist/Attribute/DiscreteIndexedAttribute.js.map +1 -1
- package/dist/DataSet/DataDefinition.js +115 -123
- package/dist/DataSet/DataDefinition.js.map +1 -1
- package/dist/DataSet/DataSet.js +268 -245
- package/dist/DataSet/DataSet.js.map +1 -1
- package/dist/DistanceMetric/DistanceMetric.js +2 -12
- package/dist/DistanceMetric/EuclidianDistance.js +27 -37
- package/dist/DistanceMetric/EuclidianDistance.js.map +1 -1
- package/dist/DistanceMetric/MahalanobisDistance.js +27 -36
- package/dist/DistanceMetric/MahalanobisDistance.js.map +1 -1
- package/dist/Experiment/BootstrapRun.js +31 -40
- package/dist/Experiment/BootstrapRun.js.map +1 -1
- package/dist/Experiment/Experiment.js +46 -53
- package/dist/Experiment/Experiment.js.map +1 -1
- package/dist/Experiment/KFoldRun.js +45 -54
- package/dist/Experiment/KFoldRun.js.map +1 -1
- package/dist/Experiment/KFoldRunSeparateTest.js +48 -58
- package/dist/Experiment/KFoldRunSeparateTest.js.map +1 -1
- package/dist/Experiment/MultipleRun.js +2 -12
- package/dist/Experiment/MxKFoldRun.js +31 -40
- package/dist/Experiment/MxKFoldRun.js.map +1 -1
- package/dist/Experiment/MxKFoldRunSeparateTest.js +35 -44
- package/dist/Experiment/MxKFoldRunSeparateTest.js.map +1 -1
- package/dist/Experiment/SingleRun.js +2 -12
- package/dist/Experiment/SingleRunWithK.js +39 -48
- package/dist/Experiment/SingleRunWithK.js.map +1 -1
- package/dist/Experiment/StratifiedKFoldRun.js +26 -36
- package/dist/Experiment/StratifiedKFoldRun.js.map +1 -1
- package/dist/Experiment/StratifiedKFoldRunSeparateTest.js +30 -40
- package/dist/Experiment/StratifiedKFoldRunSeparateTest.js.map +1 -1
- package/dist/Experiment/StratifiedMxKFoldRun.js +29 -39
- package/dist/Experiment/StratifiedMxKFoldRun.js.map +1 -1
- package/dist/Experiment/StratifiedMxKFoldRunSeparateTest.js +34 -43
- package/dist/Experiment/StratifiedMxKFoldRunSeparateTest.js.map +1 -1
- package/dist/Experiment/StratifiedSingleRunWithK.js +27 -36
- package/dist/Experiment/StratifiedSingleRunWithK.js.map +1 -1
- package/dist/FeatureSelection/BackwardSelection.js +26 -36
- package/dist/FeatureSelection/BackwardSelection.js.map +1 -1
- package/dist/FeatureSelection/FeatureSubSet.js +72 -82
- package/dist/FeatureSelection/FeatureSubSet.js.map +1 -1
- package/dist/FeatureSelection/FloatingSelection.js +25 -35
- package/dist/FeatureSelection/FloatingSelection.js.map +1 -1
- package/dist/FeatureSelection/ForwardSelection.js +25 -35
- package/dist/FeatureSelection/ForwardSelection.js.map +1 -1
- package/dist/FeatureSelection/SubSetSelection.js +69 -78
- package/dist/FeatureSelection/SubSetSelection.js.map +1 -1
- package/dist/Filter/DiscreteToContinuous.js +50 -60
- package/dist/Filter/DiscreteToContinuous.js.map +1 -1
- package/dist/Filter/DiscreteToIndexed.js +40 -50
- package/dist/Filter/DiscreteToIndexed.js.map +1 -1
- package/dist/Filter/FeatureFilter.js +23 -32
- package/dist/Filter/FeatureFilter.js.map +1 -1
- package/dist/Filter/LaryFilter.js +46 -55
- package/dist/Filter/LaryFilter.js.map +1 -1
- package/dist/Filter/LaryToBinary.js +48 -58
- package/dist/Filter/LaryToBinary.js.map +1 -1
- package/dist/Filter/Normalize.js +33 -41
- package/dist/Filter/Normalize.js.map +1 -1
- package/dist/Filter/Pca.js +86 -96
- package/dist/Filter/Pca.js.map +1 -1
- package/dist/Filter/TrainedFeatureFilter.js +14 -24
- package/dist/Filter/TrainedFeatureFilter.js.map +1 -1
- package/dist/Instance/CompositeInstance.js +46 -56
- package/dist/Instance/CompositeInstance.js.map +1 -1
- package/dist/Instance/Instance.js +145 -154
- package/dist/Instance/Instance.js.map +1 -1
- package/dist/InstanceList/InstanceList.js +466 -443
- package/dist/InstanceList/InstanceList.js.map +1 -1
- package/dist/InstanceList/InstanceListOfSameClass.js +23 -32
- package/dist/InstanceList/InstanceListOfSameClass.js.map +1 -1
- package/dist/InstanceList/Partition.js +167 -177
- package/dist/InstanceList/Partition.js.map +1 -1
- package/dist/Model/DecisionTree/DecisionCondition.js +71 -80
- package/dist/Model/DecisionTree/DecisionCondition.js.map +1 -1
- package/dist/Model/DecisionTree/DecisionNode.js +302 -311
- package/dist/Model/DecisionTree/DecisionNode.js.map +1 -1
- package/dist/Model/DecisionTree/DecisionStump.js +22 -32
- package/dist/Model/DecisionTree/DecisionStump.js.map +1 -1
- package/dist/Model/DecisionTree/DecisionTree.js +89 -98
- package/dist/Model/DecisionTree/DecisionTree.js.map +1 -1
- package/dist/Model/DummyModel.js +64 -73
- package/dist/Model/DummyModel.js.map +1 -1
- package/dist/Model/Ensemble/BaggingModel.js +34 -44
- package/dist/Model/Ensemble/BaggingModel.js.map +1 -1
- package/dist/Model/Ensemble/RandomForestModel.js +31 -41
- package/dist/Model/Ensemble/RandomForestModel.js.map +1 -1
- package/dist/Model/Ensemble/TreeEnsembleModel.js +55 -64
- package/dist/Model/Ensemble/TreeEnsembleModel.js.map +1 -1
- package/dist/Model/Model.js +130 -140
- package/dist/Model/Model.js.map +1 -1
- package/dist/Model/NeuralNetwork/DeepNetworkModel.js +162 -169
- package/dist/Model/NeuralNetwork/DeepNetworkModel.js.map +1 -1
- package/dist/Model/NeuralNetwork/LinearPerceptronModel.js +69 -78
- package/dist/Model/NeuralNetwork/LinearPerceptronModel.js.map +1 -1
- package/dist/Model/NeuralNetwork/MultiLayerPerceptronModel.js +112 -120
- package/dist/Model/NeuralNetwork/MultiLayerPerceptronModel.js.map +1 -1
- package/dist/Model/NeuralNetwork/NeuralNetworkModel.js +197 -201
- package/dist/Model/NeuralNetwork/NeuralNetworkModel.js.map +1 -1
- package/dist/Model/NonParametric/KnnInstance.js +21 -29
- package/dist/Model/NonParametric/KnnInstance.js.map +1 -1
- package/dist/Model/NonParametric/KnnModel.js +101 -108
- package/dist/Model/NonParametric/KnnModel.js.map +1 -1
- package/dist/Model/Parametric/GaussianModel.js +82 -91
- package/dist/Model/Parametric/GaussianModel.js.map +1 -1
- package/dist/Model/Parametric/KMeansModel.js +59 -67
- package/dist/Model/Parametric/KMeansModel.js.map +1 -1
- package/dist/Model/Parametric/LdaModel.js +83 -91
- package/dist/Model/Parametric/LdaModel.js.map +1 -1
- package/dist/Model/Parametric/NaiveBayesModel.js +119 -132
- package/dist/Model/Parametric/NaiveBayesModel.js.map +1 -1
- package/dist/Model/Parametric/QdaModel.js +70 -79
- package/dist/Model/Parametric/QdaModel.js.map +1 -1
- package/dist/Model/RandomModel.js +85 -92
- package/dist/Model/RandomModel.js.map +1 -1
- package/dist/Model/ValidatedModel.js +21 -31
- package/dist/Model/ValidatedModel.js.map +1 -1
- package/dist/Parameter/ActivationFunction.js +9 -19
- package/dist/Parameter/ActivationFunction.js.map +1 -1
- package/dist/Parameter/BaggingParameter.js +24 -33
- package/dist/Parameter/BaggingParameter.js.map +1 -1
- package/dist/Parameter/C45Parameter.js +34 -42
- package/dist/Parameter/C45Parameter.js.map +1 -1
- package/dist/Parameter/DeepNetworkParameter.js +48 -56
- package/dist/Parameter/DeepNetworkParameter.js.map +1 -1
- package/dist/Parameter/KMeansParameter.js +29 -38
- package/dist/Parameter/KMeansParameter.js.map +1 -1
- package/dist/Parameter/KnnParameter.js +25 -34
- package/dist/Parameter/KnnParameter.js.map +1 -1
- package/dist/Parameter/LinearPerceptronParameter.js +56 -62
- package/dist/Parameter/LinearPerceptronParameter.js.map +1 -1
- package/dist/Parameter/MultiLayerPerceptronParameter.js +38 -46
- package/dist/Parameter/MultiLayerPerceptronParameter.js.map +1 -1
- package/dist/Parameter/Parameter.js +21 -30
- package/dist/Parameter/Parameter.js.map +1 -1
- package/dist/Parameter/RandomForestParameter.js +25 -34
- package/dist/Parameter/RandomForestParameter.js.map +1 -1
- package/dist/Performance/ClassificationPerformance.js +24 -33
- package/dist/Performance/ClassificationPerformance.js.map +1 -1
- package/dist/Performance/ConfusionMatrix.js +149 -158
- package/dist/Performance/ConfusionMatrix.js.map +1 -1
- package/dist/Performance/DetailedClassificationPerformance.js +23 -32
- package/dist/Performance/DetailedClassificationPerformance.js.map +1 -1
- package/dist/Performance/ExperimentPerformance.js +184 -161
- package/dist/Performance/ExperimentPerformance.js.map +1 -1
- package/dist/Performance/Performance.js +21 -30
- package/dist/Performance/Performance.js.map +1 -1
- package/dist/StatisticalTest/Combined5x2F.js +41 -51
- package/dist/StatisticalTest/Combined5x2F.js.map +1 -1
- package/dist/StatisticalTest/Combined5x2t.js +42 -52
- package/dist/StatisticalTest/Combined5x2t.js.map +1 -1
- package/dist/StatisticalTest/Paired5x2t.js +40 -50
- package/dist/StatisticalTest/Paired5x2t.js.map +1 -1
- package/dist/StatisticalTest/PairedTest.js +31 -41
- package/dist/StatisticalTest/PairedTest.js.map +1 -1
- package/dist/StatisticalTest/Pairedt.js +38 -48
- package/dist/StatisticalTest/Pairedt.js.map +1 -1
- package/dist/StatisticalTest/Sign.js +50 -60
- package/dist/StatisticalTest/Sign.js.map +1 -1
- package/dist/StatisticalTest/StatisticalTestResult.js +65 -73
- package/dist/StatisticalTest/StatisticalTestResult.js.map +1 -1
- package/dist/StatisticalTest/StatisticalTestResultType.js +11 -21
- package/dist/StatisticalTest/StatisticalTestResultType.js.map +1 -1
- package/dist/index.js +95 -101
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
- package/tsconfig.json +4 -3
- package/source/tsconfig.json +0 -13
|
@@ -1,44 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MxKFoldRun = void 0;
|
|
4
|
+
const KFoldRun_1 = require("./KFoldRun");
|
|
5
|
+
const ExperimentPerformance_1 = require("../Performance/ExperimentPerformance");
|
|
6
|
+
const KFoldCrossValidation_1 = require("nlptoolkit-sampling/dist/KFoldCrossValidation");
|
|
7
|
+
class MxKFoldRun extends KFoldRun_1.KFoldRun {
|
|
8
|
+
M;
|
|
9
|
+
/**
|
|
10
|
+
* Constructor for MxKFoldRun class. Basically sets K parameter of the K-fold cross-validation and M for the number of times.
|
|
11
|
+
*
|
|
12
|
+
* @param M number of cross-validation times.
|
|
13
|
+
* @param K K of the K-fold cross-validation.
|
|
14
|
+
*/
|
|
15
|
+
constructor(M, K) {
|
|
16
|
+
super(K);
|
|
17
|
+
this.M = M;
|
|
5
18
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Constructor for MxKFoldRun class. Basically sets K parameter of the K-fold cross-validation and M for the number of times.
|
|
19
|
-
*
|
|
20
|
-
* @param M number of cross-validation times.
|
|
21
|
-
* @param K K of the K-fold cross-validation.
|
|
22
|
-
*/
|
|
23
|
-
constructor(M, K) {
|
|
24
|
-
super(K);
|
|
25
|
-
this.M = M;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Execute the MxKFold run with the given classifier on the given data set using the given parameters.
|
|
29
|
-
*
|
|
30
|
-
* @param experiment Experiment to be run.
|
|
31
|
-
* @return An ExperimentPerformance instance.
|
|
32
|
-
*/
|
|
33
|
-
execute(experiment) {
|
|
34
|
-
let result = new ExperimentPerformance_1.ExperimentPerformance();
|
|
35
|
-
for (let j = 0; j < this.M; j++) {
|
|
36
|
-
let crossValidation = new KFoldCrossValidation_1.KFoldCrossValidation(experiment.getDataSet().getInstances(), this.K, experiment.getParameter().getSeed());
|
|
37
|
-
this.runExperiment(experiment.getmodel(), experiment.getParameter(), result, crossValidation);
|
|
38
|
-
}
|
|
39
|
-
return result;
|
|
19
|
+
/**
|
|
20
|
+
* Execute the MxKFold run with the given classifier on the given data set using the given parameters.
|
|
21
|
+
*
|
|
22
|
+
* @param experiment Experiment to be run.
|
|
23
|
+
* @return An ExperimentPerformance instance.
|
|
24
|
+
*/
|
|
25
|
+
execute(experiment) {
|
|
26
|
+
let result = new ExperimentPerformance_1.ExperimentPerformance();
|
|
27
|
+
for (let j = 0; j < this.M; j++) {
|
|
28
|
+
let crossValidation = new KFoldCrossValidation_1.KFoldCrossValidation(experiment.getDataSet().getInstances(), this.K, experiment.getParameter().getSeed());
|
|
29
|
+
this.runExperiment(experiment.getmodel(), experiment.getParameter(), result, crossValidation);
|
|
40
30
|
}
|
|
31
|
+
return result;
|
|
41
32
|
}
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
}
|
|
34
|
+
exports.MxKFoldRun = MxKFoldRun;
|
|
44
35
|
//# sourceMappingURL=MxKFoldRun.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MxKFoldRun.js","sourceRoot":"","sources":["../../source/Experiment/MxKFoldRun.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MxKFoldRun.js","sourceRoot":"","sources":["../../source/Experiment/MxKFoldRun.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AAEpC,gFAA2E;AAC3E,wFAAmF;AAGnF,MAAa,UAAW,SAAQ,mBAAQ;IAE1B,CAAC,CAAQ;IAEnB;;;;;OAKG;IACH,YAAY,CAAS,EAAE,CAAS;QAC5B,KAAK,CAAC,CAAC,CAAC,CAAC;QACT,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;IACd,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,UAAsB;QAC1B,IAAI,MAAM,GAAG,IAAI,6CAAqB,EAAE,CAAC;QACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9B,IAAI,eAAe,GAAG,IAAI,2CAAoB,CAAW,UAAU,CAAC,UAAU,EAAE,CAAC,YAAY,EAAE,EAAE,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YAC9I,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,UAAU,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;QAClG,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CAEJ;AA9BD,gCA8BC"}
|
|
@@ -1,48 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MxKFoldRunSeparateTest = void 0;
|
|
4
|
+
const KFoldRunSeparateTest_1 = require("./KFoldRunSeparateTest");
|
|
5
|
+
const ExperimentPerformance_1 = require("../Performance/ExperimentPerformance");
|
|
6
|
+
const Partition_1 = require("../InstanceList/Partition");
|
|
7
|
+
const KFoldCrossValidation_1 = require("nlptoolkit-sampling/dist/KFoldCrossValidation");
|
|
8
|
+
class MxKFoldRunSeparateTest extends KFoldRunSeparateTest_1.KFoldRunSeparateTest {
|
|
9
|
+
M;
|
|
10
|
+
/**
|
|
11
|
+
* Constructor for KFoldRunSeparateTest class. Basically sets K parameter of the K-fold cross-validation and M for
|
|
12
|
+
* the number of times.
|
|
13
|
+
*
|
|
14
|
+
* @param M number of cross-validation times.
|
|
15
|
+
* @param K K of the K-fold cross-validation.
|
|
16
|
+
*/
|
|
17
|
+
constructor(M, K) {
|
|
18
|
+
super(K);
|
|
19
|
+
this.M = M;
|
|
5
20
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* Constructor for KFoldRunSeparateTest class. Basically sets K parameter of the K-fold cross-validation and M for
|
|
20
|
-
* the number of times.
|
|
21
|
-
*
|
|
22
|
-
* @param M number of cross-validation times.
|
|
23
|
-
* @param K K of the K-fold cross-validation.
|
|
24
|
-
*/
|
|
25
|
-
constructor(M, K) {
|
|
26
|
-
super(K);
|
|
27
|
-
this.M = M;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Execute the MxKFold run with separate test set with the given classifier on the given data set using the given parameters.
|
|
31
|
-
*
|
|
32
|
-
* @param experiment Experiment to be run.
|
|
33
|
-
* @return An ExperimentPerformance instance.
|
|
34
|
-
*/
|
|
35
|
-
execute(experiment) {
|
|
36
|
-
let result = new ExperimentPerformance_1.ExperimentPerformance();
|
|
37
|
-
let instanceList = experiment.getDataSet().getInstanceList();
|
|
38
|
-
let partition = new Partition_1.Partition(instanceList, 0.25, true);
|
|
39
|
-
for (let j = 0; j < this.M; j++) {
|
|
40
|
-
let crossValidation = new KFoldCrossValidation_1.KFoldCrossValidation(partition.get(1).getInstances(), this.K, experiment.getParameter().getSeed());
|
|
41
|
-
this.runExperiment(experiment.getmodel(), experiment.getParameter(), result, crossValidation, partition.get(0));
|
|
42
|
-
}
|
|
43
|
-
return result;
|
|
21
|
+
/**
|
|
22
|
+
* Execute the MxKFold run with separate test set with the given classifier on the given data set using the given parameters.
|
|
23
|
+
*
|
|
24
|
+
* @param experiment Experiment to be run.
|
|
25
|
+
* @return An ExperimentPerformance instance.
|
|
26
|
+
*/
|
|
27
|
+
execute(experiment) {
|
|
28
|
+
let result = new ExperimentPerformance_1.ExperimentPerformance();
|
|
29
|
+
let instanceList = experiment.getDataSet().getInstanceList();
|
|
30
|
+
let partition = new Partition_1.Partition(instanceList, 0.25, true);
|
|
31
|
+
for (let j = 0; j < this.M; j++) {
|
|
32
|
+
let crossValidation = new KFoldCrossValidation_1.KFoldCrossValidation(partition.get(1).getInstances(), this.K, experiment.getParameter().getSeed());
|
|
33
|
+
this.runExperiment(experiment.getmodel(), experiment.getParameter(), result, crossValidation, partition.get(0));
|
|
44
34
|
}
|
|
35
|
+
return result;
|
|
45
36
|
}
|
|
46
|
-
|
|
47
|
-
|
|
37
|
+
}
|
|
38
|
+
exports.MxKFoldRunSeparateTest = MxKFoldRunSeparateTest;
|
|
48
39
|
//# sourceMappingURL=MxKFoldRunSeparateTest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MxKFoldRunSeparateTest.js","sourceRoot":"","sources":["../../source/Experiment/MxKFoldRunSeparateTest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MxKFoldRunSeparateTest.js","sourceRoot":"","sources":["../../source/Experiment/MxKFoldRunSeparateTest.ts"],"names":[],"mappings":";;;AAAA,iEAA4D;AAC5D,gFAA2E;AAE3E,yDAAoD;AACpD,wFAAmF;AAGnF,MAAa,sBAAuB,SAAQ,2CAAoB;IAElD,CAAC,CAAQ;IAEnB;;;;;;OAMG;IACH,YAAY,CAAS,EAAE,CAAS;QAC5B,KAAK,CAAC,CAAC,CAAC,CAAC;QACT,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;IACd,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,UAAsB;QAC1B,IAAI,MAAM,GAAG,IAAI,6CAAqB,EAAE,CAAC;QACzC,IAAI,YAAY,GAAG,UAAU,CAAC,UAAU,EAAE,CAAC,eAAe,EAAE,CAAC;QAC7D,IAAI,SAAS,GAAG,IAAI,qBAAS,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACxD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9B,IAAI,eAAe,GAAG,IAAI,2CAAoB,CAAW,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,EAAE,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YACvI,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,UAAU,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACpH,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAhCD,wDAgCC"}
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
3
|
//# sourceMappingURL=SingleRun.js.map
|
|
@@ -1,52 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SingleRunWithK = void 0;
|
|
4
|
+
const KFoldCrossValidation_1 = require("nlptoolkit-sampling/dist/KFoldCrossValidation");
|
|
5
|
+
const InstanceList_1 = require("../InstanceList/InstanceList");
|
|
6
|
+
class SingleRunWithK {
|
|
7
|
+
K;
|
|
8
|
+
/**
|
|
9
|
+
* Constructor for SingleRunWithK class. Basically sets K parameter of the K-fold cross-validation.
|
|
10
|
+
*
|
|
11
|
+
* @param K K of the K-fold cross-validation.
|
|
12
|
+
*/
|
|
13
|
+
constructor(K) {
|
|
14
|
+
this.K = K;
|
|
5
15
|
}
|
|
6
|
-
|
|
7
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Runs first fold of a K fold cross-validated experiment for the given classifier with the given parameters.
|
|
18
|
+
* The experiment result will be returned.
|
|
19
|
+
* @param model Classifier for the experiment
|
|
20
|
+
* @param parameter Hyperparameters of the classifier of the experiment
|
|
21
|
+
* @param crossValidation K-fold crossvalidated dataset.
|
|
22
|
+
* @return The experiment result of the first fold of the K-fold cross-validated experiment.
|
|
23
|
+
* @throws DiscreteFeaturesNotAllowed If the classifier does not allow discrete features and the dataset contains
|
|
24
|
+
* discrete features, DiscreteFeaturesNotAllowed will be thrown.
|
|
25
|
+
*/
|
|
26
|
+
runExperiment(model, parameter, crossValidation) {
|
|
27
|
+
let trainSet = new InstanceList_1.InstanceList(crossValidation.getTrainFold(0));
|
|
28
|
+
let testSet = new InstanceList_1.InstanceList(crossValidation.getTestFold(0));
|
|
29
|
+
return model.singleRun(parameter, trainSet, testSet);
|
|
8
30
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*
|
|
19
|
-
* @param K K of the K-fold cross-validation.
|
|
20
|
-
*/
|
|
21
|
-
constructor(K) {
|
|
22
|
-
this.K = K;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Runs first fold of a K fold cross-validated experiment for the given classifier with the given parameters.
|
|
26
|
-
* The experiment result will be returned.
|
|
27
|
-
* @param model Classifier for the experiment
|
|
28
|
-
* @param parameter Hyperparameters of the classifier of the experiment
|
|
29
|
-
* @param crossValidation K-fold crossvalidated dataset.
|
|
30
|
-
* @return The experiment result of the first fold of the K-fold cross-validated experiment.
|
|
31
|
-
* @throws DiscreteFeaturesNotAllowed If the classifier does not allow discrete features and the dataset contains
|
|
32
|
-
* discrete features, DiscreteFeaturesNotAllowed will be thrown.
|
|
33
|
-
*/
|
|
34
|
-
runExperiment(model, parameter, crossValidation) {
|
|
35
|
-
let trainSet = new InstanceList_1.InstanceList(crossValidation.getTrainFold(0));
|
|
36
|
-
let testSet = new InstanceList_1.InstanceList(crossValidation.getTestFold(0));
|
|
37
|
-
return model.singleRun(parameter, trainSet, testSet);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Execute Single K-fold cross-validation with the given classifier on the given data set using the given parameters.
|
|
41
|
-
*
|
|
42
|
-
* @param experiment Experiment to be run.
|
|
43
|
-
* @return A Performance instance
|
|
44
|
-
*/
|
|
45
|
-
execute(experiment) {
|
|
46
|
-
let crossValidation = new KFoldCrossValidation_1.KFoldCrossValidation(experiment.getDataSet().getInstances(), this.K, experiment.getParameter().getSeed());
|
|
47
|
-
return this.runExperiment(experiment.getmodel(), experiment.getParameter(), crossValidation);
|
|
48
|
-
}
|
|
31
|
+
/**
|
|
32
|
+
* Execute Single K-fold cross-validation with the given classifier on the given data set using the given parameters.
|
|
33
|
+
*
|
|
34
|
+
* @param experiment Experiment to be run.
|
|
35
|
+
* @return A Performance instance
|
|
36
|
+
*/
|
|
37
|
+
execute(experiment) {
|
|
38
|
+
let crossValidation = new KFoldCrossValidation_1.KFoldCrossValidation(experiment.getDataSet().getInstances(), this.K, experiment.getParameter().getSeed());
|
|
39
|
+
return this.runExperiment(experiment.getmodel(), experiment.getParameter(), crossValidation);
|
|
49
40
|
}
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
}
|
|
42
|
+
exports.SingleRunWithK = SingleRunWithK;
|
|
52
43
|
//# sourceMappingURL=SingleRunWithK.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SingleRunWithK.js","sourceRoot":"","sources":["../../source/Experiment/SingleRunWithK.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SingleRunWithK.js","sourceRoot":"","sources":["../../source/Experiment/SingleRunWithK.ts"],"names":[],"mappings":";;;AAEA,wFAAmF;AAGnF,+DAA0D;AAK1D,MAAa,cAAc;IAEN,CAAC,CAAQ;IAE1B;;;;OAIG;IACH,YAAY,CAAS;QACjB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAA;IACd,CAAC;IAED;;;;;;;;;OASG;IACH,aAAa,CAAC,KAAY,EACZ,SAAoB,EACpB,eAA0C;QACpD,IAAI,QAAQ,GAAG,IAAI,2BAAY,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;QACjE,IAAI,OAAO,GAAG,IAAI,2BAAY,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/D,OAAO,KAAK,CAAC,SAAS,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,UAAsB;QAC1B,IAAI,eAAe,GAAG,IAAI,2CAAoB,CAAW,UAAU,CAAC,UAAU,EAAE,CAAC,YAAY,EAAE,EAAE,IAAI,CAAC,CAAC,EACnG,UAAU,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,UAAU,CAAC,YAAY,EAAE,EAAE,eAAe,CAAC,CAAC;IACjG,CAAC;CAEJ;AA3CD,wCA2CC"}
|
|
@@ -1,39 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StratifiedKFoldRun = void 0;
|
|
4
|
+
const KFoldRun_1 = require("./KFoldRun");
|
|
5
|
+
const ExperimentPerformance_1 = require("../Performance/ExperimentPerformance");
|
|
6
|
+
const StratifiedKFoldCrossValidation_1 = require("nlptoolkit-sampling/dist/StratifiedKFoldCrossValidation");
|
|
7
|
+
class StratifiedKFoldRun extends KFoldRun_1.KFoldRun {
|
|
8
|
+
/**
|
|
9
|
+
* Constructor for KFoldRun class. Basically sets K parameter of the K-fold cross-validation.
|
|
10
|
+
* @param K K of the K-fold cross-validation.
|
|
11
|
+
*/
|
|
12
|
+
constructor(K) {
|
|
13
|
+
super(K);
|
|
5
14
|
}
|
|
6
|
-
|
|
7
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Execute Stratified K-fold cross-validation with the given classifier on the given data set using the given parameters.
|
|
17
|
+
*
|
|
18
|
+
* @param experiment Experiment to be run.
|
|
19
|
+
* @return An ExperimentPerformance instance.
|
|
20
|
+
*/
|
|
21
|
+
execute(experiment) {
|
|
22
|
+
let result = new ExperimentPerformance_1.ExperimentPerformance();
|
|
23
|
+
let crossValidation = new StratifiedKFoldCrossValidation_1.StratifiedKFoldCrossValidation(experiment.getDataSet().getClassInstances(), this.K, experiment.getParameter().getSeed());
|
|
24
|
+
this.runExperiment(experiment.getmodel(), experiment.getParameter(), result, crossValidation);
|
|
25
|
+
return result;
|
|
8
26
|
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.StratifiedKFoldRun = void 0;
|
|
13
|
-
const KFoldRun_1 = require("./KFoldRun");
|
|
14
|
-
const ExperimentPerformance_1 = require("../Performance/ExperimentPerformance");
|
|
15
|
-
const StratifiedKFoldCrossValidation_1 = require("nlptoolkit-sampling/dist/StratifiedKFoldCrossValidation");
|
|
16
|
-
class StratifiedKFoldRun extends KFoldRun_1.KFoldRun {
|
|
17
|
-
/**
|
|
18
|
-
* Constructor for KFoldRun class. Basically sets K parameter of the K-fold cross-validation.
|
|
19
|
-
* @param K K of the K-fold cross-validation.
|
|
20
|
-
*/
|
|
21
|
-
constructor(K) {
|
|
22
|
-
super(K);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Execute Stratified K-fold cross-validation with the given classifier on the given data set using the given parameters.
|
|
26
|
-
*
|
|
27
|
-
* @param experiment Experiment to be run.
|
|
28
|
-
* @return An ExperimentPerformance instance.
|
|
29
|
-
*/
|
|
30
|
-
execute(experiment) {
|
|
31
|
-
let result = new ExperimentPerformance_1.ExperimentPerformance();
|
|
32
|
-
let crossValidation = new StratifiedKFoldCrossValidation_1.StratifiedKFoldCrossValidation(experiment.getDataSet().getClassInstances(), this.K, experiment.getParameter().getSeed());
|
|
33
|
-
this.runExperiment(experiment.getmodel(), experiment.getParameter(), result, crossValidation);
|
|
34
|
-
return result;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.StratifiedKFoldRun = StratifiedKFoldRun;
|
|
38
|
-
});
|
|
27
|
+
}
|
|
28
|
+
exports.StratifiedKFoldRun = StratifiedKFoldRun;
|
|
39
29
|
//# sourceMappingURL=StratifiedKFoldRun.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StratifiedKFoldRun.js","sourceRoot":"","sources":["../../source/Experiment/StratifiedKFoldRun.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StratifiedKFoldRun.js","sourceRoot":"","sources":["../../source/Experiment/StratifiedKFoldRun.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AAEpC,gFAA2E;AAC3E,4GAAuG;AAGvG,MAAa,kBAAmB,SAAQ,mBAAQ;IAE5C;;;OAGG;IACH,YAAY,CAAS;QACjB,KAAK,CAAC,CAAC,CAAC,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,UAAsB;QAC1B,IAAI,MAAM,GAAG,IAAI,6CAAqB,EAAE,CAAC;QACzC,IAAI,eAAe,GAAG,IAAI,+DAA8B,CAAW,UAAU,CAAC,UAAU,EAAE,CAAC,iBAAiB,EAAE,EAAE,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7J,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,UAAU,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;QAC9F,OAAO,MAAM,CAAC;IAClB,CAAC;CAEJ;AAvBD,gDAuBC"}
|
|
@@ -1,43 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StratifiedKFoldRunSeparateTest = void 0;
|
|
4
|
+
const KFoldRunSeparateTest_1 = require("./KFoldRunSeparateTest");
|
|
5
|
+
const ExperimentPerformance_1 = require("../Performance/ExperimentPerformance");
|
|
6
|
+
const Partition_1 = require("../InstanceList/Partition");
|
|
7
|
+
const StratifiedKFoldCrossValidation_1 = require("nlptoolkit-sampling/dist/StratifiedKFoldCrossValidation");
|
|
8
|
+
class StratifiedKFoldRunSeparateTest extends KFoldRunSeparateTest_1.KFoldRunSeparateTest {
|
|
9
|
+
/**
|
|
10
|
+
* Constructor for StratifiedKFoldRunSeparateTest class. Basically sets K parameter of the K-fold cross-validation.
|
|
11
|
+
*
|
|
12
|
+
* @param K K of the K-fold cross-validation.
|
|
13
|
+
*/
|
|
14
|
+
constructor(K) {
|
|
15
|
+
super(K);
|
|
5
16
|
}
|
|
6
|
-
|
|
7
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Execute Stratified K-fold cross-validation with the given classifier on the given data set using the given parameters.
|
|
19
|
+
*
|
|
20
|
+
* @param experiment Experiment to be run.
|
|
21
|
+
* @return An ExperimentPerformance instance.
|
|
22
|
+
*/
|
|
23
|
+
execute(experiment) {
|
|
24
|
+
let result = new ExperimentPerformance_1.ExperimentPerformance();
|
|
25
|
+
let instanceList = experiment.getDataSet().getInstanceList();
|
|
26
|
+
let partition = new Partition_1.Partition(instanceList, 0.25, true);
|
|
27
|
+
let crossValidation = new StratifiedKFoldCrossValidation_1.StratifiedKFoldCrossValidation(new Partition_1.Partition(partition.get(1)).getLists(), this.K, experiment.getParameter().getSeed());
|
|
28
|
+
this.runExperiment(experiment.getmodel(), experiment.getParameter(), result, crossValidation, partition.get(0));
|
|
29
|
+
return result;
|
|
8
30
|
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.StratifiedKFoldRunSeparateTest = void 0;
|
|
13
|
-
const KFoldRunSeparateTest_1 = require("./KFoldRunSeparateTest");
|
|
14
|
-
const ExperimentPerformance_1 = require("../Performance/ExperimentPerformance");
|
|
15
|
-
const Partition_1 = require("../InstanceList/Partition");
|
|
16
|
-
const StratifiedKFoldCrossValidation_1 = require("nlptoolkit-sampling/dist/StratifiedKFoldCrossValidation");
|
|
17
|
-
class StratifiedKFoldRunSeparateTest extends KFoldRunSeparateTest_1.KFoldRunSeparateTest {
|
|
18
|
-
/**
|
|
19
|
-
* Constructor for StratifiedKFoldRunSeparateTest class. Basically sets K parameter of the K-fold cross-validation.
|
|
20
|
-
*
|
|
21
|
-
* @param K K of the K-fold cross-validation.
|
|
22
|
-
*/
|
|
23
|
-
constructor(K) {
|
|
24
|
-
super(K);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Execute Stratified K-fold cross-validation with the given classifier on the given data set using the given parameters.
|
|
28
|
-
*
|
|
29
|
-
* @param experiment Experiment to be run.
|
|
30
|
-
* @return An ExperimentPerformance instance.
|
|
31
|
-
*/
|
|
32
|
-
execute(experiment) {
|
|
33
|
-
let result = new ExperimentPerformance_1.ExperimentPerformance();
|
|
34
|
-
let instanceList = experiment.getDataSet().getInstanceList();
|
|
35
|
-
let partition = new Partition_1.Partition(instanceList, 0.25, true);
|
|
36
|
-
let crossValidation = new StratifiedKFoldCrossValidation_1.StratifiedKFoldCrossValidation(new Partition_1.Partition(partition.get(1)).getLists(), this.K, experiment.getParameter().getSeed());
|
|
37
|
-
this.runExperiment(experiment.getmodel(), experiment.getParameter(), result, crossValidation, partition.get(0));
|
|
38
|
-
return result;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.StratifiedKFoldRunSeparateTest = StratifiedKFoldRunSeparateTest;
|
|
42
|
-
});
|
|
31
|
+
}
|
|
32
|
+
exports.StratifiedKFoldRunSeparateTest = StratifiedKFoldRunSeparateTest;
|
|
43
33
|
//# sourceMappingURL=StratifiedKFoldRunSeparateTest.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StratifiedKFoldRunSeparateTest.js","sourceRoot":"","sources":["../../source/Experiment/StratifiedKFoldRunSeparateTest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StratifiedKFoldRunSeparateTest.js","sourceRoot":"","sources":["../../source/Experiment/StratifiedKFoldRunSeparateTest.ts"],"names":[],"mappings":";;;AAAA,iEAA4D;AAE5D,gFAA2E;AAC3E,yDAAoD;AACpD,4GAAuG;AAGvG,MAAa,8BAA+B,SAAQ,2CAAoB;IAEpE;;;;OAIG;IACH,YAAY,CAAS;QACjB,KAAK,CAAC,CAAC,CAAC,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,UAAsB;QAC1B,IAAI,MAAM,GAAG,IAAI,6CAAqB,EAAE,CAAC;QACzC,IAAI,YAAY,GAAG,UAAU,CAAC,UAAU,EAAE,CAAC,eAAe,EAAE,CAAC;QAC7D,IAAI,SAAS,GAAG,IAAI,qBAAS,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACxD,IAAI,eAAe,GAAG,IAAI,+DAA8B,CAAW,IAAI,qBAAS,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5J,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,UAAU,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAChH,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAzBD,wEAyBC"}
|
|
@@ -1,43 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StratifiedMxKFoldRun = void 0;
|
|
4
|
+
const MxKFoldRun_1 = require("./MxKFoldRun");
|
|
5
|
+
const ExperimentPerformance_1 = require("../Performance/ExperimentPerformance");
|
|
6
|
+
const StratifiedKFoldCrossValidation_1 = require("nlptoolkit-sampling/dist/StratifiedKFoldCrossValidation");
|
|
7
|
+
class StratifiedMxKFoldRun extends MxKFoldRun_1.MxKFoldRun {
|
|
8
|
+
/**
|
|
9
|
+
* Constructor for StratifiedMxKFoldRun class. Basically sets K parameter of the K-fold cross-validation and M for the number of times.
|
|
10
|
+
*
|
|
11
|
+
* @param M number of cross-validation times.
|
|
12
|
+
* @param K K of the K-fold cross-validation.
|
|
13
|
+
*/
|
|
14
|
+
constructor(M, K) {
|
|
15
|
+
super(M, K);
|
|
5
16
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Constructor for StratifiedMxKFoldRun class. Basically sets K parameter of the K-fold cross-validation and M for the number of times.
|
|
19
|
-
*
|
|
20
|
-
* @param M number of cross-validation times.
|
|
21
|
-
* @param K K of the K-fold cross-validation.
|
|
22
|
-
*/
|
|
23
|
-
constructor(M, K) {
|
|
24
|
-
super(M, K);
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Execute the Stratified MxK-fold cross-validation with the given classifier on the given data set using the given parameters.
|
|
28
|
-
*
|
|
29
|
-
* @param experiment Experiment to be run.
|
|
30
|
-
* @return An ExperimentPerformance instance.
|
|
31
|
-
*/
|
|
32
|
-
execute(experiment) {
|
|
33
|
-
let result = new ExperimentPerformance_1.ExperimentPerformance();
|
|
34
|
-
for (let j = 0; j < this.M; j++) {
|
|
35
|
-
let crossValidation = new StratifiedKFoldCrossValidation_1.StratifiedKFoldCrossValidation(experiment.getDataSet().getClassInstances(), this.K, experiment.getParameter().getSeed());
|
|
36
|
-
this.runExperiment(experiment.getmodel(), experiment.getParameter(), result, crossValidation);
|
|
37
|
-
}
|
|
38
|
-
return result;
|
|
17
|
+
/**
|
|
18
|
+
* Execute the Stratified MxK-fold cross-validation with the given classifier on the given data set using the given parameters.
|
|
19
|
+
*
|
|
20
|
+
* @param experiment Experiment to be run.
|
|
21
|
+
* @return An ExperimentPerformance instance.
|
|
22
|
+
*/
|
|
23
|
+
execute(experiment) {
|
|
24
|
+
let result = new ExperimentPerformance_1.ExperimentPerformance();
|
|
25
|
+
for (let j = 0; j < this.M; j++) {
|
|
26
|
+
let crossValidation = new StratifiedKFoldCrossValidation_1.StratifiedKFoldCrossValidation(experiment.getDataSet().getClassInstances(), this.K, experiment.getParameter().getSeed());
|
|
27
|
+
this.runExperiment(experiment.getmodel(), experiment.getParameter(), result, crossValidation);
|
|
39
28
|
}
|
|
29
|
+
return result;
|
|
40
30
|
}
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
}
|
|
32
|
+
exports.StratifiedMxKFoldRun = StratifiedMxKFoldRun;
|
|
43
33
|
//# sourceMappingURL=StratifiedMxKFoldRun.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StratifiedMxKFoldRun.js","sourceRoot":"","sources":["../../source/Experiment/StratifiedMxKFoldRun.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StratifiedMxKFoldRun.js","sourceRoot":"","sources":["../../source/Experiment/StratifiedMxKFoldRun.ts"],"names":[],"mappings":";;;AAAA,6CAAwC;AAExC,gFAA2E;AAC3E,4GAAuG;AAGvG,MAAa,oBAAqB,SAAQ,uBAAU;IAEhD;;;;;OAKG;IACH,YAAY,CAAS,EAAE,CAAS;QAC5B,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACH,OAAO,CAAC,UAAsB;QAC1B,IAAI,MAAM,GAAG,IAAI,6CAAqB,EAAE,CAAC;QACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9B,IAAI,eAAe,GAAG,IAAI,+DAA8B,CAAW,UAAU,CAAC,UAAU,EAAE,CAAC,iBAAiB,EAAE,EAC1G,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,YAAY,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;YACjD,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,UAAU,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;QAClG,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA3BD,oDA2BC"}
|
|
@@ -1,47 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StratifiedMxKFoldRunSeparateTest = void 0;
|
|
4
|
+
const StratifiedKFoldRunSeparateTest_1 = require("./StratifiedKFoldRunSeparateTest");
|
|
5
|
+
const ExperimentPerformance_1 = require("../Performance/ExperimentPerformance");
|
|
6
|
+
const Partition_1 = require("../InstanceList/Partition");
|
|
7
|
+
const StratifiedKFoldCrossValidation_1 = require("nlptoolkit-sampling/dist/StratifiedKFoldCrossValidation");
|
|
8
|
+
class StratifiedMxKFoldRunSeparateTest extends StratifiedKFoldRunSeparateTest_1.StratifiedKFoldRunSeparateTest {
|
|
9
|
+
M;
|
|
10
|
+
/**
|
|
11
|
+
* Constructor for StratifiedMxKFoldRunSeparateTest class. Basically sets K parameter of the K-fold cross-validation and M for the number of times.
|
|
12
|
+
*
|
|
13
|
+
* @param M number of cross-validation times.
|
|
14
|
+
* @param K K of the K-fold cross-validation.
|
|
15
|
+
*/
|
|
16
|
+
constructor(M, K) {
|
|
17
|
+
super(K);
|
|
18
|
+
this.M = M;
|
|
5
19
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* Constructor for StratifiedMxKFoldRunSeparateTest class. Basically sets K parameter of the K-fold cross-validation and M for the number of times.
|
|
20
|
-
*
|
|
21
|
-
* @param M number of cross-validation times.
|
|
22
|
-
* @param K K of the K-fold cross-validation.
|
|
23
|
-
*/
|
|
24
|
-
constructor(M, K) {
|
|
25
|
-
super(K);
|
|
26
|
-
this.M = M;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Execute the Stratified MxK-fold cross-validation with the given classifier on the given data set using the given parameters.
|
|
30
|
-
*
|
|
31
|
-
* @param experiment Experiment to be run.
|
|
32
|
-
* @return An ExperimentPerformance instance.
|
|
33
|
-
*/
|
|
34
|
-
execute(experiment) {
|
|
35
|
-
let result = new ExperimentPerformance_1.ExperimentPerformance();
|
|
36
|
-
let instanceList = experiment.getDataSet().getInstanceList();
|
|
37
|
-
let partition = new Partition_1.Partition(instanceList, 0.25, true);
|
|
38
|
-
for (let j = 0; j < this.M; j++) {
|
|
39
|
-
let crossValidation = new StratifiedKFoldCrossValidation_1.StratifiedKFoldCrossValidation(new Partition_1.Partition(partition.get(1)).getLists(), this.K, experiment.getParameter().getSeed());
|
|
40
|
-
this.runExperiment(experiment.getmodel(), experiment.getParameter(), result, crossValidation, partition.get(0));
|
|
41
|
-
}
|
|
42
|
-
return result;
|
|
20
|
+
/**
|
|
21
|
+
* Execute the Stratified MxK-fold cross-validation with the given classifier on the given data set using the given parameters.
|
|
22
|
+
*
|
|
23
|
+
* @param experiment Experiment to be run.
|
|
24
|
+
* @return An ExperimentPerformance instance.
|
|
25
|
+
*/
|
|
26
|
+
execute(experiment) {
|
|
27
|
+
let result = new ExperimentPerformance_1.ExperimentPerformance();
|
|
28
|
+
let instanceList = experiment.getDataSet().getInstanceList();
|
|
29
|
+
let partition = new Partition_1.Partition(instanceList, 0.25, true);
|
|
30
|
+
for (let j = 0; j < this.M; j++) {
|
|
31
|
+
let crossValidation = new StratifiedKFoldCrossValidation_1.StratifiedKFoldCrossValidation(new Partition_1.Partition(partition.get(1)).getLists(), this.K, experiment.getParameter().getSeed());
|
|
32
|
+
this.runExperiment(experiment.getmodel(), experiment.getParameter(), result, crossValidation, partition.get(0));
|
|
43
33
|
}
|
|
34
|
+
return result;
|
|
44
35
|
}
|
|
45
|
-
|
|
46
|
-
|
|
36
|
+
}
|
|
37
|
+
exports.StratifiedMxKFoldRunSeparateTest = StratifiedMxKFoldRunSeparateTest;
|
|
47
38
|
//# sourceMappingURL=StratifiedMxKFoldRunSeparateTest.js.map
|