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,62 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "./FeatureFilter"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.LaryFilter = void 0;
|
|
13
|
+
const FeatureFilter_1 = require("./FeatureFilter");
|
|
14
|
+
class LaryFilter extends FeatureFilter_1.FeatureFilter {
|
|
15
|
+
/**
|
|
16
|
+
* Constructor that sets the dataSet and all the attributes distributions.
|
|
17
|
+
*
|
|
18
|
+
* @param dataSet DataSet that will bu used.
|
|
19
|
+
*/
|
|
20
|
+
constructor(dataSet) {
|
|
21
|
+
super(dataSet);
|
|
22
|
+
this.attributeDistributions = dataSet.getInstanceList().allAttributesDistribution();
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The removeDiscreteAttributes method takes an {@link Instance} as an input, and removes the discrete attributes from
|
|
26
|
+
* given instance.
|
|
27
|
+
*
|
|
28
|
+
* @param instance Instance to removes attributes from.
|
|
29
|
+
* @param size Size of the given instance.
|
|
30
|
+
*/
|
|
31
|
+
removeDiscreteAttributesFromInstance(instance, size) {
|
|
32
|
+
let k = 0;
|
|
33
|
+
for (let i = 0; i < size; i++) {
|
|
34
|
+
if (this.attributeDistributions[i].size > 0) {
|
|
35
|
+
instance.removeAttribute(k);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
k++;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The removeDiscreteAttributes method removes the discrete attributes from dataDefinition.
|
|
44
|
+
*
|
|
45
|
+
* @param size Size of item that attributes will be removed.
|
|
46
|
+
*/
|
|
47
|
+
removeDiscreteAttributesFromDataDefinition(size) {
|
|
48
|
+
let dataDefinition = this.dataSet.getDataDefinition();
|
|
49
|
+
let k = 0;
|
|
50
|
+
for (let i = 0; i < size; i++) {
|
|
51
|
+
if (this.attributeDistributions[i].size > 0) {
|
|
52
|
+
dataDefinition.removeAttribute(k);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
k++;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.LaryFilter = LaryFilter;
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=LaryFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LaryFilter.js","sourceRoot":"","sources":["../../source/Filter/LaryFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,mDAA8C;IAK9C,MAAsB,UAAW,SAAQ,6BAAa;QAIlD;;;;WAIG;QACH,YAAY,OAAgB;YACxB,KAAK,CAAC,OAAO,CAAC,CAAC;YACf,IAAI,CAAC,sBAAsB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,yBAAyB,EAAE,CAAA;QACvF,CAAC;QAED;;;;;;WAMG;QACO,oCAAoC,CAAC,QAAkB,EAAE,IAAY;YAC3E,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;gBAC3B,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,EAAE;oBACzC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;iBAC/B;qBAAM;oBACH,CAAC,EAAE,CAAC;iBACP;aACJ;QACL,CAAC;QAED;;;;WAIG;QACO,0CAA0C,CAAC,IAAY;YAC7D,IAAI,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;YACtD,IAAI,CAAC,GAAG,CAAC,CAAC;YACV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;gBAC3B,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,EAAE;oBACzC,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;iBACrC;qBAAM;oBACH,CAAC,EAAE,CAAC;iBACP;aACJ;QACL,CAAC;KACJ;IAhDD,gCAgDC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { LaryFilter } from "./LaryFilter";
|
|
2
|
+
import { Instance } from "../Instance/Instance";
|
|
3
|
+
import { DataSet } from "../DataSet/DataSet";
|
|
4
|
+
export declare class LaryToBinary extends LaryFilter {
|
|
5
|
+
/**
|
|
6
|
+
* Converts the data definition with L-ary discrete attributes, to data definition with binary discrete attributes.
|
|
7
|
+
*/
|
|
8
|
+
convertDataDefinition(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Converts discrete attributes of a single instance to binary discrete version using 1-of-L encoding. For example, if
|
|
11
|
+
* an attribute has values red, green, blue; this attribute will be converted to 3 binary attributes where
|
|
12
|
+
* red will have the value true false false, green will have the value false true false, and blue will have the value false false true.
|
|
13
|
+
*
|
|
14
|
+
* @param instance The instance to be converted.
|
|
15
|
+
*/
|
|
16
|
+
convertInstance(instance: Instance): void;
|
|
17
|
+
/**
|
|
18
|
+
* Constructor for L-ary discrete to binary discrete filter.
|
|
19
|
+
*
|
|
20
|
+
* @param dataSet The instances whose L-ary discrete attributes will be converted to binary discrete attributes.
|
|
21
|
+
*/
|
|
22
|
+
constructor(dataSet: DataSet);
|
|
23
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "./LaryFilter", "../Attribute/BinaryAttribute", "../Attribute/AttributeType"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.LaryToBinary = void 0;
|
|
13
|
+
const LaryFilter_1 = require("./LaryFilter");
|
|
14
|
+
const BinaryAttribute_1 = require("../Attribute/BinaryAttribute");
|
|
15
|
+
const AttributeType_1 = require("../Attribute/AttributeType");
|
|
16
|
+
class LaryToBinary extends LaryFilter_1.LaryFilter {
|
|
17
|
+
/**
|
|
18
|
+
* Converts the data definition with L-ary discrete attributes, to data definition with binary discrete attributes.
|
|
19
|
+
*/
|
|
20
|
+
convertDataDefinition() {
|
|
21
|
+
let dataDefinition = this.dataSet.getDataDefinition();
|
|
22
|
+
let size = dataDefinition.attributeCount();
|
|
23
|
+
for (let i = 0; i < size; i++) {
|
|
24
|
+
if (this.attributeDistributions[i].size > 0) {
|
|
25
|
+
for (let j = 0; j < this.attributeDistributions[i].size; j++) {
|
|
26
|
+
dataDefinition.addAttribute(AttributeType_1.AttributeType.BINARY);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
this.removeDiscreteAttributesFromDataDefinition(size);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Converts discrete attributes of a single instance to binary discrete version using 1-of-L encoding. For example, if
|
|
34
|
+
* an attribute has values red, green, blue; this attribute will be converted to 3 binary attributes where
|
|
35
|
+
* red will have the value true false false, green will have the value false true false, and blue will have the value false false true.
|
|
36
|
+
*
|
|
37
|
+
* @param instance The instance to be converted.
|
|
38
|
+
*/
|
|
39
|
+
convertInstance(instance) {
|
|
40
|
+
let size = instance.attributeSize();
|
|
41
|
+
for (let i = 0; i < size; i++) {
|
|
42
|
+
if (this.attributeDistributions[i].size > 0) {
|
|
43
|
+
let index = this.attributeDistributions[i].getIndex(instance.getAttribute(i).toString());
|
|
44
|
+
for (let j = 0; j < this.attributeDistributions[i].size; j++) {
|
|
45
|
+
if (j != index) {
|
|
46
|
+
instance.addAttribute(new BinaryAttribute_1.BinaryAttribute(false));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
instance.addAttribute(new BinaryAttribute_1.BinaryAttribute(true));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
this.removeDiscreteAttributesFromInstance(instance, size);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Constructor for L-ary discrete to binary discrete filter.
|
|
58
|
+
*
|
|
59
|
+
* @param dataSet The instances whose L-ary discrete attributes will be converted to binary discrete attributes.
|
|
60
|
+
*/
|
|
61
|
+
constructor(dataSet) {
|
|
62
|
+
super(dataSet);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.LaryToBinary = LaryToBinary;
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=LaryToBinary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LaryToBinary.js","sourceRoot":"","sources":["../../source/Filter/LaryToBinary.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,6CAAwC;IAGxC,kEAA6D;IAC7D,8DAAyD;IAEzD,MAAa,YAAa,SAAQ,uBAAU;QAExC;;WAEG;QACH,qBAAqB;YACjB,IAAI,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;YACtD,IAAI,IAAI,GAAG,cAAc,CAAC,cAAc,EAAE,CAAC;YAC3C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;gBAC3B,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,EAAE;oBACzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;wBAC1D,cAAc,CAAC,YAAY,CAAC,6BAAa,CAAC,MAAM,CAAC,CAAC;qBACrD;iBACJ;aACJ;YACD,IAAI,CAAC,0CAA0C,CAAC,IAAI,CAAC,CAAC;QAC1D,CAAC;QAED;;;;;;WAMG;QACH,eAAe,CAAC,QAAkB;YAC9B,IAAI,IAAI,GAAG,QAAQ,CAAC,aAAa,EAAE,CAAC;YACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;gBAC3B,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,EAAE;oBACzC,IAAI,KAAK,GAAG,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;oBACzF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;wBAC1D,IAAI,CAAC,IAAI,KAAK,EAAE;4BACZ,QAAQ,CAAC,YAAY,CAAC,IAAI,iCAAe,CAAC,KAAK,CAAC,CAAC,CAAC;yBACrD;6BAAM;4BACH,QAAQ,CAAC,YAAY,CAAC,IAAI,iCAAe,CAAC,IAAI,CAAC,CAAC,CAAC;yBACpD;qBACJ;iBACJ;aACJ;YACD,IAAI,CAAC,oCAAoC,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC9D,CAAC;QAED;;;;WAIG;QACH,YAAY,OAAgB;YACxB,KAAK,CAAC,OAAO,CAAC,CAAC;QACnB,CAAC;KACJ;IAlDD,oCAkDC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FeatureFilter } from "./FeatureFilter";
|
|
2
|
+
import { Instance } from "../Instance/Instance";
|
|
3
|
+
import { DataSet } from "../DataSet/DataSet";
|
|
4
|
+
export declare class Normalize extends FeatureFilter {
|
|
5
|
+
private averageInstance;
|
|
6
|
+
private standardDeviationInstance;
|
|
7
|
+
/**
|
|
8
|
+
* Constructor for normalize feature filter. It calculates and stores the mean (m) and standard deviation (s) of
|
|
9
|
+
* the sample.
|
|
10
|
+
*
|
|
11
|
+
* @param dataSet Instances whose continuous attribute values will be normalized.
|
|
12
|
+
*/
|
|
13
|
+
constructor(dataSet: DataSet);
|
|
14
|
+
convertDataDefinition(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Normalizes the continuous attributes of a single instance. For all i, new x_i = (x_i - m_i) / s_i.
|
|
17
|
+
*
|
|
18
|
+
* @param instance Instance whose attributes will be normalized.
|
|
19
|
+
*/
|
|
20
|
+
convertInstance(instance: Instance): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "./FeatureFilter", "../Attribute/ContinuousAttribute"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Normalize = void 0;
|
|
13
|
+
const FeatureFilter_1 = require("./FeatureFilter");
|
|
14
|
+
const ContinuousAttribute_1 = require("../Attribute/ContinuousAttribute");
|
|
15
|
+
class Normalize extends FeatureFilter_1.FeatureFilter {
|
|
16
|
+
/**
|
|
17
|
+
* Constructor for normalize feature filter. It calculates and stores the mean (m) and standard deviation (s) of
|
|
18
|
+
* the sample.
|
|
19
|
+
*
|
|
20
|
+
* @param dataSet Instances whose continuous attribute values will be normalized.
|
|
21
|
+
*/
|
|
22
|
+
constructor(dataSet) {
|
|
23
|
+
super(dataSet);
|
|
24
|
+
this.averageInstance = dataSet.getInstanceList().average();
|
|
25
|
+
this.standardDeviationInstance = dataSet.getInstanceList().standardDeviation();
|
|
26
|
+
}
|
|
27
|
+
convertDataDefinition() {
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Normalizes the continuous attributes of a single instance. For all i, new x_i = (x_i - m_i) / s_i.
|
|
31
|
+
*
|
|
32
|
+
* @param instance Instance whose attributes will be normalized.
|
|
33
|
+
*/
|
|
34
|
+
convertInstance(instance) {
|
|
35
|
+
for (let i = 0; i < instance.attributeSize(); i++) {
|
|
36
|
+
if (instance.getAttribute(i) instanceof ContinuousAttribute_1.ContinuousAttribute) {
|
|
37
|
+
let xi = instance.getAttribute(i);
|
|
38
|
+
let mi = this.averageInstance.getAttribute(i);
|
|
39
|
+
let si = this.standardDeviationInstance.getAttribute(i);
|
|
40
|
+
xi.setValue((xi.getValue() - mi.getValue()) / si.getValue());
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.Normalize = Normalize;
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=Normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Normalize.js","sourceRoot":"","sources":["../../source/Filter/Normalize.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,mDAA8C;IAG9C,0EAAqE;IAErE,MAAa,SAAU,SAAQ,6BAAa;QAKxC;;;;;WAKG;QACH,YAAY,OAAgB;YACxB,KAAK,CAAC,OAAO,CAAC,CAAC;YACf,IAAI,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,OAAO,EAAE,CAAC;YAC3D,IAAI,CAAC,yBAAyB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,iBAAiB,EAAE,CAAC;QACnF,CAAC;QAED,qBAAqB;QACrB,CAAC;QAED;;;;WAIG;QACH,eAAe,CAAC,QAAkB;YAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC,EAAE,EAAE;gBAC/C,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,yCAAmB,EAAE;oBACzD,IAAI,EAAE,GAAyB,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;oBACxD,IAAI,EAAE,GAAyB,IAAI,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;oBACpE,IAAI,EAAE,GAAyB,IAAI,CAAC,yBAAyB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;oBAC9E,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;iBAChE;aACJ;QACL,CAAC;KAEJ;IApCD,8BAoCC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { TrainedFeatureFilter } from "./TrainedFeatureFilter";
|
|
2
|
+
import { Instance } from "../Instance/Instance";
|
|
3
|
+
import { DataSet } from "../DataSet/DataSet";
|
|
4
|
+
export declare class Pca extends TrainedFeatureFilter {
|
|
5
|
+
private readonly covarianceExplained;
|
|
6
|
+
private eigenvectors;
|
|
7
|
+
private readonly numberOfDimensions;
|
|
8
|
+
/**
|
|
9
|
+
* The convertDataDefinition method gets the data definitions of the dataSet and removes all the attributes. Then adds
|
|
10
|
+
* new attributes as CONTINUOUS.
|
|
11
|
+
*/
|
|
12
|
+
convertDataDefinition(): void;
|
|
13
|
+
/**
|
|
14
|
+
* The convertInstance method takes an {@link Instance} as an input and creates a {@link Vector} attributes from continuousAttributes.
|
|
15
|
+
* After removing all attributes of given instance, it then adds new {@link ContinuousAttribute} by using the dot
|
|
16
|
+
* product of attribute Vector and the eigenvectors.
|
|
17
|
+
*
|
|
18
|
+
* @param instance Instance that will be converted to {@link ContinuousAttribute} by using eigenvectors.
|
|
19
|
+
*/
|
|
20
|
+
convertInstance(instance: Instance): void;
|
|
21
|
+
/**
|
|
22
|
+
* The train method creates an averageVector from continuousAttributeAverage and a covariance {@link Matrix} from that averageVector.
|
|
23
|
+
* Then finds the eigenvectors of that covariance matrix and removes its unnecessary eigenvectors.
|
|
24
|
+
*/
|
|
25
|
+
protected train(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Constructor that sets the dataSet and dimension. Then calls train method.
|
|
28
|
+
*
|
|
29
|
+
* @param dataSet DataSet that will be used.
|
|
30
|
+
* @param numberOfDimensionsOrCovarianceExplained Dimension number.
|
|
31
|
+
*/
|
|
32
|
+
constructor(dataSet: DataSet, numberOfDimensionsOrCovarianceExplained?: number);
|
|
33
|
+
/**
|
|
34
|
+
* The removeUnnecessaryEigenvectors methods takes an ArrayList of Eigenvectors. It first calculates the summation
|
|
35
|
+
* of eigenValues. Then it finds the eigenvectors which have lesser summation than covarianceExplained and removes these
|
|
36
|
+
* eigenvectors.
|
|
37
|
+
*/
|
|
38
|
+
private removeUnnecessaryEigenvectors;
|
|
39
|
+
/**
|
|
40
|
+
* The removeAllEigenvectorsExceptTheMostImportantK method takes an {@link Array} of {@link Eigenvector}s and removes the
|
|
41
|
+
* surplus eigenvectors when the number of eigenvectors is greater than the dimension.
|
|
42
|
+
*/
|
|
43
|
+
private removeAllEigenvectorsExceptTheMostImportantK;
|
|
44
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "./TrainedFeatureFilter", "nlptoolkit-math/dist/Vector", "../Attribute/ContinuousAttribute", "../Attribute/AttributeType"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Pca = void 0;
|
|
13
|
+
const TrainedFeatureFilter_1 = require("./TrainedFeatureFilter");
|
|
14
|
+
const Vector_1 = require("nlptoolkit-math/dist/Vector");
|
|
15
|
+
const ContinuousAttribute_1 = require("../Attribute/ContinuousAttribute");
|
|
16
|
+
const AttributeType_1 = require("../Attribute/AttributeType");
|
|
17
|
+
class Pca extends TrainedFeatureFilter_1.TrainedFeatureFilter {
|
|
18
|
+
/**
|
|
19
|
+
* Constructor that sets the dataSet and dimension. Then calls train method.
|
|
20
|
+
*
|
|
21
|
+
* @param dataSet DataSet that will be used.
|
|
22
|
+
* @param numberOfDimensionsOrCovarianceExplained Dimension number.
|
|
23
|
+
*/
|
|
24
|
+
constructor(dataSet, numberOfDimensionsOrCovarianceExplained) {
|
|
25
|
+
super(dataSet);
|
|
26
|
+
this.covarianceExplained = 0.99;
|
|
27
|
+
this.eigenvectors = new Array();
|
|
28
|
+
this.numberOfDimensions = -1;
|
|
29
|
+
if (numberOfDimensionsOrCovarianceExplained != undefined) {
|
|
30
|
+
if (Number.isInteger(numberOfDimensionsOrCovarianceExplained)) {
|
|
31
|
+
this.numberOfDimensions = numberOfDimensionsOrCovarianceExplained;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.covarianceExplained = numberOfDimensionsOrCovarianceExplained;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
this.train();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The convertDataDefinition method gets the data definitions of the dataSet and removes all the attributes. Then adds
|
|
41
|
+
* new attributes as CONTINUOUS.
|
|
42
|
+
*/
|
|
43
|
+
convertDataDefinition() {
|
|
44
|
+
let dataDefinition = this.dataSet.getDataDefinition();
|
|
45
|
+
dataDefinition.removeAllAttributes();
|
|
46
|
+
for (let i = 0; i < this.eigenvectors.length; i++) {
|
|
47
|
+
dataDefinition.addAttribute(AttributeType_1.AttributeType.CONTINUOUS);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The convertInstance method takes an {@link Instance} as an input and creates a {@link Vector} attributes from continuousAttributes.
|
|
52
|
+
* After removing all attributes of given instance, it then adds new {@link ContinuousAttribute} by using the dot
|
|
53
|
+
* product of attribute Vector and the eigenvectors.
|
|
54
|
+
*
|
|
55
|
+
* @param instance Instance that will be converted to {@link ContinuousAttribute} by using eigenvectors.
|
|
56
|
+
*/
|
|
57
|
+
convertInstance(instance) {
|
|
58
|
+
let attributes = new Vector_1.Vector(instance.continuousAttributes());
|
|
59
|
+
instance.removeAllAttributes();
|
|
60
|
+
for (let eigenvector of this.eigenvectors) {
|
|
61
|
+
instance.addAttribute(new ContinuousAttribute_1.ContinuousAttribute(attributes.dotProduct(eigenvector)));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The train method creates an averageVector from continuousAttributeAverage and a covariance {@link Matrix} from that averageVector.
|
|
66
|
+
* Then finds the eigenvectors of that covariance matrix and removes its unnecessary eigenvectors.
|
|
67
|
+
*/
|
|
68
|
+
train() {
|
|
69
|
+
let averageVector = new Vector_1.Vector(this.dataSet.getInstanceList().continuousAttributeAverage());
|
|
70
|
+
let covariance = this.dataSet.getInstanceList().covariance(averageVector);
|
|
71
|
+
this.eigenvectors = covariance.characteristics();
|
|
72
|
+
if (this.numberOfDimensions != -1) {
|
|
73
|
+
this.removeAllEigenvectorsExceptTheMostImportantK();
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
this.removeUnnecessaryEigenvectors();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The removeUnnecessaryEigenvectors methods takes an ArrayList of Eigenvectors. It first calculates the summation
|
|
81
|
+
* of eigenValues. Then it finds the eigenvectors which have lesser summation than covarianceExplained and removes these
|
|
82
|
+
* eigenvectors.
|
|
83
|
+
*/
|
|
84
|
+
removeUnnecessaryEigenvectors() {
|
|
85
|
+
let sum = 0.0, currentSum = 0.0;
|
|
86
|
+
for (let eigenvector of this.eigenvectors) {
|
|
87
|
+
sum += eigenvector.getEigenValue();
|
|
88
|
+
}
|
|
89
|
+
for (let i = 0; i < this.eigenvectors.length; i++) {
|
|
90
|
+
if (currentSum / sum < this.covarianceExplained) {
|
|
91
|
+
currentSum += this.eigenvectors[i].getEigenValue();
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
this.eigenvectors.splice(i, 1);
|
|
95
|
+
i--;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The removeAllEigenvectorsExceptTheMostImportantK method takes an {@link Array} of {@link Eigenvector}s and removes the
|
|
101
|
+
* surplus eigenvectors when the number of eigenvectors is greater than the dimension.
|
|
102
|
+
*/
|
|
103
|
+
removeAllEigenvectorsExceptTheMostImportantK() {
|
|
104
|
+
this.eigenvectors.splice(this.numberOfDimensions, this.eigenvectors.length - this.numberOfDimensions);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
exports.Pca = Pca;
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=Pca.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Pca.js","sourceRoot":"","sources":["../../source/Filter/Pca.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,iEAA4D;IAI5D,wDAAmD;IACnD,0EAAqE;IAErE,8DAAyD;IAEzD,MAAa,GAAI,SAAQ,2CAAoB;QAgDzC;;;;;WAKG;QACH,YAAY,OAAgB,EAAE,uCAAgD;YAC1E,KAAK,CAAC,OAAO,CAAC,CAAC;YArDF,wBAAmB,GAAW,IAAI,CAAA;YAC3C,iBAAY,GAAuB,IAAI,KAAK,EAAe,CAAA;YAClD,uBAAkB,GAAY,CAAC,CAAC,CAAA;YAoD7C,IAAI,uCAAuC,IAAI,SAAS,EAAC;gBACrD,IAAI,MAAM,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAC;oBAC1D,IAAI,CAAC,kBAAkB,GAAG,uCAAuC,CAAA;iBACpE;qBAAM;oBACH,IAAI,CAAC,mBAAmB,GAAG,uCAAuC,CAAA;iBACrE;aACJ;YACD,IAAI,CAAC,KAAK,EAAE,CAAA;QAChB,CAAC;QA1DD;;;WAGG;QACH,qBAAqB;YACjB,IAAI,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;YACtD,cAAc,CAAC,mBAAmB,EAAE,CAAC;YACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC/C,cAAc,CAAC,YAAY,CAAC,6BAAa,CAAC,UAAU,CAAC,CAAC;aACzD;QACL,CAAC;QAED;;;;;;WAMG;QACH,eAAe,CAAC,QAAkB;YAC9B,IAAI,UAAU,GAAY,IAAI,eAAM,CAAC,QAAQ,CAAC,oBAAoB,EAAE,CAAC,CAAC;YACtE,QAAQ,CAAC,mBAAmB,EAAE,CAAC;YAC/B,KAAK,IAAI,WAAW,IAAI,IAAI,CAAC,YAAY,EAAE;gBACvC,QAAQ,CAAC,YAAY,CAAC,IAAI,yCAAmB,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;aACtF;QACL,CAAC;QAED;;;WAGG;QACO,KAAK;YACX,IAAI,aAAa,GAAY,IAAI,eAAM,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,0BAA0B,EAAE,CAAC,CAAC;YACrG,IAAI,UAAU,GAAY,IAAI,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;YACnF,IAAI,CAAC,YAAY,GAAG,UAAU,CAAC,eAAe,EAAE,CAAC;YACjD,IAAI,IAAI,CAAC,kBAAkB,IAAI,CAAC,CAAC,EAAE;gBAC/B,IAAI,CAAC,4CAA4C,EAAE,CAAC;aACvD;iBAAM;gBACH,IAAI,CAAC,6BAA6B,EAAE,CAAC;aACxC;QACL,CAAC;QAoBD;;;;WAIG;QACK,6BAA6B;YACjC,IAAI,GAAG,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,CAAC;YAChC,KAAK,IAAI,WAAW,IAAI,IAAI,CAAC,YAAY,EAAE;gBACvC,GAAG,IAAI,WAAW,CAAC,aAAa,EAAE,CAAC;aACtC;YACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC/C,IAAI,UAAU,GAAG,GAAG,GAAG,IAAI,CAAC,mBAAmB,EAAE;oBAC7C,UAAU,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;iBACtD;qBAAM;oBACH,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;oBAC/B,CAAC,EAAE,CAAC;iBACP;aACJ;QACL,CAAC;QAED;;;WAGG;QACK,4CAA4C;YAChD,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAA;QACzG,CAAC;KAEJ;IA9FD,kBA8FC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FeatureFilter } from "./FeatureFilter";
|
|
2
|
+
import { DataSet } from "../DataSet/DataSet";
|
|
3
|
+
export declare abstract class TrainedFeatureFilter extends FeatureFilter {
|
|
4
|
+
protected abstract train(): void;
|
|
5
|
+
/**
|
|
6
|
+
* Constructor that sets the dataSet.
|
|
7
|
+
*
|
|
8
|
+
* @param dataSet DataSet that will bu used.
|
|
9
|
+
*/
|
|
10
|
+
constructor(dataSet: DataSet);
|
|
11
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "./FeatureFilter"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TrainedFeatureFilter = void 0;
|
|
13
|
+
const FeatureFilter_1 = require("./FeatureFilter");
|
|
14
|
+
class TrainedFeatureFilter extends FeatureFilter_1.FeatureFilter {
|
|
15
|
+
/**
|
|
16
|
+
* Constructor that sets the dataSet.
|
|
17
|
+
*
|
|
18
|
+
* @param dataSet DataSet that will bu used.
|
|
19
|
+
*/
|
|
20
|
+
constructor(dataSet) {
|
|
21
|
+
super(dataSet);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.TrainedFeatureFilter = TrainedFeatureFilter;
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=TrainedFeatureFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrainedFeatureFilter.js","sourceRoot":"","sources":["../../source/Filter/TrainedFeatureFilter.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,mDAA8C;IAG9C,MAAsB,oBAAqB,SAAQ,6BAAa;QAI5D;;;;WAIG;QACH,YAAY,OAAgB;YACxB,KAAK,CAAC,OAAO,CAAC,CAAC;QACnB,CAAC;KAEJ;IAbD,oDAaC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Instance } from "./Instance";
|
|
2
|
+
import { Attribute } from "../Attribute/Attribute";
|
|
3
|
+
export declare class CompositeInstance extends Instance {
|
|
4
|
+
private possibleClassLabels;
|
|
5
|
+
/**
|
|
6
|
+
* Constructor of {@link CompositeInstance} class which takes a class label, attributes and an {@link ArrayList} of
|
|
7
|
+
* possible labels as inputs. It generates a new composite instance with given labels, attributes and possible labels.
|
|
8
|
+
*
|
|
9
|
+
* @param classLabel Class label of the composite instance.
|
|
10
|
+
* @param attributes Attributes of the composite instance.
|
|
11
|
+
* @param possibleClassLabels Possible labels of the composite instance.
|
|
12
|
+
*/
|
|
13
|
+
constructor(classLabel: string, attributes?: Array<Attribute>, possibleClassLabels?: Array<string>);
|
|
14
|
+
/**
|
|
15
|
+
* Accessor for the possible class labels.
|
|
16
|
+
*
|
|
17
|
+
* @return Possible class labels of the composite instance.
|
|
18
|
+
*/
|
|
19
|
+
getPossibleClassLabels(): Array<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Mutator method for possible class labels.
|
|
22
|
+
*
|
|
23
|
+
* @param possibleClassLabels Ner value of possible class labels.
|
|
24
|
+
*/
|
|
25
|
+
setPossibleClassLabels(possibleClassLabels: Array<string>): void;
|
|
26
|
+
/**
|
|
27
|
+
* Converts composite instance to {@link String}.
|
|
28
|
+
*
|
|
29
|
+
* @return String representation of composite instance.
|
|
30
|
+
*/
|
|
31
|
+
toString(): string;
|
|
32
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "./Instance"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CompositeInstance = void 0;
|
|
13
|
+
const Instance_1 = require("./Instance");
|
|
14
|
+
class CompositeInstance extends Instance_1.Instance {
|
|
15
|
+
/**
|
|
16
|
+
* Constructor of {@link CompositeInstance} class which takes a class label, attributes and an {@link ArrayList} of
|
|
17
|
+
* possible labels as inputs. It generates a new composite instance with given labels, attributes and possible labels.
|
|
18
|
+
*
|
|
19
|
+
* @param classLabel Class label of the composite instance.
|
|
20
|
+
* @param attributes Attributes of the composite instance.
|
|
21
|
+
* @param possibleClassLabels Possible labels of the composite instance.
|
|
22
|
+
*/
|
|
23
|
+
constructor(classLabel, attributes, possibleClassLabels) {
|
|
24
|
+
super(classLabel, attributes);
|
|
25
|
+
this.possibleClassLabels = new Array();
|
|
26
|
+
if (possibleClassLabels != undefined) {
|
|
27
|
+
this.possibleClassLabels = possibleClassLabels;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Accessor for the possible class labels.
|
|
32
|
+
*
|
|
33
|
+
* @return Possible class labels of the composite instance.
|
|
34
|
+
*/
|
|
35
|
+
getPossibleClassLabels() {
|
|
36
|
+
return this.possibleClassLabels;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Mutator method for possible class labels.
|
|
40
|
+
*
|
|
41
|
+
* @param possibleClassLabels Ner value of possible class labels.
|
|
42
|
+
*/
|
|
43
|
+
setPossibleClassLabels(possibleClassLabels) {
|
|
44
|
+
this.possibleClassLabels = possibleClassLabels;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Converts composite instance to {@link String}.
|
|
48
|
+
*
|
|
49
|
+
* @return String representation of composite instance.
|
|
50
|
+
*/
|
|
51
|
+
toString() {
|
|
52
|
+
let result = super.toString();
|
|
53
|
+
for (let possibleClassLabel of this.possibleClassLabels) {
|
|
54
|
+
result += ";" + possibleClassLabel;
|
|
55
|
+
}
|
|
56
|
+
return result.toString();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.CompositeInstance = CompositeInstance;
|
|
60
|
+
});
|
|
61
|
+
//# sourceMappingURL=CompositeInstance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompositeInstance.js","sourceRoot":"","sources":["../../source/Instance/CompositeInstance.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,yCAAoC;IAGpC,MAAa,iBAAkB,SAAQ,mBAAQ;QAI3C;;;;;;;WAOG;QACH,YAAY,UAAkB,EAAE,UAA6B,EAAE,mBAAmC;YAC9F,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YAX1B,wBAAmB,GAAkB,IAAI,KAAK,EAAU,CAAA;YAY5D,IAAI,mBAAmB,IAAI,SAAS,EAAC;gBACjC,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAA;aACjD;QACL,CAAC;QAED;;;;WAIG;QACH,sBAAsB;YAClB,OAAO,IAAI,CAAC,mBAAmB,CAAA;QACnC,CAAC;QAED;;;;WAIG;QACH,sBAAsB,CAAC,mBAAkC;YACrD,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,CAAA;QAClD,CAAC;QAED;;;;WAIG;QACH,QAAQ;YACJ,IAAI,MAAM,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;YAC9B,KAAK,IAAI,kBAAkB,IAAI,IAAI,CAAC,mBAAmB,EAAE;gBACrD,MAAM,IAAI,GAAG,GAAG,kBAAkB,CAAC;aACtC;YACD,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;QAC7B,CAAC;KACJ;IAjDD,8CAiDC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Attribute } from "../Attribute/Attribute";
|
|
2
|
+
import { Vector } from "nlptoolkit-math/dist/Vector";
|
|
3
|
+
import { FeatureSubSet } from "../FeatureSelection/FeatureSubSet";
|
|
4
|
+
export declare class Instance {
|
|
5
|
+
private readonly classLabel;
|
|
6
|
+
private attributes;
|
|
7
|
+
/**
|
|
8
|
+
* Constructor for a single instance. Given the attributes and class label, it generates a new instance.
|
|
9
|
+
*
|
|
10
|
+
* @param classLabel Class label of the instance.
|
|
11
|
+
* @param attributes Attributes of the instance.
|
|
12
|
+
*/
|
|
13
|
+
constructor(classLabel: string, attributes?: Array<Attribute>);
|
|
14
|
+
/**
|
|
15
|
+
* Adds a new attribute.
|
|
16
|
+
*
|
|
17
|
+
* @param value Attribute to be added.
|
|
18
|
+
*/
|
|
19
|
+
addAttribute(value: any): void;
|
|
20
|
+
/**
|
|
21
|
+
* Adds a {@link Vector} of continuous attributes.
|
|
22
|
+
*
|
|
23
|
+
* @param vector {@link Vector} that has the continuous attributes.
|
|
24
|
+
*/
|
|
25
|
+
addVectorAttribute(vector: Vector): void;
|
|
26
|
+
/**
|
|
27
|
+
* Removes attribute with the given index from the attributes list.
|
|
28
|
+
*
|
|
29
|
+
* @param index Index of the attribute to be removed.
|
|
30
|
+
*/
|
|
31
|
+
removeAttribute(index: number): void;
|
|
32
|
+
/**
|
|
33
|
+
* Removes all the attributes from the attributes list.
|
|
34
|
+
*/
|
|
35
|
+
removeAllAttributes(): void;
|
|
36
|
+
/**
|
|
37
|
+
* Accessor for a single attribute.
|
|
38
|
+
*
|
|
39
|
+
* @param index Index of the attribute to be accessed.
|
|
40
|
+
* @return Attribute with index 'index'.
|
|
41
|
+
*/
|
|
42
|
+
getAttribute(index: number): Attribute;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the number of attributes in the attributes list.
|
|
45
|
+
*
|
|
46
|
+
* @return Number of attributes in the attributes list.
|
|
47
|
+
*/
|
|
48
|
+
attributeSize(): number;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the number of continuous and discrete indexed attributes in the attributes list.
|
|
51
|
+
*
|
|
52
|
+
* @return Number of continuous and discrete indexed attributes in the attributes list.
|
|
53
|
+
*/
|
|
54
|
+
continuousAttributeSize(): number;
|
|
55
|
+
/**
|
|
56
|
+
* The continuousAttributes method creates a new {@link Array} result and it adds the continuous attributes of the
|
|
57
|
+
* attributes list and also it adds 1 for the discrete indexed attributes
|
|
58
|
+
* .
|
|
59
|
+
*
|
|
60
|
+
* @return result {@link Array} that has continuous and discrete indexed attributes.
|
|
61
|
+
*/
|
|
62
|
+
continuousAttributes(): Array<number>;
|
|
63
|
+
/**
|
|
64
|
+
* Accessor for the class label.
|
|
65
|
+
*
|
|
66
|
+
* @return Class label of the instance.
|
|
67
|
+
*/
|
|
68
|
+
getClassLabel(): string;
|
|
69
|
+
/**
|
|
70
|
+
* Converts instance to a {@link String}.
|
|
71
|
+
*
|
|
72
|
+
* @return A string of attributes separated with comma character.
|
|
73
|
+
*/
|
|
74
|
+
toString(): string;
|
|
75
|
+
/**
|
|
76
|
+
* The getSubSetOfFeatures method takes a {@link FeatureSubSet} as an input. First it creates a result {@link Instance}
|
|
77
|
+
* with the class label, and adds the attributes of the given featureSubSet to it.
|
|
78
|
+
*
|
|
79
|
+
* @param featureSubSet {@link FeatureSubSet} an {@link Array} of indices.
|
|
80
|
+
* @return result Instance.
|
|
81
|
+
*/
|
|
82
|
+
getSubSetOfFeatures(featureSubSet: FeatureSubSet): Instance;
|
|
83
|
+
/**
|
|
84
|
+
* The toVector method returns a {@link Vector} of continuous attributes and discrete indexed attributes.
|
|
85
|
+
*
|
|
86
|
+
* @return {@link Vector} of continuous attributes and discrete indexed attributes.
|
|
87
|
+
*/
|
|
88
|
+
toVector(): Vector;
|
|
89
|
+
}
|