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,84 +1,75 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QdaModel = void 0;
|
|
4
|
+
const LdaModel_1 = require("./LdaModel");
|
|
5
|
+
const Vector_1 = require("nlptoolkit-math/dist/Vector");
|
|
6
|
+
const FileContents_1 = require("nlptoolkit-util/dist/FileContents");
|
|
7
|
+
const Partition_1 = require("../../InstanceList/Partition");
|
|
8
|
+
class QdaModel extends LdaModel_1.LdaModel {
|
|
9
|
+
W;
|
|
10
|
+
constructor2(fileName) {
|
|
11
|
+
let input = new FileContents_1.FileContents(fileName);
|
|
12
|
+
let size = this.loadPriorDistribution(input);
|
|
13
|
+
this.loadWandW0(input, size);
|
|
14
|
+
this.W = new Map();
|
|
15
|
+
for (let i = 0; i < size; i++) {
|
|
16
|
+
let c = input.readLine();
|
|
17
|
+
let matrix = this.loadMatrix(input);
|
|
18
|
+
this.W.set(c, matrix);
|
|
19
|
+
}
|
|
5
20
|
}
|
|
6
|
-
|
|
7
|
-
|
|
21
|
+
/**
|
|
22
|
+
* The calculateMetric method takes an {@link Instance} and a String as inputs. It multiplies Matrix Wi with Vector xi
|
|
23
|
+
* then calculates the dot product of it with xi. Then, again it finds the dot product of wi and xi and returns the summation with w0i.
|
|
24
|
+
*
|
|
25
|
+
* @param instance {@link Instance} input.
|
|
26
|
+
* @param Ci String input.
|
|
27
|
+
* @return The result of Wi.multiplyWithVectorFromLeft(xi).dotProduct(xi) + wi.dotProduct(xi) + w0i.
|
|
28
|
+
*/
|
|
29
|
+
calculateMetric(instance, Ci) {
|
|
30
|
+
let xi = instance.toVector();
|
|
31
|
+
let Wi = this.W.get(Ci);
|
|
32
|
+
let wi = this.w.get(Ci);
|
|
33
|
+
let w0i = this.w0.get(Ci);
|
|
34
|
+
return Wi.multiplyWithVectorFromLeft(xi).dotProduct(xi) + wi.dotProduct(xi) + w0i;
|
|
8
35
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
calculateMetric(instance, Ci) {
|
|
38
|
-
let xi = instance.toVector();
|
|
39
|
-
let Wi = this.W.get(Ci);
|
|
40
|
-
let wi = this.w.get(Ci);
|
|
41
|
-
let w0i = this.w0.get(Ci);
|
|
42
|
-
return Wi.multiplyWithVectorFromLeft(xi).dotProduct(xi) + wi.dotProduct(xi) + w0i;
|
|
43
|
-
}
|
|
44
|
-
saveTxt(fileName) {
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Training algorithm for the quadratic discriminant analysis classifier (Introduction to Machine Learning, Alpaydin, 2015).
|
|
48
|
-
*
|
|
49
|
-
* @param trainSet Training data given to the algorithm.
|
|
50
|
-
* @param parameters -
|
|
51
|
-
*/
|
|
52
|
-
train(trainSet, parameters) {
|
|
53
|
-
let determinant = 0;
|
|
54
|
-
this.w0 = new Map();
|
|
55
|
-
this.w = new Map();
|
|
56
|
-
this.W = new Map();
|
|
57
|
-
let classLists = new Partition_1.Partition(trainSet);
|
|
58
|
-
this.priorDistribution = trainSet.classDistribution();
|
|
59
|
-
for (let i = 0; i < classLists.size(); i++) {
|
|
60
|
-
let Ci = classLists.get(i).getClassLabel();
|
|
61
|
-
let averageVector = new Vector_1.Vector(classLists.get(i).continuousAttributeAverage());
|
|
62
|
-
let classCovariance = classLists.get(i).covariance(averageVector);
|
|
63
|
-
determinant = classCovariance.determinant();
|
|
64
|
-
classCovariance.inverse();
|
|
65
|
-
let Wi = classCovariance.clone();
|
|
66
|
-
Wi.multiplyWithConstant(-0.5);
|
|
67
|
-
this.W.set(Ci, Wi);
|
|
68
|
-
let wi = classCovariance.multiplyWithVectorFromLeft(averageVector);
|
|
69
|
-
this.w.set(Ci, wi);
|
|
70
|
-
let w0i = -0.5 * (wi.dotProduct(averageVector) + Math.log(determinant)) + Math.log(this.priorDistribution.getProbability(Ci));
|
|
71
|
-
this.w0.set(Ci, w0i);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Loads the Qda model from an input file.
|
|
76
|
-
* @param fileName File name of the Qda model.
|
|
77
|
-
*/
|
|
78
|
-
loadModel(fileName) {
|
|
79
|
-
this.constructor2(fileName);
|
|
36
|
+
saveTxt(fileName) {
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Training algorithm for the quadratic discriminant analysis classifier (Introduction to Machine Learning, Alpaydin, 2015).
|
|
40
|
+
*
|
|
41
|
+
* @param trainSet Training data given to the algorithm.
|
|
42
|
+
* @param parameters -
|
|
43
|
+
*/
|
|
44
|
+
train(trainSet, parameters) {
|
|
45
|
+
let determinant = 0;
|
|
46
|
+
this.w0 = new Map();
|
|
47
|
+
this.w = new Map();
|
|
48
|
+
this.W = new Map();
|
|
49
|
+
let classLists = new Partition_1.Partition(trainSet);
|
|
50
|
+
this.priorDistribution = trainSet.classDistribution();
|
|
51
|
+
for (let i = 0; i < classLists.size(); i++) {
|
|
52
|
+
let Ci = classLists.get(i).getClassLabel();
|
|
53
|
+
let averageVector = new Vector_1.Vector(classLists.get(i).continuousAttributeAverage());
|
|
54
|
+
let classCovariance = classLists.get(i).covariance(averageVector);
|
|
55
|
+
determinant = classCovariance.determinant();
|
|
56
|
+
classCovariance.inverse();
|
|
57
|
+
let Wi = classCovariance.clone();
|
|
58
|
+
Wi.multiplyWithConstant(-0.5);
|
|
59
|
+
this.W.set(Ci, Wi);
|
|
60
|
+
let wi = classCovariance.multiplyWithVectorFromLeft(averageVector);
|
|
61
|
+
this.w.set(Ci, wi);
|
|
62
|
+
let w0i = -0.5 * (wi.dotProduct(averageVector) + Math.log(determinant)) + Math.log(this.priorDistribution.getProbability(Ci));
|
|
63
|
+
this.w0.set(Ci, w0i);
|
|
80
64
|
}
|
|
81
65
|
}
|
|
82
|
-
|
|
83
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Loads the Qda model from an input file.
|
|
68
|
+
* @param fileName File name of the Qda model.
|
|
69
|
+
*/
|
|
70
|
+
loadModel(fileName) {
|
|
71
|
+
this.constructor2(fileName);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.QdaModel = QdaModel;
|
|
84
75
|
//# sourceMappingURL=QdaModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QdaModel.js","sourceRoot":"","sources":["../../../source/Model/Parametric/QdaModel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QdaModel.js","sourceRoot":"","sources":["../../../source/Model/Parametric/QdaModel.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AAEpC,wDAAmD;AAEnD,oEAA+D;AAG/D,4DAAuD;AAGvD,MAAa,QAAS,SAAQ,mBAAQ;IAE1B,CAAC,CAAqB;IAE9B,YAAY,CAAC,QAAgB;QACzB,IAAI,KAAK,GAAG,IAAI,2BAAY,CAAC,QAAQ,CAAC,CAAA;QACtC,IAAI,IAAI,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAA;QAC5C,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QAC5B,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,EAAkB,CAAA;QAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAC,CAAC;YAC3B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
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RandomModel = void 0;
|
|
4
|
+
const Model_1 = require("./Model");
|
|
5
|
+
const CompositeInstance_1 = require("../Instance/CompositeInstance");
|
|
6
|
+
const Random_1 = require("nlptoolkit-util/dist/Random");
|
|
7
|
+
const FileContents_1 = require("nlptoolkit-util/dist/FileContents");
|
|
8
|
+
class RandomModel extends Model_1.Model {
|
|
9
|
+
classLabels;
|
|
10
|
+
random;
|
|
11
|
+
seed;
|
|
12
|
+
/**
|
|
13
|
+
* A constructor that sets the class labels.
|
|
14
|
+
*
|
|
15
|
+
* @param classLabels An ArrayList of class labels.
|
|
16
|
+
* @param seed Seed of the random function.
|
|
17
|
+
*/
|
|
18
|
+
constructor1(classLabels, seed) {
|
|
19
|
+
this.classLabels = classLabels;
|
|
20
|
+
this.random = new Random_1.Random(seed);
|
|
21
|
+
this.seed = seed;
|
|
5
22
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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());
|
|
41
|
-
}
|
|
23
|
+
/**
|
|
24
|
+
* Loads a random classifier model from an input model file.
|
|
25
|
+
* @param fileName Model file name.
|
|
26
|
+
*/
|
|
27
|
+
constructor2(fileName) {
|
|
28
|
+
let input = new FileContents_1.FileContents(fileName);
|
|
29
|
+
this.seed = parseInt(input.readLine());
|
|
30
|
+
this.random = new Random_1.Random(this.seed);
|
|
31
|
+
let size = parseInt(input.readLine());
|
|
32
|
+
this.classLabels = new Array();
|
|
33
|
+
for (let i = 0; i < size; i++) {
|
|
34
|
+
this.classLabels.push(input.readLine());
|
|
42
35
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
else {
|
|
58
|
-
let size = this.classLabels.length;
|
|
59
|
-
let index = this.random.nextInt(size);
|
|
60
|
-
return this.classLabels[index];
|
|
61
|
-
}
|
|
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
|
-
*/
|
|
68
|
-
predictProbability(instance) {
|
|
69
|
-
let result = new Map();
|
|
70
|
-
for (let classLabel of this.classLabels) {
|
|
71
|
-
result.set(classLabel, 1.0 / this.classLabels.length);
|
|
72
|
-
}
|
|
73
|
-
return result;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The predict method gets an Instance as an input and retrieves the possible class labels as an ArrayList. Then selects a
|
|
39
|
+
* random number as an index and returns the class label at this selected index.
|
|
40
|
+
*
|
|
41
|
+
* @param instance {@link Instance} to make prediction.
|
|
42
|
+
* @return The class label at the randomly selected index.
|
|
43
|
+
*/
|
|
44
|
+
predict(instance) {
|
|
45
|
+
if ((instance instanceof CompositeInstance_1.CompositeInstance)) {
|
|
46
|
+
let possibleClassLabels = instance.getPossibleClassLabels();
|
|
47
|
+
let size = possibleClassLabels.length;
|
|
48
|
+
let index = this.random.nextInt(size);
|
|
49
|
+
return possibleClassLabels[index];
|
|
74
50
|
}
|
|
75
|
-
|
|
51
|
+
else {
|
|
52
|
+
let size = this.classLabels.length;
|
|
53
|
+
let index = this.random.nextInt(size);
|
|
54
|
+
return this.classLabels[index];
|
|
76
55
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
this.constructor1(result, parameters.getSeed());
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Calculates the posterior probability distribution for the given instance according to random model.
|
|
59
|
+
* @param instance Instance for which posterior probability distribution is calculated.
|
|
60
|
+
* @return Posterior probability distribution for the given instance.
|
|
61
|
+
*/
|
|
62
|
+
predictProbability(instance) {
|
|
63
|
+
let result = new Map();
|
|
64
|
+
for (let classLabel of this.classLabels) {
|
|
65
|
+
result.set(classLabel, 1.0 / this.classLabels.length);
|
|
89
66
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
saveTxt(fileName) {
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Training algorithm for random classifier.
|
|
73
|
+
*
|
|
74
|
+
* @param trainSet Training data given to the algorithm.
|
|
75
|
+
* @param parameters -
|
|
76
|
+
*/
|
|
77
|
+
train(trainSet, parameters) {
|
|
78
|
+
let result = new Array();
|
|
79
|
+
for (let s of trainSet.classDistribution().keys()) {
|
|
80
|
+
result.push(s);
|
|
96
81
|
}
|
|
82
|
+
this.constructor1(result, parameters.getSeed());
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Loads the random classifier model from an input file.
|
|
86
|
+
* @param fileName File name of the random classifier model.
|
|
87
|
+
*/
|
|
88
|
+
loadModel(fileName) {
|
|
89
|
+
this.constructor2(fileName);
|
|
97
90
|
}
|
|
98
|
-
|
|
99
|
-
|
|
91
|
+
}
|
|
92
|
+
exports.RandomModel = RandomModel;
|
|
100
93
|
//# sourceMappingURL=RandomModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RandomModel.js","sourceRoot":"","sources":["../../source/Model/RandomModel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RandomModel.js","sourceRoot":"","sources":["../../source/Model/RandomModel.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAE9B,qEAAgE;AAChE,wDAAmD;AACnD,oEAA+D;AAI/D,MAAa,WAAY,SAAQ,aAAK;IAE1B,WAAW,CAAe;IAC1B,MAAM,CAAQ;IACd,IAAI,CAAQ;IAEpB;;;;;OAKG;IACH,YAAY,CAAC,WAA0B,EAAE,IAAY;QACjD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,CAAA;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IACpB,CAAC;IAED;;;OAGG;IACH,YAAY,CAAC,QAAgB;QACzB,IAAI,KAAK,GAAG,IAAI,2BAAY,CAAC,QAAQ,CAAC,CAAA;QACtC,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAA;QACtC,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACnC,IAAI,IAAI,GAAG,QAAQ,CAAC,K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E,UAAqB;QAC/C,IAAI,MAAM,GAAG,IAAI,KAAK,EAAU,CAAA;QAChC,KAAK,IAAI,CAAC,IAAI,QAAQ,CAAC,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAC,CAAC;YAC/C,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAClB,CAAC;QACD,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACH,SAAS,CAAC,QAAgB;QACtB,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAA;IAC/B,CAAC;CAEJ;AA3FD,kCA2FC"}
|
|
@@ -1,35 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* @param data {@link InstanceList} to test.
|
|
20
|
-
* @return Accuracy value as {@link ClassificationPerformance}.
|
|
21
|
-
*/
|
|
22
|
-
testClassifier(data) {
|
|
23
|
-
let total = data.size();
|
|
24
|
-
let count = 0;
|
|
25
|
-
for (let i = 0; i < data.size(); i++) {
|
|
26
|
-
if (data.get(i).getClassLabel().toLowerCase() == this.predict(data.get(i)).toLowerCase()) {
|
|
27
|
-
count++;
|
|
28
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ValidatedModel = void 0;
|
|
4
|
+
const Model_1 = require("./Model");
|
|
5
|
+
const ClassificationPerformance_1 = require("../Performance/ClassificationPerformance");
|
|
6
|
+
class ValidatedModel extends Model_1.Model {
|
|
7
|
+
/**
|
|
8
|
+
* The testClassifier method takes an {@link InstanceList} as an input and returns an accuracy value as {@link ClassificationPerformance}.
|
|
9
|
+
*
|
|
10
|
+
* @param data {@link InstanceList} to test.
|
|
11
|
+
* @return Accuracy value as {@link ClassificationPerformance}.
|
|
12
|
+
*/
|
|
13
|
+
testClassifier(data) {
|
|
14
|
+
let total = data.size();
|
|
15
|
+
let count = 0;
|
|
16
|
+
for (let i = 0; i < data.size(); i++) {
|
|
17
|
+
if (data.get(i).getClassLabel().toLowerCase() == this.predict(data.get(i)).toLowerCase()) {
|
|
18
|
+
count++;
|
|
29
19
|
}
|
|
30
|
-
return new ClassificationPerformance_1.ClassificationPerformance(count / total);
|
|
31
20
|
}
|
|
21
|
+
return new ClassificationPerformance_1.ClassificationPerformance(count / total);
|
|
32
22
|
}
|
|
33
|
-
|
|
34
|
-
|
|
23
|
+
}
|
|
24
|
+
exports.ValidatedModel = ValidatedModel;
|
|
35
25
|
//# sourceMappingURL=ValidatedModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidatedModel.js","sourceRoot":"","sources":["../../source/Model/ValidatedModel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ValidatedModel.js","sourceRoot":"","sources":["../../source/Model/ValidatedModel.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAE9B,wFAAmF;AAEnF,MAAsB,cAAe,SAAQ,aAAK;IAE9C;;;;;OAKG;IACH,cAAc,CAAC,IAAkB;QAC7B,IAAI,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QACxB,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;YACnC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,WAAW,EAAE,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC;gBACvF,KAAK,EAAE,CAAC;YACZ,CAAC;QACL,CAAC;QACD,OAAO,IAAI,qDAAyB,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;IACxD,CAAC;CACJ;AAlBD,wCAkBC"}
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})(
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.ActivationFunction = void 0;
|
|
13
|
-
var ActivationFunction;
|
|
14
|
-
(function (ActivationFunction) {
|
|
15
|
-
ActivationFunction[ActivationFunction["SIGMOID"] = 0] = "SIGMOID";
|
|
16
|
-
ActivationFunction[ActivationFunction["TANH"] = 1] = "TANH";
|
|
17
|
-
ActivationFunction[ActivationFunction["RELU"] = 2] = "RELU";
|
|
18
|
-
})(ActivationFunction = exports.ActivationFunction || (exports.ActivationFunction = {}));
|
|
19
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActivationFunction = void 0;
|
|
4
|
+
var ActivationFunction;
|
|
5
|
+
(function (ActivationFunction) {
|
|
6
|
+
ActivationFunction[ActivationFunction["SIGMOID"] = 0] = "SIGMOID";
|
|
7
|
+
ActivationFunction[ActivationFunction["TANH"] = 1] = "TANH";
|
|
8
|
+
ActivationFunction[ActivationFunction["RELU"] = 2] = "RELU";
|
|
9
|
+
})(ActivationFunction || (exports.ActivationFunction = ActivationFunction = {}));
|
|
20
10
|
//# sourceMappingURL=ActivationFunction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActivationFunction.js","sourceRoot":"","sources":["../../source/Parameter/ActivationFunction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ActivationFunction.js","sourceRoot":"","sources":["../../source/Parameter/ActivationFunction.ts"],"names":[],"mappings":";;;AAAA,IAAY,kBAEX;AAFD,WAAY,kBAAkB;IAC1B,iEAAO,CAAA;IAAE,2DAAI,CAAA;IAAE,2DAAI,CAAA;AACvB,CAAC,EAFW,kBAAkB,kCAAlB,kBAAkB,QAE7B"}
|
|
@@ -1,36 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaggingParameter = void 0;
|
|
4
|
+
const Parameter_1 = require("./Parameter");
|
|
5
|
+
class BaggingParameter extends Parameter_1.Parameter {
|
|
6
|
+
ensembleSize;
|
|
7
|
+
/**
|
|
8
|
+
* Parameters of the bagging trees algorithm.
|
|
9
|
+
*
|
|
10
|
+
* @param seed Seed is used for random number generation.
|
|
11
|
+
* @param ensembleSize The number of trees in the bagged forest.
|
|
12
|
+
*/
|
|
13
|
+
constructor(seed, ensembleSize) {
|
|
14
|
+
super(seed);
|
|
15
|
+
this.ensembleSize = ensembleSize;
|
|
5
16
|
}
|
|
6
|
-
|
|
7
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Accessor for the ensemble size.
|
|
19
|
+
*
|
|
20
|
+
* @return The ensemble size.
|
|
21
|
+
*/
|
|
22
|
+
getEnsembleSize() {
|
|
23
|
+
return this.ensembleSize;
|
|
8
24
|
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.BaggingParameter = void 0;
|
|
13
|
-
const Parameter_1 = require("./Parameter");
|
|
14
|
-
class BaggingParameter extends Parameter_1.Parameter {
|
|
15
|
-
/**
|
|
16
|
-
* Parameters of the bagging trees algorithm.
|
|
17
|
-
*
|
|
18
|
-
* @param seed Seed is used for random number generation.
|
|
19
|
-
* @param ensembleSize The number of trees in the bagged forest.
|
|
20
|
-
*/
|
|
21
|
-
constructor(seed, ensembleSize) {
|
|
22
|
-
super(seed);
|
|
23
|
-
this.ensembleSize = ensembleSize;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Accessor for the ensemble size.
|
|
27
|
-
*
|
|
28
|
-
* @return The ensemble size.
|
|
29
|
-
*/
|
|
30
|
-
getEnsembleSize() {
|
|
31
|
-
return this.ensembleSize;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.BaggingParameter = BaggingParameter;
|
|
35
|
-
});
|
|
25
|
+
}
|
|
26
|
+
exports.BaggingParameter = BaggingParameter;
|
|
36
27
|
//# sourceMappingURL=BaggingParameter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaggingParameter.js","sourceRoot":"","sources":["../../source/Parameter/BaggingParameter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BaggingParameter.js","sourceRoot":"","sources":["../../source/Parameter/BaggingParameter.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAEtC,MAAa,gBAAiB,SAAQ,qBAAS;IAEjC,YAAY,CAAQ;IAE9B;;;;;OAKG;IACH,YAAY,IAAY,EAAE,YAAoB;QAC1C,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;IACpC,CAAC;IAED;;;;OAIG;IACH,eAAe;QACX,OAAO,IAAI,CAAC,YAAY,CAAA;IAC5B,CAAC;CACJ;AAvBD,4CAuBC"}
|
|
@@ -1,46 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.C45Parameter = void 0;
|
|
4
|
+
const Parameter_1 = require("./Parameter");
|
|
5
|
+
class C45Parameter extends Parameter_1.Parameter {
|
|
6
|
+
prune;
|
|
7
|
+
crossValidationRatio;
|
|
8
|
+
/**
|
|
9
|
+
* Parameters of the C4.5 univariate decision tree classifier.
|
|
10
|
+
*
|
|
11
|
+
* @param seed Seed is used for random number generation.
|
|
12
|
+
* @param prune Boolean value for prune.
|
|
13
|
+
* @param crossValidationRatio Double value for cross crossValidationRatio ratio.
|
|
14
|
+
*/
|
|
15
|
+
constructor(seed, prune, crossValidationRatio) {
|
|
16
|
+
super(seed);
|
|
17
|
+
this.prune = prune;
|
|
18
|
+
this.crossValidationRatio = crossValidationRatio;
|
|
5
19
|
}
|
|
6
|
-
|
|
7
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Accessor for the prune.
|
|
22
|
+
*
|
|
23
|
+
* @return Prune.
|
|
24
|
+
*/
|
|
25
|
+
isPrune() {
|
|
26
|
+
return this.prune;
|
|
8
27
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* Parameters of the C4.5 univariate decision tree classifier.
|
|
17
|
-
*
|
|
18
|
-
* @param seed Seed is used for random number generation.
|
|
19
|
-
* @param prune Boolean value for prune.
|
|
20
|
-
* @param crossValidationRatio Double value for cross crossValidationRatio ratio.
|
|
21
|
-
*/
|
|
22
|
-
constructor(seed, prune, crossValidationRatio) {
|
|
23
|
-
super(seed);
|
|
24
|
-
this.prune = prune;
|
|
25
|
-
this.crossValidationRatio = crossValidationRatio;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Accessor for the prune.
|
|
29
|
-
*
|
|
30
|
-
* @return Prune.
|
|
31
|
-
*/
|
|
32
|
-
isPrune() {
|
|
33
|
-
return this.prune;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Accessor for the crossValidationRatio.
|
|
37
|
-
*
|
|
38
|
-
* @return crossValidationRatio.
|
|
39
|
-
*/
|
|
40
|
-
getCrossValidationRatio() {
|
|
41
|
-
return this.crossValidationRatio;
|
|
42
|
-
}
|
|
28
|
+
/**
|
|
29
|
+
* Accessor for the crossValidationRatio.
|
|
30
|
+
*
|
|
31
|
+
* @return crossValidationRatio.
|
|
32
|
+
*/
|
|
33
|
+
getCrossValidationRatio() {
|
|
34
|
+
return this.crossValidationRatio;
|
|
43
35
|
}
|
|
44
|
-
|
|
45
|
-
|
|
36
|
+
}
|
|
37
|
+
exports.C45Parameter = C45Parameter;
|
|
46
38
|
//# sourceMappingURL=C45Parameter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"C45Parameter.js","sourceRoot":"","sources":["../../source/Parameter/C45Parameter.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"C45Parameter.js","sourceRoot":"","sources":["../../source/Parameter/C45Parameter.ts"],"names":[],"mappings":";;;AAAA,2CAAsC;AAEtC,MAAa,YAAa,SAAQ,qBAAS;IAEtB,KAAK,CAAS;IACd,oBAAoB,CAAQ;IAE7C;;;;;;OAMG;IACH,YAAY,IAAY,EAAE,KAAc,EAAE,oBAA4B;QAClE,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;QAClB,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAA;IACpD,CAAC;IAED;;;;OAIG;IACH,OAAO;QACH,OAAO,IAAI,CAAC,KAAK,CAAA;IACrB,CAAC;IAED;;;;OAIG;IACH,uBAAuB;QACnB,OAAO,IAAI,CAAC,oBAAoB,CAAA;IACpC,CAAC;CACJ;AAnCD,oCAmCC"}
|