nlptoolkit-classification 1.0.0
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/README.md +161 -0
- package/datasets/bupa.data +345 -0
- package/datasets/car.data +1728 -0
- package/datasets/chess.data +28056 -0
- package/datasets/dermatology.data +366 -0
- package/datasets/iris.data +150 -0
- package/datasets/nursery.data +12960 -0
- package/datasets/tictactoe.data +958 -0
- package/dist/Attribute/Attribute.d.ts +4 -0
- package/dist/Attribute/Attribute.js +17 -0
- package/dist/Attribute/Attribute.js.map +1 -0
- package/dist/Attribute/AttributeType.d.ts +18 -0
- package/dist/Attribute/AttributeType.js +33 -0
- package/dist/Attribute/AttributeType.js.map +1 -0
- package/dist/Attribute/BinaryAttribute.d.ts +9 -0
- package/dist/Attribute/BinaryAttribute.js +26 -0
- package/dist/Attribute/BinaryAttribute.js.map +1 -0
- package/dist/Attribute/ContinuousAttribute.d.ts +30 -0
- package/dist/Attribute/ContinuousAttribute.js +59 -0
- package/dist/Attribute/ContinuousAttribute.js.map +1 -0
- package/dist/Attribute/DiscreteAttribute.d.ts +24 -0
- package/dist/Attribute/DiscreteAttribute.js +53 -0
- package/dist/Attribute/DiscreteAttribute.js.map +1 -0
- package/dist/Attribute/DiscreteIndexedAttribute.d.ts +27 -0
- package/dist/Attribute/DiscreteIndexedAttribute.js +61 -0
- package/dist/Attribute/DiscreteIndexedAttribute.js.map +1 -0
- package/dist/Classifier/Bagging.d.ts +16 -0
- package/dist/Classifier/Bagging.js +42 -0
- package/dist/Classifier/Bagging.js.map +1 -0
- package/dist/Classifier/C45.d.ts +13 -0
- package/dist/Classifier/C45.js +40 -0
- package/dist/Classifier/C45.js.map +1 -0
- package/dist/Classifier/C45Stump.d.ts +12 -0
- package/dist/Classifier/C45Stump.js +29 -0
- package/dist/Classifier/C45Stump.js.map +1 -0
- package/dist/Classifier/Classifier.d.ts +39 -0
- package/dist/Classifier/Classifier.js +72 -0
- package/dist/Classifier/Classifier.js.map +1 -0
- package/dist/Classifier/DeepNetwork.d.ts +13 -0
- package/dist/Classifier/DeepNetwork.js +31 -0
- package/dist/Classifier/DeepNetwork.js.map +1 -0
- package/dist/Classifier/Dummy.d.ts +13 -0
- package/dist/Classifier/Dummy.js +29 -0
- package/dist/Classifier/Dummy.js.map +1 -0
- package/dist/Classifier/KMeans.d.ts +12 -0
- package/dist/Classifier/KMeans.js +36 -0
- package/dist/Classifier/KMeans.js.map +1 -0
- package/dist/Classifier/Knn.d.ts +13 -0
- package/dist/Classifier/Knn.js +29 -0
- package/dist/Classifier/Knn.js.map +1 -0
- package/dist/Classifier/Lda.d.ts +12 -0
- package/dist/Classifier/Lda.js +52 -0
- package/dist/Classifier/Lda.js.map +1 -0
- package/dist/Classifier/LinearPerceptron.d.ts +14 -0
- package/dist/Classifier/LinearPerceptron.js +32 -0
- package/dist/Classifier/LinearPerceptron.js.map +1 -0
- package/dist/Classifier/MultiLayerPerceptron.d.ts +14 -0
- package/dist/Classifier/MultiLayerPerceptron.js +32 -0
- package/dist/Classifier/MultiLayerPerceptron.js.map +1 -0
- package/dist/Classifier/NaiveBayes.d.ts +25 -0
- package/dist/Classifier/NaiveBayes.js +67 -0
- package/dist/Classifier/NaiveBayes.js.map +1 -0
- package/dist/Classifier/Qda.d.ts +12 -0
- package/dist/Classifier/Qda.js +50 -0
- package/dist/Classifier/Qda.js.map +1 -0
- package/dist/Classifier/RandomClassifier.d.ts +12 -0
- package/dist/Classifier/RandomClassifier.js +32 -0
- package/dist/Classifier/RandomClassifier.js.map +1 -0
- package/dist/Classifier/RandomForest.d.ts +13 -0
- package/dist/Classifier/RandomForest.js +39 -0
- package/dist/Classifier/RandomForest.js.map +1 -0
- package/dist/DataSet/DataDefinition.d.ts +59 -0
- package/dist/DataSet/DataDefinition.js +108 -0
- package/dist/DataSet/DataDefinition.js.map +1 -0
- package/dist/DataSet/DataSet.d.ts +111 -0
- package/dist/DataSet/DataSet.js +286 -0
- package/dist/DataSet/DataSet.js.map +1 -0
- package/dist/DistanceMetric/DistanceMetric.d.ts +4 -0
- package/dist/DistanceMetric/DistanceMetric.js +13 -0
- package/dist/DistanceMetric/DistanceMetric.js.map +1 -0
- package/dist/DistanceMetric/EuclidianDistance.d.ts +13 -0
- package/dist/DistanceMetric/EuclidianDistance.js +43 -0
- package/dist/DistanceMetric/EuclidianDistance.js.map +1 -0
- package/dist/DistanceMetric/MahalanobisDistance.d.ts +20 -0
- package/dist/DistanceMetric/MahalanobisDistance.js +39 -0
- package/dist/DistanceMetric/MahalanobisDistance.js.map +1 -0
- package/dist/Experiment/BootstrapRun.d.ts +19 -0
- package/dist/Experiment/BootstrapRun.js +44 -0
- package/dist/Experiment/BootstrapRun.js.map +1 -0
- package/dist/Experiment/Experiment.d.ts +37 -0
- package/dist/Experiment/Experiment.js +57 -0
- package/dist/Experiment/Experiment.js.map +1 -0
- package/dist/Experiment/KFoldRun.d.ts +19 -0
- package/dist/Experiment/KFoldRun.js +43 -0
- package/dist/Experiment/KFoldRun.js.map +1 -0
- package/dist/Experiment/KFoldRunSeparateTest.d.ts +24 -0
- package/dist/Experiment/KFoldRunSeparateTest.js +51 -0
- package/dist/Experiment/KFoldRunSeparateTest.js.map +1 -0
- package/dist/Experiment/MultipleRun.d.ts +5 -0
- package/dist/Experiment/MultipleRun.js +13 -0
- package/dist/Experiment/MultipleRun.js.map +1 -0
- package/dist/Experiment/MxKFoldRun.d.ts +20 -0
- package/dist/Experiment/MxKFoldRun.js +44 -0
- package/dist/Experiment/MxKFoldRun.js.map +1 -0
- package/dist/Experiment/MxKFoldRunSeparateTest.d.ts +21 -0
- package/dist/Experiment/MxKFoldRunSeparateTest.js +48 -0
- package/dist/Experiment/MxKFoldRunSeparateTest.js.map +1 -0
- package/dist/Experiment/SingleRun.d.ts +5 -0
- package/dist/Experiment/SingleRun.js +13 -0
- package/dist/Experiment/SingleRun.js.map +1 -0
- package/dist/Experiment/SingleRunWithK.d.ts +19 -0
- package/dist/Experiment/SingleRunWithK.js +37 -0
- package/dist/Experiment/SingleRunWithK.js.map +1 -0
- package/dist/Experiment/StratifiedKFoldRun.d.ts +17 -0
- package/dist/Experiment/StratifiedKFoldRun.js +39 -0
- package/dist/Experiment/StratifiedKFoldRun.js.map +1 -0
- package/dist/Experiment/StratifiedKFoldRunSeparateTest.d.ts +18 -0
- package/dist/Experiment/StratifiedKFoldRunSeparateTest.js +43 -0
- package/dist/Experiment/StratifiedKFoldRunSeparateTest.js.map +1 -0
- package/dist/Experiment/StratifiedMxKFoldRun.d.ts +19 -0
- package/dist/Experiment/StratifiedMxKFoldRun.js +43 -0
- package/dist/Experiment/StratifiedMxKFoldRun.js.map +1 -0
- package/dist/Experiment/StratifiedMxKFoldRunSeparateTest.d.ts +20 -0
- package/dist/Experiment/StratifiedMxKFoldRunSeparateTest.js +47 -0
- package/dist/Experiment/StratifiedMxKFoldRunSeparateTest.js.map +1 -0
- package/dist/Experiment/StratifiedSingleRunWithK.d.ts +18 -0
- package/dist/Experiment/StratifiedSingleRunWithK.js +39 -0
- package/dist/Experiment/StratifiedSingleRunWithK.js.map +1 -0
- package/dist/FeatureSelection/BackwardSelection.d.ts +18 -0
- package/dist/FeatureSelection/BackwardSelection.js +39 -0
- package/dist/FeatureSelection/BackwardSelection.js.map +1 -0
- package/dist/FeatureSelection/FeatureSubSet.d.ts +47 -0
- package/dist/FeatureSelection/FeatureSubSet.js +89 -0
- package/dist/FeatureSelection/FeatureSubSet.js.map +1 -0
- package/dist/FeatureSelection/FloatingSelection.d.ts +16 -0
- package/dist/FeatureSelection/FloatingSelection.js +38 -0
- package/dist/FeatureSelection/FloatingSelection.js.map +1 -0
- package/dist/FeatureSelection/ForwardSelection.d.ts +17 -0
- package/dist/FeatureSelection/ForwardSelection.js +38 -0
- package/dist/FeatureSelection/ForwardSelection.js.map +1 -0
- package/dist/FeatureSelection/SubSetSelection.d.ts +37 -0
- package/dist/FeatureSelection/SubSetSelection.js +90 -0
- package/dist/FeatureSelection/SubSetSelection.js.map +1 -0
- package/dist/Filter/DiscreteToContinuous.d.ts +25 -0
- package/dist/Filter/DiscreteToContinuous.js +69 -0
- package/dist/Filter/DiscreteToContinuous.js.map +1 -0
- package/dist/Filter/DiscreteToIndexed.d.ts +21 -0
- package/dist/Filter/DiscreteToIndexed.js +56 -0
- package/dist/Filter/DiscreteToIndexed.js.map +1 -0
- package/dist/Filter/FeatureFilter.d.ts +18 -0
- package/dist/Filter/FeatureFilter.js +36 -0
- package/dist/Filter/FeatureFilter.js.map +1 -0
- package/dist/Filter/LaryFilter.d.ts +27 -0
- package/dist/Filter/LaryFilter.js +62 -0
- package/dist/Filter/LaryFilter.js.map +1 -0
- package/dist/Filter/LaryToBinary.d.ts +23 -0
- package/dist/Filter/LaryToBinary.js +67 -0
- package/dist/Filter/LaryToBinary.js.map +1 -0
- package/dist/Filter/Normalize.d.ts +21 -0
- package/dist/Filter/Normalize.js +47 -0
- package/dist/Filter/Normalize.js.map +1 -0
- package/dist/Filter/Pca.d.ts +44 -0
- package/dist/Filter/Pca.js +109 -0
- package/dist/Filter/Pca.js.map +1 -0
- package/dist/Filter/TrainedFeatureFilter.d.ts +11 -0
- package/dist/Filter/TrainedFeatureFilter.js +26 -0
- package/dist/Filter/TrainedFeatureFilter.js.map +1 -0
- package/dist/Instance/CompositeInstance.d.ts +32 -0
- package/dist/Instance/CompositeInstance.js +61 -0
- package/dist/Instance/CompositeInstance.js.map +1 -0
- package/dist/Instance/Instance.d.ts +89 -0
- package/dist/Instance/Instance.js +170 -0
- package/dist/Instance/Instance.js.map +1 -0
- package/dist/InstanceList/InstanceList.d.ts +188 -0
- package/dist/InstanceList/InstanceList.js +517 -0
- package/dist/InstanceList/InstanceList.js.map +1 -0
- package/dist/InstanceList/InstanceListOfSameClass.d.ts +16 -0
- package/dist/InstanceList/InstanceListOfSameClass.js +35 -0
- package/dist/InstanceList/InstanceListOfSameClass.js.map +1 -0
- package/dist/InstanceList/Partition.d.ts +31 -0
- package/dist/InstanceList/Partition.js +143 -0
- package/dist/InstanceList/Partition.js.map +1 -0
- package/dist/Model/DecisionTree/DecisionCondition.d.ts +34 -0
- package/dist/Model/DecisionTree/DecisionCondition.js +84 -0
- package/dist/Model/DecisionTree/DecisionCondition.js.map +1 -0
- package/dist/Model/DecisionTree/DecisionNode.d.ts +82 -0
- package/dist/Model/DecisionTree/DecisionNode.js +271 -0
- package/dist/Model/DecisionTree/DecisionNode.js.map +1 -0
- package/dist/Model/DecisionTree/DecisionTree.d.ts +37 -0
- package/dist/Model/DecisionTree/DecisionTree.js +75 -0
- package/dist/Model/DecisionTree/DecisionTree.js.map +1 -0
- package/dist/Model/DeepNetworkModel.d.ts +42 -0
- package/dist/Model/DeepNetworkModel.js +163 -0
- package/dist/Model/DeepNetworkModel.js.map +1 -0
- package/dist/Model/DummyModel.d.ts +20 -0
- package/dist/Model/DummyModel.js +46 -0
- package/dist/Model/DummyModel.js.map +1 -0
- package/dist/Model/GaussianModel.d.ts +24 -0
- package/dist/Model/GaussianModel.js +59 -0
- package/dist/Model/GaussianModel.js.map +1 -0
- package/dist/Model/KMeansModel.d.ts +27 -0
- package/dist/Model/KMeansModel.js +48 -0
- package/dist/Model/KMeansModel.js.map +1 -0
- package/dist/Model/KnnInstance.d.ts +14 -0
- package/dist/Model/KnnInstance.js +33 -0
- package/dist/Model/KnnInstance.js.map +1 -0
- package/dist/Model/KnnModel.d.ts +36 -0
- package/dist/Model/KnnModel.js +83 -0
- package/dist/Model/KnnModel.js.map +1 -0
- package/dist/Model/LdaModel.d.ts +25 -0
- package/dist/Model/LdaModel.js +45 -0
- package/dist/Model/LdaModel.js.map +1 -0
- package/dist/Model/LinearPerceptronModel.d.ts +21 -0
- package/dist/Model/LinearPerceptronModel.js +62 -0
- package/dist/Model/LinearPerceptronModel.js.map +1 -0
- package/dist/Model/Model.d.ts +12 -0
- package/dist/Model/Model.js +31 -0
- package/dist/Model/Model.js.map +1 -0
- package/dist/Model/MultiLayerPerceptronModel.d.ts +29 -0
- package/dist/Model/MultiLayerPerceptronModel.js +101 -0
- package/dist/Model/MultiLayerPerceptronModel.js.map +1 -0
- package/dist/Model/NaiveBayesModel.d.ts +47 -0
- package/dist/Model/NaiveBayesModel.js +95 -0
- package/dist/Model/NaiveBayesModel.js.map +1 -0
- package/dist/Model/NeuralNetworkModel.d.ts +99 -0
- package/dist/Model/NeuralNetworkModel.js +180 -0
- package/dist/Model/NeuralNetworkModel.js.map +1 -0
- package/dist/Model/QdaModel.d.ts +26 -0
- package/dist/Model/QdaModel.js +45 -0
- package/dist/Model/QdaModel.js.map +1 -0
- package/dist/Model/RandomModel.d.ts +16 -0
- package/dist/Model/RandomModel.js +51 -0
- package/dist/Model/RandomModel.js.map +1 -0
- package/dist/Model/TreeEnsembleModel.d.ts +21 -0
- package/dist/Model/TreeEnsembleModel.js +49 -0
- package/dist/Model/TreeEnsembleModel.js.map +1 -0
- package/dist/Model/ValidatedModel.d.ts +12 -0
- package/dist/Model/ValidatedModel.js +35 -0
- package/dist/Model/ValidatedModel.js.map +1 -0
- package/dist/Parameter/ActivationFunction.d.ts +5 -0
- package/dist/Parameter/ActivationFunction.js +20 -0
- package/dist/Parameter/ActivationFunction.js.map +1 -0
- package/dist/Parameter/BaggingParameter.d.ts +17 -0
- package/dist/Parameter/BaggingParameter.js +36 -0
- package/dist/Parameter/BaggingParameter.js.map +1 -0
- package/dist/Parameter/C45Parameter.d.ts +25 -0
- package/dist/Parameter/C45Parameter.js +46 -0
- package/dist/Parameter/C45Parameter.js.map +1 -0
- package/dist/Parameter/DeepNetworkParameter.d.ts +38 -0
- package/dist/Parameter/DeepNetworkParameter.js +60 -0
- package/dist/Parameter/DeepNetworkParameter.js.map +1 -0
- package/dist/Parameter/KMeansParameter.d.ts +18 -0
- package/dist/Parameter/KMeansParameter.js +42 -0
- package/dist/Parameter/KMeansParameter.js.map +1 -0
- package/dist/Parameter/KnnParameter.d.ts +19 -0
- package/dist/Parameter/KnnParameter.js +37 -0
- package/dist/Parameter/KnnParameter.js.map +1 -0
- package/dist/Parameter/LinearPerceptronParameter.d.ts +41 -0
- package/dist/Parameter/LinearPerceptronParameter.js +66 -0
- package/dist/Parameter/LinearPerceptronParameter.js.map +1 -0
- package/dist/Parameter/MultiLayerPerceptronParameter.d.ts +30 -0
- package/dist/Parameter/MultiLayerPerceptronParameter.js +50 -0
- package/dist/Parameter/MultiLayerPerceptronParameter.js.map +1 -0
- package/dist/Parameter/Parameter.d.ts +15 -0
- package/dist/Parameter/Parameter.js +33 -0
- package/dist/Parameter/Parameter.js.map +1 -0
- package/dist/Parameter/RandomForestParameter.d.ts +18 -0
- package/dist/Parameter/RandomForestParameter.js +37 -0
- package/dist/Parameter/RandomForestParameter.js.map +1 -0
- package/dist/Performance/ClassificationPerformance.d.ts +17 -0
- package/dist/Performance/ClassificationPerformance.js +36 -0
- package/dist/Performance/ClassificationPerformance.js.map +1 -0
- package/dist/Performance/ConfusionMatrix.d.ts +81 -0
- package/dist/Performance/ConfusionMatrix.js +178 -0
- package/dist/Performance/ConfusionMatrix.js.map +1 -0
- package/dist/Performance/DetailedClassificationPerformance.d.ts +17 -0
- package/dist/Performance/DetailedClassificationPerformance.js +35 -0
- package/dist/Performance/DetailedClassificationPerformance.js.map +1 -0
- package/dist/Performance/ExperimentPerformance.d.ts +88 -0
- package/dist/Performance/ExperimentPerformance.js +176 -0
- package/dist/Performance/ExperimentPerformance.js.map +1 -0
- package/dist/Performance/Performance.d.ts +15 -0
- package/dist/Performance/Performance.js +33 -0
- package/dist/Performance/Performance.js.map +1 -0
- package/dist/StatisticalTest/Combined5x2F.d.ts +7 -0
- package/dist/StatisticalTest/Combined5x2F.js +43 -0
- package/dist/StatisticalTest/Combined5x2F.js.map +1 -0
- package/dist/StatisticalTest/Combined5x2t.d.ts +7 -0
- package/dist/StatisticalTest/Combined5x2t.js +43 -0
- package/dist/StatisticalTest/Combined5x2t.js.map +1 -0
- package/dist/StatisticalTest/Paired5x2t.d.ts +7 -0
- package/dist/StatisticalTest/Paired5x2t.js +42 -0
- package/dist/StatisticalTest/Paired5x2t.js.map +1 -0
- package/dist/StatisticalTest/PairedTest.d.ts +6 -0
- package/dist/StatisticalTest/PairedTest.js +35 -0
- package/dist/StatisticalTest/PairedTest.js.map +1 -0
- package/dist/StatisticalTest/Pairedt.d.ts +7 -0
- package/dist/StatisticalTest/Pairedt.js +40 -0
- package/dist/StatisticalTest/Pairedt.js.map +1 -0
- package/dist/StatisticalTest/Sign.d.ts +8 -0
- package/dist/StatisticalTest/Sign.js +52 -0
- package/dist/StatisticalTest/Sign.js.map +1 -0
- package/dist/StatisticalTest/StatisticalTestResult.d.ts +9 -0
- package/dist/StatisticalTest/StatisticalTestResult.js +53 -0
- package/dist/StatisticalTest/StatisticalTestResult.js.map +1 -0
- package/dist/StatisticalTest/StatisticalTestResultType.d.ts +7 -0
- package/dist/StatisticalTest/StatisticalTestResultType.js +22 -0
- package/dist/StatisticalTest/StatisticalTestResultType.js.map +1 -0
- package/index.js +100 -0
- package/package.json +30 -0
- package/source/Attribute/Attribute.ts +6 -0
- package/source/Attribute/AttributeType.ts +18 -0
- package/source/Attribute/BinaryAttribute.ts +14 -0
- package/source/Attribute/ContinuousAttribute.ts +53 -0
- package/source/Attribute/DiscreteAttribute.ts +46 -0
- package/source/Attribute/DiscreteIndexedAttribute.ts +54 -0
- package/source/Classifier/Bagging.ts +32 -0
- package/source/Classifier/C45.ts +30 -0
- package/source/Classifier/C45Stump.ts +19 -0
- package/source/Classifier/Classifier.ts +71 -0
- package/source/Classifier/DeepNetwork.ts +22 -0
- package/source/Classifier/Dummy.ts +19 -0
- package/source/Classifier/KMeans.ts +26 -0
- package/source/Classifier/Knn.ts +21 -0
- package/source/Classifier/Lda.ts +43 -0
- package/source/Classifier/LinearPerceptron.ts +23 -0
- package/source/Classifier/MultiLayerPerceptron.ts +23 -0
- package/source/Classifier/NaiveBayes.ts +62 -0
- package/source/Classifier/Qda.ts +42 -0
- package/source/Classifier/RandomClassifier.ts +22 -0
- package/source/Classifier/RandomForest.ts +29 -0
- package/source/DataSet/DataDefinition.ts +106 -0
- package/source/DataSet/DataSet.ts +279 -0
- package/source/DistanceMetric/DistanceMetric.ts +6 -0
- package/source/DistanceMetric/EuclidianDistance.ts +32 -0
- package/source/DistanceMetric/MahalanobisDistance.ts +33 -0
- package/source/Experiment/BootstrapRun.ts +37 -0
- package/source/Experiment/Experiment.ts +57 -0
- package/source/Experiment/KFoldRun.ts +44 -0
- package/source/Experiment/KFoldRunSeparateTest.ts +50 -0
- package/source/Experiment/MultipleRun.ts +7 -0
- package/source/Experiment/MxKFoldRun.ts +37 -0
- package/source/Experiment/MxKFoldRunSeparateTest.ts +40 -0
- package/source/Experiment/SingleRun.ts +7 -0
- package/source/Experiment/SingleRunWithK.ts +39 -0
- package/source/Experiment/StratifiedKFoldRun.ts +30 -0
- package/source/Experiment/StratifiedKFoldRunSeparateTest.ts +33 -0
- package/source/Experiment/StratifiedMxKFoldRun.ts +34 -0
- package/source/Experiment/StratifiedMxKFoldRunSeparateTest.ts +40 -0
- package/source/Experiment/StratifiedSingleRunWithK.ts +33 -0
- package/source/FeatureSelection/BackwardSelection.ts +28 -0
- package/source/FeatureSelection/FeatureSubSet.ts +82 -0
- package/source/FeatureSelection/FloatingSelection.ts +27 -0
- package/source/FeatureSelection/ForwardSelection.ts +27 -0
- package/source/FeatureSelection/SubSetSelection.ts +88 -0
- package/source/Filter/DiscreteToContinuous.ts +59 -0
- package/source/Filter/DiscreteToIndexed.ts +48 -0
- package/source/Filter/FeatureFilter.ts +31 -0
- package/source/Filter/LaryFilter.ts +54 -0
- package/source/Filter/LaryToBinary.ts +57 -0
- package/source/Filter/Normalize.ts +42 -0
- package/source/Filter/Pca.ts +104 -0
- package/source/Filter/TrainedFeatureFilter.ts +17 -0
- package/source/Instance/CompositeInstance.ts +53 -0
- package/source/Instance/Instance.ts +170 -0
- package/source/InstanceList/InstanceList.ts +519 -0
- package/source/InstanceList/InstanceListOfSameClass.ts +25 -0
- package/source/InstanceList/Partition.ts +131 -0
- package/source/Model/DecisionTree/DecisionCondition.ts +74 -0
- package/source/Model/DecisionTree/DecisionNode.ts +257 -0
- package/source/Model/DecisionTree/DecisionTree.ts +71 -0
- package/source/Model/DeepNetworkModel.ts +156 -0
- package/source/Model/DummyModel.ts +40 -0
- package/source/Model/GaussianModel.ts +58 -0
- package/source/Model/KMeansModel.ts +44 -0
- package/source/Model/KnnInstance.ts +27 -0
- package/source/Model/KnnModel.ts +78 -0
- package/source/Model/LdaModel.ts +39 -0
- package/source/Model/LinearPerceptronModel.ts +55 -0
- package/source/Model/Model.ts +22 -0
- package/source/Model/MultiLayerPerceptronModel.ts +95 -0
- package/source/Model/NaiveBayesModel.ts +89 -0
- package/source/Model/NeuralNetworkModel.ts +187 -0
- package/source/Model/QdaModel.ts +39 -0
- package/source/Model/RandomModel.ts +44 -0
- package/source/Model/TreeEnsembleModel.ts +43 -0
- package/source/Model/ValidatedModel.ts +23 -0
- package/source/Parameter/ActivationFunction.ts +3 -0
- package/source/Parameter/BaggingParameter.ts +26 -0
- package/source/Parameter/C45Parameter.ts +38 -0
- package/source/Parameter/DeepNetworkParameter.ts +59 -0
- package/source/Parameter/KMeansParameter.ts +33 -0
- package/source/Parameter/KnnParameter.ts +28 -0
- package/source/Parameter/LinearPerceptronParameter.ts +66 -0
- package/source/Parameter/MultiLayerPerceptronParameter.ts +49 -0
- package/source/Parameter/Parameter.ts +22 -0
- package/source/Parameter/RandomForestParameter.ts +27 -0
- package/source/Performance/ClassificationPerformance.ts +26 -0
- package/source/Performance/ConfusionMatrix.ts +175 -0
- package/source/Performance/DetailedClassificationPerformance.ts +26 -0
- package/source/Performance/ExperimentPerformance.ts +175 -0
- package/source/Performance/Performance.ts +22 -0
- package/source/StatisticalTest/Combined5x2F.ts +33 -0
- package/source/StatisticalTest/Combined5x2t.ts +33 -0
- package/source/StatisticalTest/Paired5x2t.ts +32 -0
- package/source/StatisticalTest/PairedTest.ts +24 -0
- package/source/StatisticalTest/Pairedt.ts +30 -0
- package/source/StatisticalTest/Sign.ts +41 -0
- package/source/StatisticalTest/StatisticalTestResult.ts +42 -0
- package/source/StatisticalTest/StatisticalTestResultType.ts +6 -0
- package/source/tsconfig.json +13 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {LdaModel} from "./LdaModel";
|
|
2
|
+
import {Matrix} from "nlptoolkit-math/dist/Matrix";
|
|
3
|
+
import {DiscreteDistribution} from "nlptoolkit-math/dist/DiscreteDistribution";
|
|
4
|
+
import {Vector} from "nlptoolkit-math/dist/Vector";
|
|
5
|
+
import {Instance} from "../Instance/Instance";
|
|
6
|
+
|
|
7
|
+
export class QdaModel extends LdaModel{
|
|
8
|
+
|
|
9
|
+
private W: Map<string, Matrix>
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The constructor which sets the priorDistribution, w w1 and HashMap of String Matrix.
|
|
13
|
+
*
|
|
14
|
+
* @param priorDistribution {@link DiscreteDistribution} input.
|
|
15
|
+
* @param W {@link HashMap} of String and Matrix.
|
|
16
|
+
* @param w {@link HashMap} of String and Vectors.
|
|
17
|
+
* @param w0 {@link HashMap} of String and Double.
|
|
18
|
+
*/
|
|
19
|
+
constructor(priorDistribution: DiscreteDistribution, W: Map<string, Matrix>, w: Map<string, Vector>, w0: Map<string, number>) {
|
|
20
|
+
super(priorDistribution, w, w0);
|
|
21
|
+
this.W = W
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The calculateMetric method takes an {@link Instance} and a String as inputs. It multiplies Matrix Wi with Vector xi
|
|
26
|
+
* 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.
|
|
27
|
+
*
|
|
28
|
+
* @param instance {@link Instance} input.
|
|
29
|
+
* @param Ci String input.
|
|
30
|
+
* @return The result of Wi.multiplyWithVectorFromLeft(xi).dotProduct(xi) + wi.dotProduct(xi) + w0i.
|
|
31
|
+
*/
|
|
32
|
+
calculateMetric(instance: Instance, Ci: string): number {
|
|
33
|
+
let xi = instance.toVector();
|
|
34
|
+
let Wi = this.W.get(Ci);
|
|
35
|
+
let wi = this.w.get(Ci);
|
|
36
|
+
let w0i = this.w0.get(Ci);
|
|
37
|
+
return Wi.multiplyWithVectorFromLeft(xi).dotProduct(xi) + wi.dotProduct(xi) + w0i;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {Model} from "./Model";
|
|
2
|
+
import {Instance} from "../Instance/Instance";
|
|
3
|
+
import {CompositeInstance} from "../Instance/CompositeInstance";
|
|
4
|
+
|
|
5
|
+
export class RandomModel extends Model{
|
|
6
|
+
|
|
7
|
+
private classLabels: Array<string>
|
|
8
|
+
private seed: number
|
|
9
|
+
|
|
10
|
+
constructor(classLabels: Array<string>, seed: number) {
|
|
11
|
+
super();
|
|
12
|
+
this.classLabels = classLabels
|
|
13
|
+
this.seed = seed
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The predict method gets an Instance as an input and retrieves the possible class labels as an ArrayList. Then selects a
|
|
18
|
+
* random number as an index and returns the class label at this selected index.
|
|
19
|
+
*
|
|
20
|
+
* @param instance {@link Instance} to make prediction.
|
|
21
|
+
* @return The class label at the randomly selected index.
|
|
22
|
+
*/
|
|
23
|
+
predict(instance: Instance): string {
|
|
24
|
+
if ((instance instanceof CompositeInstance)) {
|
|
25
|
+
let possibleClassLabels = (<CompositeInstance> instance).getPossibleClassLabels();
|
|
26
|
+
let size = possibleClassLabels.length;
|
|
27
|
+
let index = Math.floor(Math.random() * size);
|
|
28
|
+
return possibleClassLabels[index];
|
|
29
|
+
} else {
|
|
30
|
+
let size = this.classLabels.length;
|
|
31
|
+
let index = Math.floor(Math.random() * size);
|
|
32
|
+
return this.classLabels[index];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
predictProbability(instance: Instance): Map<string, number> {
|
|
37
|
+
let result = new Map<string, number>();
|
|
38
|
+
for (let classLabel of this.classLabels){
|
|
39
|
+
result.set(classLabel, 1.0 / this.classLabels.length);
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {Model} from "./Model";
|
|
2
|
+
import {Instance} from "../Instance/Instance";
|
|
3
|
+
import {DecisionTree} from "./DecisionTree/DecisionTree";
|
|
4
|
+
import {DiscreteDistribution} from "nlptoolkit-math/dist/DiscreteDistribution";
|
|
5
|
+
|
|
6
|
+
export class TreeEnsembleModel extends Model{
|
|
7
|
+
|
|
8
|
+
private forest: Array<DecisionTree>
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A constructor which sets the {@link Array} of {@link DecisionTree} with given input.
|
|
12
|
+
*
|
|
13
|
+
* @param forest An {@link Array} of {@link DecisionTree}.
|
|
14
|
+
*/
|
|
15
|
+
constructor(forest: Array<DecisionTree>) {
|
|
16
|
+
super();
|
|
17
|
+
this.forest = forest
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The predict method takes an {@link Instance} as an input and loops through the {@link ArrayList} of {@link DecisionTree}s.
|
|
22
|
+
* Makes prediction for the items of that ArrayList and returns the maximum item of that ArrayList.
|
|
23
|
+
*
|
|
24
|
+
* @param instance Instance to make prediction.
|
|
25
|
+
* @return The maximum prediction of a given Instance.
|
|
26
|
+
*/
|
|
27
|
+
predict(instance: Instance): string {
|
|
28
|
+
let distribution = new DiscreteDistribution();
|
|
29
|
+
for (let tree of this.forest) {
|
|
30
|
+
distribution.addItem(tree.predict(instance));
|
|
31
|
+
}
|
|
32
|
+
return distribution.getMaxItem();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
predictProbability(instance: Instance): Map<string, number> {
|
|
36
|
+
let distribution = new DiscreteDistribution();
|
|
37
|
+
for (let tree of this.forest) {
|
|
38
|
+
distribution.addItem(tree.predict(instance));
|
|
39
|
+
}
|
|
40
|
+
return distribution.getProbabilityDistribution();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {Model} from "./Model";
|
|
2
|
+
import {InstanceList} from "../InstanceList/InstanceList";
|
|
3
|
+
import {ClassificationPerformance} from "../Performance/ClassificationPerformance";
|
|
4
|
+
|
|
5
|
+
export abstract class ValidatedModel extends Model{
|
|
6
|
+
|
|
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: InstanceList): ClassificationPerformance{
|
|
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++;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return new ClassificationPerformance(count / total);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {Parameter} from "./Parameter";
|
|
2
|
+
|
|
3
|
+
export class BaggingParameter extends Parameter{
|
|
4
|
+
|
|
5
|
+
protected ensembleSize: number
|
|
6
|
+
|
|
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: number, ensembleSize: number) {
|
|
14
|
+
super(seed);
|
|
15
|
+
this.ensembleSize = ensembleSize
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Accessor for the ensemble size.
|
|
20
|
+
*
|
|
21
|
+
* @return The ensemble size.
|
|
22
|
+
*/
|
|
23
|
+
getEnsembleSize(): number{
|
|
24
|
+
return this.ensembleSize
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {Parameter} from "./Parameter";
|
|
2
|
+
|
|
3
|
+
export class C45Parameter extends Parameter{
|
|
4
|
+
|
|
5
|
+
private prune: boolean
|
|
6
|
+
private crossValidationRatio: number
|
|
7
|
+
|
|
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: number, prune: boolean, crossValidationRatio: number) {
|
|
16
|
+
super(seed);
|
|
17
|
+
this.prune = prune
|
|
18
|
+
this.crossValidationRatio = crossValidationRatio
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Accessor for the prune.
|
|
23
|
+
*
|
|
24
|
+
* @return Prune.
|
|
25
|
+
*/
|
|
26
|
+
isPrune(): boolean{
|
|
27
|
+
return this.prune
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Accessor for the crossValidationRatio.
|
|
32
|
+
*
|
|
33
|
+
* @return crossValidationRatio.
|
|
34
|
+
*/
|
|
35
|
+
getCrossValidationRatio(): number{
|
|
36
|
+
return this.crossValidationRatio
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import {LinearPerceptronParameter} from "./LinearPerceptronParameter";
|
|
2
|
+
import {ActivationFunction} from "./ActivationFunction";
|
|
3
|
+
|
|
4
|
+
export class DeepNetworkParameter extends LinearPerceptronParameter{
|
|
5
|
+
private hiddenLayers: Array<number>
|
|
6
|
+
private activationFunction: ActivationFunction
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Parameters of the deep network classifier.
|
|
10
|
+
*
|
|
11
|
+
* @param seed Seed is used for random number generation.
|
|
12
|
+
* @param learningRate Double value for learning rate of the algorithm.
|
|
13
|
+
* @param etaDecrease Double value for decrease in eta of the algorithm.
|
|
14
|
+
* @param crossValidationRatio Double value for cross validation ratio of the algorithm.
|
|
15
|
+
* @param epoch Integer value for epoch number of the algorithm.
|
|
16
|
+
* @param hiddenLayers An integer {@link Array} for hidden layers of the algorithm.
|
|
17
|
+
* @param activationFunction Activation function
|
|
18
|
+
*/
|
|
19
|
+
constructor(seed: number,
|
|
20
|
+
learningRate: number,
|
|
21
|
+
etaDecrease: number,
|
|
22
|
+
crossValidationRatio: number,
|
|
23
|
+
epoch: number,
|
|
24
|
+
hiddenLayers: Array<number>,
|
|
25
|
+
activationFunction: ActivationFunction) {
|
|
26
|
+
super(seed, learningRate, etaDecrease, crossValidationRatio, epoch);
|
|
27
|
+
this.hiddenLayers = hiddenLayers
|
|
28
|
+
this.activationFunction = activationFunction
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The layerSize method returns the size of the hiddenLayers {@link Array}.
|
|
33
|
+
*
|
|
34
|
+
* @return The size of the hiddenLayers {@link Array}.
|
|
35
|
+
*/
|
|
36
|
+
layerSize(): number{
|
|
37
|
+
return this.hiddenLayers.length
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The getHiddenNodes method takes a layer index as an input and returns the element at the given index of hiddenLayers
|
|
42
|
+
* {@link Array}.
|
|
43
|
+
*
|
|
44
|
+
* @param layerIndex Index of the layer.
|
|
45
|
+
* @return The element at the layerIndex of hiddenLayers {@link Array}.
|
|
46
|
+
*/
|
|
47
|
+
getHiddenNodes(layerIndex: number): number{
|
|
48
|
+
return this.hiddenLayers[layerIndex]
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Accessor for the activation function.
|
|
53
|
+
*
|
|
54
|
+
* @return The activation function.
|
|
55
|
+
*/
|
|
56
|
+
getActivationFunction(): ActivationFunction{
|
|
57
|
+
return this.activationFunction
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {Parameter} from "./Parameter";
|
|
2
|
+
import {DistanceMetric} from "../DistanceMetric/DistanceMetric";
|
|
3
|
+
import {EuclidianDistance} from "../DistanceMetric/EuclidianDistance";
|
|
4
|
+
|
|
5
|
+
export class KMeansParameter extends Parameter{
|
|
6
|
+
|
|
7
|
+
protected distanceMetric: DistanceMetric
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* * Parameters of the K Means classifier.
|
|
11
|
+
*
|
|
12
|
+
* @param seed Seed is used for random number generation.
|
|
13
|
+
* @param distanceMetric distance metric used to calculate the distance between two instances.
|
|
14
|
+
*/
|
|
15
|
+
constructor(seed: number, distanceMetric?: DistanceMetric) {
|
|
16
|
+
super(seed);
|
|
17
|
+
if (distanceMetric == undefined){
|
|
18
|
+
this.distanceMetric = new EuclidianDistance()
|
|
19
|
+
} else {
|
|
20
|
+
this.distanceMetric = distanceMetric
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Accessor for the distanceMetric.
|
|
26
|
+
*
|
|
27
|
+
* @return The distanceMetric.
|
|
28
|
+
*/
|
|
29
|
+
getDistanceMetric(): DistanceMetric{
|
|
30
|
+
return this.distanceMetric
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {KMeansParameter} from "./KMeansParameter";
|
|
2
|
+
import {DistanceMetric} from "../DistanceMetric/DistanceMetric";
|
|
3
|
+
|
|
4
|
+
export class KnnParameter extends KMeansParameter{
|
|
5
|
+
|
|
6
|
+
private k: number
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Parameters of the K-nearest neighbor classifier.
|
|
10
|
+
*
|
|
11
|
+
* @param seed Seed is used for random number generation.
|
|
12
|
+
* @param k Parameter of the K-nearest neighbor algorithm.
|
|
13
|
+
* @param distanceMetric Used to calculate the distance between two instances.
|
|
14
|
+
*/
|
|
15
|
+
constructor(seed: number, k: number, distanceMetric?: DistanceMetric) {
|
|
16
|
+
super(seed, distanceMetric);
|
|
17
|
+
this.k = k
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Accessor for the k.
|
|
22
|
+
*
|
|
23
|
+
* @return Value of the k.
|
|
24
|
+
*/
|
|
25
|
+
getK(): number{
|
|
26
|
+
return this.k
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import {Parameter} from "./Parameter";
|
|
2
|
+
|
|
3
|
+
export class LinearPerceptronParameter extends Parameter{
|
|
4
|
+
|
|
5
|
+
private learningRate: number
|
|
6
|
+
private etaDecrease: number
|
|
7
|
+
private crossValidationRatio: number
|
|
8
|
+
private epoch: number
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Parameters of the linear perceptron algorithm.
|
|
12
|
+
*
|
|
13
|
+
* @param seed Seed is used for random number generation.
|
|
14
|
+
* @param learningRate Double value for learning rate of the algorithm.
|
|
15
|
+
* @param etaDecrease Double value for decrease in eta of the algorithm.
|
|
16
|
+
* @param crossValidationRatio Double value for cross validation ratio of the algorithm.
|
|
17
|
+
* @param epoch Integer value for epoch number of the algorithm.
|
|
18
|
+
*/
|
|
19
|
+
constructor(seed: number,
|
|
20
|
+
learningRate: number,
|
|
21
|
+
etaDecrease: number,
|
|
22
|
+
crossValidationRatio: number,
|
|
23
|
+
epoch: number) {
|
|
24
|
+
super(seed);
|
|
25
|
+
this.learningRate = learningRate
|
|
26
|
+
this.etaDecrease = etaDecrease
|
|
27
|
+
this.crossValidationRatio = crossValidationRatio
|
|
28
|
+
this.epoch = epoch
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Accessor for the learningRate.
|
|
33
|
+
*
|
|
34
|
+
* @return The learningRate.
|
|
35
|
+
*/
|
|
36
|
+
getLearningRate(): number{
|
|
37
|
+
return this.learningRate
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Accessor for the etaDecrease.
|
|
42
|
+
*
|
|
43
|
+
* @return The etaDecrease.
|
|
44
|
+
*/
|
|
45
|
+
getEtaDecrease(): number{
|
|
46
|
+
return this.etaDecrease
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Accessor for the crossValidationRatio.
|
|
51
|
+
*
|
|
52
|
+
* @return The crossValidationRatio.
|
|
53
|
+
*/
|
|
54
|
+
getCrossValidationRatio(): number{
|
|
55
|
+
return this.crossValidationRatio
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Accessor for the epoch.
|
|
60
|
+
*
|
|
61
|
+
* @return The epoch.
|
|
62
|
+
*/
|
|
63
|
+
getEpoch(): number{
|
|
64
|
+
return this.epoch
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {LinearPerceptronParameter} from "./LinearPerceptronParameter";
|
|
2
|
+
import {ActivationFunction} from "./ActivationFunction";
|
|
3
|
+
|
|
4
|
+
export class MultiLayerPerceptronParameter extends LinearPerceptronParameter{
|
|
5
|
+
|
|
6
|
+
private hiddenNodes: number
|
|
7
|
+
private activationFunction: ActivationFunction
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Parameters of the multi layer perceptron algorithm.
|
|
11
|
+
*
|
|
12
|
+
* @param seed Seed is used for random number generation.
|
|
13
|
+
* @param learningRate Double value for learning rate of the algorithm.
|
|
14
|
+
* @param etaDecrease Double value for decrease in eta of the algorithm.
|
|
15
|
+
* @param crossValidationRatio Double value for cross validation ratio of the algorithm.
|
|
16
|
+
* @param epoch Integer value for epoch number of the algorithm.
|
|
17
|
+
* @param hiddenNodes Integer value for the number of hidden nodes.
|
|
18
|
+
* @param activationFunction Activation function
|
|
19
|
+
*/
|
|
20
|
+
constructor(seed: number,
|
|
21
|
+
learningRate: number,
|
|
22
|
+
etaDecrease: number,
|
|
23
|
+
crossValidationRatio: number,
|
|
24
|
+
epoch: number,
|
|
25
|
+
hiddenNodes: number,
|
|
26
|
+
activationFunction: ActivationFunction) {
|
|
27
|
+
super(seed, learningRate, etaDecrease, crossValidationRatio, epoch);
|
|
28
|
+
this.hiddenNodes = hiddenNodes
|
|
29
|
+
this.activationFunction = activationFunction
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Accessor for the hiddenNodes.
|
|
34
|
+
*
|
|
35
|
+
* @return The hiddenNodes.
|
|
36
|
+
*/
|
|
37
|
+
getHiddenNodes(): number{
|
|
38
|
+
return this.hiddenNodes
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Accessor for the activation function.
|
|
43
|
+
*
|
|
44
|
+
* @return The activation function.
|
|
45
|
+
*/
|
|
46
|
+
getActivationFunction(): ActivationFunction{
|
|
47
|
+
return this.activationFunction
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class Parameter {
|
|
2
|
+
|
|
3
|
+
private seed: number
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Constructor of {@link Parameter} class which assigns given seed value to seed.
|
|
7
|
+
*
|
|
8
|
+
* @param seed Seed is used for random number generation.
|
|
9
|
+
*/
|
|
10
|
+
constructor(seed: number) {
|
|
11
|
+
this.seed = seed
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Accessor for the seed.
|
|
16
|
+
*
|
|
17
|
+
* @return The seed.
|
|
18
|
+
*/
|
|
19
|
+
getSeed(): number{
|
|
20
|
+
return this.seed
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {BaggingParameter} from "./BaggingParameter";
|
|
2
|
+
|
|
3
|
+
export class RandomForestParameter extends BaggingParameter{
|
|
4
|
+
|
|
5
|
+
attributeSubsetSize: number
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Parameters of the random forest classifier.
|
|
9
|
+
*
|
|
10
|
+
* @param seed Seed is used for random number generation.
|
|
11
|
+
* @param ensembleSize The number of trees in the bagged forest.
|
|
12
|
+
* @param attributeSubsetSize Integer value for the size of attribute subset.
|
|
13
|
+
*/
|
|
14
|
+
constructor(seed: number, ensembleSize: number, attributeSubsetSize: number) {
|
|
15
|
+
super(seed, ensembleSize);
|
|
16
|
+
this.attributeSubsetSize = attributeSubsetSize
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Accessor for the attributeSubsetSize.
|
|
21
|
+
*
|
|
22
|
+
* @return The attributeSubsetSize.
|
|
23
|
+
*/
|
|
24
|
+
getAttributeSubsetSize(): number{
|
|
25
|
+
return this.attributeSubsetSize
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {Performance} from "./Performance";
|
|
2
|
+
|
|
3
|
+
export class ClassificationPerformance extends Performance{
|
|
4
|
+
|
|
5
|
+
private readonly accuracy: number
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A constructor that sets the accuracy and errorRate via given input.
|
|
9
|
+
*
|
|
10
|
+
* @param accuracy Double value input.
|
|
11
|
+
* @param errorRate Double value input.
|
|
12
|
+
*/
|
|
13
|
+
constructor(accuracy: number, errorRate?: number) {
|
|
14
|
+
super(errorRate == undefined ? 1 - accuracy : errorRate);
|
|
15
|
+
this.accuracy = accuracy
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Accessor for the accuracy.
|
|
20
|
+
*
|
|
21
|
+
* @return Accuracy value.
|
|
22
|
+
*/
|
|
23
|
+
getAccuracy(): number{
|
|
24
|
+
return this.accuracy
|
|
25
|
+
}
|
|
26
|
+
}
|