SAMOA-9: Change namespace to apache.org. Fix #26
Project: http://git-wip-us.apache.org/repos/asf/incubator-samoa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-samoa/commit/9b178f63 Tree: http://git-wip-us.apache.org/repos/asf/incubator-samoa/tree/9b178f63 Diff: http://git-wip-us.apache.org/repos/asf/incubator-samoa/diff/9b178f63 Branch: refs/heads/master Commit: 9b178f63152e5b4c262e0f3ed28e77667832fc98 Parents: 64ef7a9 Author: Gianmarco De Francisci Morales <[email protected]> Authored: Thu Jun 18 14:23:52 2015 +0300 Committer: Gianmarco De Francisci Morales <[email protected]> Committed: Thu Jun 18 14:23:52 2015 +0300 ---------------------------------------------------------------------- bin/samoa | 12 +- bin/samza-kryo | 10 +- pom.xml | 2 +- samoa-api/pom.xml | 4 +- .../com/yahoo/labs/samoa/core/ContentEvent.java | 44 - .../com/yahoo/labs/samoa/core/DoubleVector.java | 119 -- .../labs/samoa/core/EntranceProcessor.java | 62 - .../java/com/yahoo/labs/samoa/core/Globals.java | 59 - .../com/yahoo/labs/samoa/core/Processor.java | 63 - .../labs/samoa/core/SerializableInstance.java | 68 - ...BasicClassificationPerformanceEvaluator.java | 157 -- .../BasicRegressionPerformanceEvaluator.java | 134 -- .../ClassificationPerformanceEvaluator.java | 24 - .../ClusteringEvaluationContentEvent.java | 85 - .../ClusteringEvaluatorProcessor.java | 321 --- .../ClusteringResultContentEvent.java | 75 - .../samoa/evaluation/EvaluatorProcessor.java | 233 -- .../samoa/evaluation/PerformanceEvaluator.java | 59 - .../RegressionPerformanceEvaluator.java | 25 - ...indowClassificationPerformanceEvaluator.java | 218 -- .../labs/samoa/evaluation/measures/CMM.java | 514 ----- .../evaluation/measures/CMM_GTAnalysis.java | 846 -------- .../evaluation/measures/EntropyCollection.java | 175 -- .../labs/samoa/evaluation/measures/F1.java | 110 - .../labs/samoa/evaluation/measures/General.java | 192 -- .../labs/samoa/evaluation/measures/SSQ.java | 97 - .../samoa/evaluation/measures/Separation.java | 118 -- .../measures/SilhouetteCoefficient.java | 126 -- .../measures/StatisticalCollection.java | 187 -- .../samoa/examples/HelloWorldContentEvent.java | 69 - .../HelloWorldDestinationProcessor.java | 49 - .../examples/HelloWorldSourceProcessor.java | 75 - .../labs/samoa/examples/HelloWorldTask.java | 100 - .../labs/samoa/learners/AdaptiveLearner.java | 52 - .../samoa/learners/ClassificationLearner.java | 27 - .../samoa/learners/InstanceContentEvent.java | 214 -- .../samoa/learners/InstancesContentEvent.java | 199 -- .../com/yahoo/labs/samoa/learners/Learner.java | 63 - .../labs/samoa/learners/RegressionLearner.java | 27 - .../labs/samoa/learners/ResultContentEvent.java | 213 -- .../learners/classifiers/LocalLearner.java | 76 - .../classifiers/LocalLearnerProcessor.java | 224 -- .../samoa/learners/classifiers/NaiveBayes.java | 265 --- .../classifiers/SimpleClassifierAdapter.java | 152 -- .../learners/classifiers/SingleClassifier.java | 110 - .../classifiers/ensemble/AdaptiveBagging.java | 151 -- .../learners/classifiers/ensemble/Bagging.java | 138 -- .../ensemble/BaggingDistributorProcessor.java | 207 -- .../learners/classifiers/ensemble/Boosting.java | 147 -- .../ensemble/BoostingDistributorProcessor.java | 35 - .../BoostingPredictionCombinerProcessor.java | 178 -- .../ensemble/PredictionCombinerProcessor.java | 187 -- .../classifiers/rules/AMRulesRegressor.java | 175 -- .../rules/HorizontalAMRulesRegressor.java | 238 --- .../rules/VerticalAMRulesRegressor.java | 199 -- .../centralized/AMRulesRegressorProcessor.java | 513 ----- .../classifiers/rules/common/ActiveRule.java | 228 -- .../classifiers/rules/common/LearningRule.java | 122 -- .../rules/common/NonLearningRule.java | 51 - .../classifiers/rules/common/PassiveRule.java | 70 - .../classifiers/rules/common/Perceptron.java | 486 ----- .../learners/classifiers/rules/common/Rule.java | 111 - .../rules/common/RuleActiveLearningNode.java | 33 - .../rules/common/RuleActiveRegressionNode.java | 331 --- .../rules/common/RulePassiveLearningNode.java | 32 - .../rules/common/RulePassiveRegressionNode.java | 75 - .../rules/common/RuleRegressionNode.java | 294 --- .../classifiers/rules/common/RuleSplitNode.java | 68 - .../classifiers/rules/common/TargetMean.java | 222 -- .../distributed/AMRDefaultRuleProcessor.java | 337 --- .../rules/distributed/AMRLearnerProcessor.java | 260 --- .../rules/distributed/AMRRuleSetProcessor.java | 372 ---- .../distributed/AMRulesAggregatorProcessor.java | 531 ----- .../distributed/AMRulesStatisticsProcessor.java | 220 -- .../distributed/AssignmentContentEvent.java | 74 - .../distributed/PredicateContentEvent.java | 84 - .../rules/distributed/RuleContentEvent.java | 80 - .../classifiers/trees/ActiveLearningNode.java | 208 -- .../trees/AttributeBatchContentEvent.java | 135 -- .../trees/AttributeContentEvent.java | 224 -- .../classifiers/trees/ComputeContentEvent.java | 145 -- .../classifiers/trees/ControlContentEvent.java | 72 - .../classifiers/trees/DeleteContentEvent.java | 47 - .../classifiers/trees/FilterProcessor.java | 191 -- .../learners/classifiers/trees/FoundNode.java | 77 - .../classifiers/trees/InactiveLearningNode.java | 54 - .../classifiers/trees/LearningNode.java | 59 - .../trees/LocalResultContentEvent.java | 95 - .../trees/LocalStatisticsProcessor.java | 244 --- .../trees/ModelAggregatorProcessor.java | 747 ------- .../samoa/learners/classifiers/trees/Node.java | 103 - .../learners/classifiers/trees/SplitNode.java | 117 -- .../trees/VerticalHoeffdingTree.java | 183 -- .../clusterers/ClusteringContentEvent.java | 90 - .../clusterers/ClustreamClustererAdapter.java | 170 -- .../clusterers/LocalClustererAdapter.java | 80 - .../clusterers/LocalClustererProcessor.java | 200 -- .../learners/clusterers/SingleLearner.java | 100 - .../simple/ClusteringDistributorProcessor.java | 100 - .../clusterers/simple/DistributedClusterer.java | 119 -- .../yahoo/labs/samoa/moa/AbstractMOAObject.java | 83 - .../com/yahoo/labs/samoa/moa/MOAObject.java | 58 - .../moa/classifiers/AbstractClassifier.java | 378 ---- .../labs/samoa/moa/classifiers/Classifier.java | 77 - .../labs/samoa/moa/classifiers/Regressor.java | 31 - .../core/AttributeSplitSuggestion.java | 69 - .../AttributeClassObserver.java | 79 - ...BinaryTreeNumericAttributeClassObserver.java | 183 -- ...NumericAttributeClassObserverRegression.java | 148 -- .../DiscreteAttributeClassObserver.java | 32 - .../FIMTDDNumericAttributeClassObserver.java | 250 --- .../GaussianNumericAttributeClassObserver.java | 182 -- ...waldKhannaNumericAttributeClassObserver.java | 127 -- .../NominalAttributeClassObserver.java | 177 -- .../NullAttributeClassObserver.java | 79 - .../NumericAttributeClassObserver.java | 32 - .../VFMLNumericAttributeClassObserver.java | 222 -- .../InstanceConditionalBinaryTest.java | 35 - .../InstanceConditionalTest.java | 79 - .../NominalAttributeBinaryTest.java | 73 - .../NominalAttributeMultiwayTest.java | 71 - .../NumericAttributeBinaryTest.java | 92 - .../classifiers/core/driftdetection/ADWIN.java | 590 ------ .../driftdetection/ADWINChangeDetector.java | 69 - .../driftdetection/AbstractChangeDetector.java | 141 -- .../core/driftdetection/ChangeDetector.java | 103 - .../core/driftdetection/CusumDM.java | 110 - .../classifiers/core/driftdetection/DDM.java | 118 -- .../classifiers/core/driftdetection/EDDM.java | 139 -- .../core/driftdetection/EWMAChartDM.java | 121 -- .../GeometricMovingAverageDM.java | 108 - .../core/driftdetection/PageHinkleyDM.java | 114 - .../core/splitcriteria/GiniSplitCriterion.java | 84 - .../splitcriteria/InfoGainSplitCriterion.java | 116 - .../InfoGainSplitCriterionMultilabel.java | 53 - .../core/splitcriteria/SDRSplitCriterion.java | 33 - .../core/splitcriteria/SplitCriterion.java | 55 - .../VarianceReductionSplitCriterion.java | 94 - .../classifiers/functions/MajorityClass.java | 84 - .../moa/classifiers/rules/core/Predicate.java | 33 - ...IMTDDNumericAttributeClassLimitObserver.java | 120 -- .../NumericAttributeBinaryRulePredicate.java | 180 -- .../splitcriteria/SDRSplitCriterionAMRules.java | 99 - .../core/voting/AbstractErrorWeightedVote.java | 101 - .../rules/core/voting/ErrorWeightedVote.java | 81 - .../core/voting/InverseErrorWeightedVote.java | 99 - .../rules/core/voting/UniformWeightedVote.java | 71 - .../rules/driftdetection/PageHinkleyFading.java | 84 - .../rules/driftdetection/PageHinkleyTest.java | 95 - .../yahoo/labs/samoa/moa/cluster/CFCluster.java | 176 -- .../yahoo/labs/samoa/moa/cluster/Cluster.java | 168 -- .../labs/samoa/moa/cluster/Clustering.java | 269 --- .../yahoo/labs/samoa/moa/cluster/Miniball.java | 84 - .../labs/samoa/moa/cluster/SphereCluster.java | 363 ---- .../samoa/moa/clusterers/AbstractClusterer.java | 298 --- .../samoa/moa/clusterers/ClusterGenerator.java | 356 ---- .../labs/samoa/moa/clusterers/Clusterer.java | 64 - .../yahoo/labs/samoa/moa/clusterers/KMeans.java | 198 -- .../moa/clusterers/clustream/Clustream.java | 331 --- .../clusterers/clustream/ClustreamKernel.java | 271 --- .../moa/clusterers/clustream/WithKmeans.java | 465 ---- .../labs/samoa/moa/core/AutoClassDiscovery.java | 196 -- .../labs/samoa/moa/core/AutoExpandVector.java | 133 -- .../yahoo/labs/samoa/moa/core/DataPoint.java | 133 -- .../yahoo/labs/samoa/moa/core/DoubleVector.java | 195 -- .../com/yahoo/labs/samoa/moa/core/Example.java | 30 - .../yahoo/labs/samoa/moa/core/FastVector.java | 68 - .../labs/samoa/moa/core/GaussianEstimator.java | 125 -- .../core/GreenwaldKhannaQuantileSummary.java | 281 --- .../moa/core/InputStreamProgressMonitor.java | 131 -- .../labs/samoa/moa/core/InstanceExample.java | 50 - .../yahoo/labs/samoa/moa/core/Measurement.java | 115 - .../yahoo/labs/samoa/moa/core/MiscUtils.java | 96 - .../labs/samoa/moa/core/ObjectRepository.java | 32 - .../labs/samoa/moa/core/SerializeUtils.java | 112 - .../yahoo/labs/samoa/moa/core/Statistics.java | 1107 ---------- .../yahoo/labs/samoa/moa/core/StringUtils.java | 96 - .../com/yahoo/labs/samoa/moa/core/Utils.java | 1982 ------------------ .../samoa/moa/evaluation/LearningCurve.java | 132 -- .../moa/evaluation/LearningEvaluation.java | 63 - .../LearningPerformanceEvaluator.java | 59 - .../samoa/moa/evaluation/MeasureCollection.java | 261 --- .../samoa/moa/evaluation/MembershipMatrix.java | 148 -- .../yahoo/labs/samoa/moa/learners/Learner.java | 130 -- .../samoa/moa/options/AbstractClassOption.java | 252 --- .../moa/options/AbstractOptionHandler.java | 166 -- .../labs/samoa/moa/options/ClassOption.java | 176 -- .../labs/samoa/moa/options/OptionHandler.java | 81 - .../labs/samoa/moa/options/OptionsHandler.java | 182 -- .../labs/samoa/moa/streams/ArffFileStream.java | 199 -- .../labs/samoa/moa/streams/ExampleStream.java | 76 - .../labs/samoa/moa/streams/InstanceStream.java | 34 - .../moa/streams/clustering/ClusterEvent.java | 49 - .../clustering/ClusterEventListener.java | 29 - .../streams/clustering/ClusteringStream.java | 53 - .../clustering/RandomRBFGeneratorEvents.java | 967 --------- .../streams/generators/HyperplaneGenerator.java | 185 -- .../streams/generators/RandomTreeGenerator.java | 267 --- .../yahoo/labs/samoa/moa/tasks/NullMonitor.java | 102 - .../samoa/moa/tasks/ResultPreviewListener.java | 37 - .../com/yahoo/labs/samoa/moa/tasks/Task.java | 60 - .../yahoo/labs/samoa/moa/tasks/TaskMonitor.java | 146 -- .../labs/samoa/streams/ArffFileStream.java | 119 -- .../streams/ClusteringEntranceProcessor.java | 253 --- .../yahoo/labs/samoa/streams/FileStream.java | 173 -- .../streams/PrequentialSourceProcessor.java | 232 -- .../yahoo/labs/samoa/streams/StreamSource.java | 92 - .../samoa/streams/StreamSourceProcessor.java | 195 -- .../labs/samoa/streams/fs/FileStreamSource.java | 64 - .../samoa/streams/fs/HDFSFileStreamSource.java | 150 -- .../samoa/streams/fs/LocalFileStreamSource.java | 133 -- .../labs/samoa/tasks/ClusteringEvaluation.java | 186 -- .../labs/samoa/tasks/PrequentialEvaluation.java | 220 -- .../java/com/yahoo/labs/samoa/tasks/Task.java | 59 - .../AbstractEntranceProcessingItem.java | 115 - .../samoa/topology/AbstractProcessingItem.java | 168 -- .../labs/samoa/topology/AbstractStream.java | 118 -- .../labs/samoa/topology/AbstractTopology.java | 133 -- .../labs/samoa/topology/ComponentFactory.java | 78 - .../samoa/topology/EntranceProcessingItem.java | 46 - .../labs/samoa/topology/IProcessingItem.java | 47 - .../yahoo/labs/samoa/topology/ISubmitter.java | 46 - .../topology/LocalEntranceProcessingItem.java | 81 - .../labs/samoa/topology/ProcessingItem.java | 68 - .../com/yahoo/labs/samoa/topology/Stream.java | 61 - .../com/yahoo/labs/samoa/topology/Topology.java | 82 - .../labs/samoa/topology/TopologyBuilder.java | 227 -- .../labs/samoa/utils/PartitioningScheme.java | 33 - .../labs/samoa/utils/StreamDestination.java | 62 - .../java/com/yahoo/labs/samoa/utils/Utils.java | 183 -- .../org/apache/samoa/core/ContentEvent.java | 44 + .../org/apache/samoa/core/DoubleVector.java | 119 ++ .../apache/samoa/core/EntranceProcessor.java | 62 + .../java/org/apache/samoa/core/Globals.java | 59 + .../java/org/apache/samoa/core/Processor.java | 63 + .../apache/samoa/core/SerializableInstance.java | 68 + ...BasicClassificationPerformanceEvaluator.java | 157 ++ .../BasicRegressionPerformanceEvaluator.java | 134 ++ .../ClassificationPerformanceEvaluator.java | 24 + .../ClusteringEvaluationContentEvent.java | 85 + .../ClusteringEvaluatorProcessor.java | 320 +++ .../ClusteringResultContentEvent.java | 75 + .../samoa/evaluation/EvaluatorProcessor.java | 231 ++ .../samoa/evaluation/PerformanceEvaluator.java | 58 + .../RegressionPerformanceEvaluator.java | 25 + ...indowClassificationPerformanceEvaluator.java | 219 ++ .../apache/samoa/evaluation/measures/CMM.java | 515 +++++ .../evaluation/measures/CMM_GTAnalysis.java | 847 ++++++++ .../evaluation/measures/EntropyCollection.java | 174 ++ .../apache/samoa/evaluation/measures/F1.java | 111 + .../samoa/evaluation/measures/General.java | 193 ++ .../apache/samoa/evaluation/measures/SSQ.java | 97 + .../samoa/evaluation/measures/Separation.java | 119 ++ .../measures/SilhouetteCoefficient.java | 126 ++ .../measures/StatisticalCollection.java | 187 ++ .../samoa/examples/HelloWorldContentEvent.java | 69 + .../HelloWorldDestinationProcessor.java | 49 + .../examples/HelloWorldSourceProcessor.java | 75 + .../apache/samoa/examples/HelloWorldTask.java | 100 + .../apache/samoa/learners/AdaptiveLearner.java | 52 + .../samoa/learners/ClassificationLearner.java | 27 + .../samoa/learners/InstanceContentEvent.java | 215 ++ .../samoa/learners/InstancesContentEvent.java | 201 ++ .../java/org/apache/samoa/learners/Learner.java | 63 + .../samoa/learners/RegressionLearner.java | 27 + .../samoa/learners/ResultContentEvent.java | 213 ++ .../learners/classifiers/LocalLearner.java | 76 + .../classifiers/LocalLearnerProcessor.java | 223 ++ .../samoa/learners/classifiers/NaiveBayes.java | 264 +++ .../classifiers/SimpleClassifierAdapter.java | 153 ++ .../learners/classifiers/SingleClassifier.java | 112 + .../classifiers/ensemble/AdaptiveBagging.java | 152 ++ .../learners/classifiers/ensemble/Bagging.java | 140 ++ .../ensemble/BaggingDistributorProcessor.java | 208 ++ .../learners/classifiers/ensemble/Boosting.java | 149 ++ .../ensemble/BoostingDistributorProcessor.java | 35 + .../BoostingPredictionCombinerProcessor.java | 178 ++ .../ensemble/PredictionCombinerProcessor.java | 187 ++ .../classifiers/rules/AMRulesRegressor.java | 177 ++ .../rules/HorizontalAMRulesRegressor.java | 240 +++ .../rules/VerticalAMRulesRegressor.java | 200 ++ .../centralized/AMRulesRegressorProcessor.java | 513 +++++ .../classifiers/rules/common/ActiveRule.java | 228 ++ .../classifiers/rules/common/LearningRule.java | 122 ++ .../rules/common/NonLearningRule.java | 51 + .../classifiers/rules/common/PassiveRule.java | 70 + .../classifiers/rules/common/Perceptron.java | 487 +++++ .../learners/classifiers/rules/common/Rule.java | 111 + .../rules/common/RuleActiveLearningNode.java | 33 + .../rules/common/RuleActiveRegressionNode.java | 331 +++ .../rules/common/RulePassiveLearningNode.java | 32 + .../rules/common/RulePassiveRegressionNode.java | 75 + .../rules/common/RuleRegressionNode.java | 294 +++ .../classifiers/rules/common/RuleSplitNode.java | 68 + .../classifiers/rules/common/TargetMean.java | 223 ++ .../distributed/AMRDefaultRuleProcessor.java | 336 +++ .../rules/distributed/AMRLearnerProcessor.java | 259 +++ .../rules/distributed/AMRRuleSetProcessor.java | 373 ++++ .../distributed/AMRulesAggregatorProcessor.java | 530 +++++ .../distributed/AMRulesStatisticsProcessor.java | 219 ++ .../distributed/AssignmentContentEvent.java | 74 + .../distributed/PredicateContentEvent.java | 84 + .../rules/distributed/RuleContentEvent.java | 80 + .../classifiers/trees/ActiveLearningNode.java | 206 ++ .../trees/AttributeBatchContentEvent.java | 136 ++ .../trees/AttributeContentEvent.java | 224 ++ .../classifiers/trees/ComputeContentEvent.java | 145 ++ .../classifiers/trees/ControlContentEvent.java | 72 + .../classifiers/trees/DeleteContentEvent.java | 47 + .../classifiers/trees/FilterProcessor.java | 191 ++ .../learners/classifiers/trees/FoundNode.java | 77 + .../classifiers/trees/InactiveLearningNode.java | 54 + .../classifiers/trees/LearningNode.java | 59 + .../trees/LocalResultContentEvent.java | 95 + .../trees/LocalStatisticsProcessor.java | 242 +++ .../trees/ModelAggregatorProcessor.java | 746 +++++++ .../samoa/learners/classifiers/trees/Node.java | 103 + .../learners/classifiers/trees/SplitNode.java | 117 ++ .../trees/VerticalHoeffdingTree.java | 185 ++ .../clusterers/ClusteringContentEvent.java | 90 + .../clusterers/ClustreamClustererAdapter.java | 171 ++ .../clusterers/LocalClustererAdapter.java | 81 + .../clusterers/LocalClustererProcessor.java | 200 ++ .../learners/clusterers/SingleLearner.java | 102 + .../simple/ClusteringDistributorProcessor.java | 100 + .../clusterers/simple/DistributedClusterer.java | 121 ++ .../org/apache/samoa/moa/AbstractMOAObject.java | 83 + .../java/org/apache/samoa/moa/MOAObject.java | 58 + .../moa/classifiers/AbstractClassifier.java | 379 ++++ .../samoa/moa/classifiers/Classifier.java | 77 + .../apache/samoa/moa/classifiers/Regressor.java | 31 + .../core/AttributeSplitSuggestion.java | 69 + .../AttributeClassObserver.java | 79 + ...BinaryTreeNumericAttributeClassObserver.java | 184 ++ ...NumericAttributeClassObserverRegression.java | 149 ++ .../DiscreteAttributeClassObserver.java | 32 + .../FIMTDDNumericAttributeClassObserver.java | 250 +++ .../GaussianNumericAttributeClassObserver.java | 182 ++ ...waldKhannaNumericAttributeClassObserver.java | 127 ++ .../NominalAttributeClassObserver.java | 176 ++ .../NullAttributeClassObserver.java | 79 + .../NumericAttributeClassObserver.java | 32 + .../VFMLNumericAttributeClassObserver.java | 222 ++ .../InstanceConditionalBinaryTest.java | 35 + .../InstanceConditionalTest.java | 79 + .../NominalAttributeBinaryTest.java | 73 + .../NominalAttributeMultiwayTest.java | 71 + .../NumericAttributeBinaryTest.java | 92 + .../classifiers/core/driftdetection/ADWIN.java | 590 ++++++ .../driftdetection/ADWINChangeDetector.java | 70 + .../driftdetection/AbstractChangeDetector.java | 141 ++ .../core/driftdetection/ChangeDetector.java | 103 + .../core/driftdetection/CusumDM.java | 111 + .../classifiers/core/driftdetection/DDM.java | 119 ++ .../classifiers/core/driftdetection/EDDM.java | 139 ++ .../core/driftdetection/EWMAChartDM.java | 122 ++ .../GeometricMovingAverageDM.java | 109 + .../core/driftdetection/PageHinkleyDM.java | 115 + .../core/splitcriteria/GiniSplitCriterion.java | 84 + .../splitcriteria/InfoGainSplitCriterion.java | 117 ++ .../InfoGainSplitCriterionMultilabel.java | 53 + .../core/splitcriteria/SDRSplitCriterion.java | 33 + .../core/splitcriteria/SplitCriterion.java | 55 + .../VarianceReductionSplitCriterion.java | 94 + .../classifiers/functions/MajorityClass.java | 84 + .../moa/classifiers/rules/core/Predicate.java | 33 + ...IMTDDNumericAttributeClassLimitObserver.java | 121 ++ .../NumericAttributeBinaryRulePredicate.java | 180 ++ .../splitcriteria/SDRSplitCriterionAMRules.java | 99 + .../core/voting/AbstractErrorWeightedVote.java | 101 + .../rules/core/voting/ErrorWeightedVote.java | 81 + .../core/voting/InverseErrorWeightedVote.java | 99 + .../rules/core/voting/UniformWeightedVote.java | 71 + .../rules/driftdetection/PageHinkleyFading.java | 84 + .../rules/driftdetection/PageHinkleyTest.java | 95 + .../org/apache/samoa/moa/cluster/CFCluster.java | 177 ++ .../org/apache/samoa/moa/cluster/Cluster.java | 168 ++ .../apache/samoa/moa/cluster/Clustering.java | 269 +++ .../org/apache/samoa/moa/cluster/Miniball.java | 84 + .../apache/samoa/moa/cluster/SphereCluster.java | 364 ++++ .../samoa/moa/clusterers/AbstractClusterer.java | 299 +++ .../samoa/moa/clusterers/ClusterGenerator.java | 358 ++++ .../apache/samoa/moa/clusterers/Clusterer.java | 64 + .../org/apache/samoa/moa/clusterers/KMeans.java | 199 ++ .../moa/clusterers/clustream/Clustream.java | 333 +++ .../clusterers/clustream/ClustreamKernel.java | 271 +++ .../moa/clusterers/clustream/WithKmeans.java | 466 ++++ .../samoa/moa/core/AutoClassDiscovery.java | 196 ++ .../apache/samoa/moa/core/AutoExpandVector.java | 133 ++ .../org/apache/samoa/moa/core/DataPoint.java | 133 ++ .../org/apache/samoa/moa/core/DoubleVector.java | 195 ++ .../java/org/apache/samoa/moa/core/Example.java | 30 + .../org/apache/samoa/moa/core/FastVector.java | 68 + .../samoa/moa/core/GaussianEstimator.java | 125 ++ .../core/GreenwaldKhannaQuantileSummary.java | 281 +++ .../moa/core/InputStreamProgressMonitor.java | 131 ++ .../apache/samoa/moa/core/InstanceExample.java | 51 + .../org/apache/samoa/moa/core/Measurement.java | 115 + .../org/apache/samoa/moa/core/MiscUtils.java | 96 + .../apache/samoa/moa/core/ObjectRepository.java | 32 + .../apache/samoa/moa/core/SerializeUtils.java | 112 + .../org/apache/samoa/moa/core/Statistics.java | 1107 ++++++++++ .../org/apache/samoa/moa/core/StringUtils.java | 96 + .../java/org/apache/samoa/moa/core/Utils.java | 1982 ++++++++++++++++++ .../samoa/moa/evaluation/LearningCurve.java | 132 ++ .../moa/evaluation/LearningEvaluation.java | 64 + .../LearningPerformanceEvaluator.java | 59 + .../samoa/moa/evaluation/MeasureCollection.java | 262 +++ .../samoa/moa/evaluation/MembershipMatrix.java | 149 ++ .../org/apache/samoa/moa/learners/Learner.java | 130 ++ .../samoa/moa/options/AbstractClassOption.java | 254 +++ .../moa/options/AbstractOptionHandler.java | 167 ++ .../apache/samoa/moa/options/ClassOption.java | 178 ++ .../apache/samoa/moa/options/OptionHandler.java | 82 + .../samoa/moa/options/OptionsHandler.java | 184 ++ .../samoa/moa/streams/ArffFileStream.java | 200 ++ .../apache/samoa/moa/streams/ExampleStream.java | 76 + .../samoa/moa/streams/InstanceStream.java | 34 + .../moa/streams/clustering/ClusterEvent.java | 49 + .../clustering/ClusterEventListener.java | 29 + .../streams/clustering/ClusteringStream.java | 54 + .../clustering/RandomRBFGeneratorEvents.java | 968 +++++++++ .../streams/generators/HyperplaneGenerator.java | 186 ++ .../streams/generators/RandomTreeGenerator.java | 267 +++ .../org/apache/samoa/moa/tasks/NullMonitor.java | 102 + .../samoa/moa/tasks/ResultPreviewListener.java | 37 + .../java/org/apache/samoa/moa/tasks/Task.java | 60 + .../org/apache/samoa/moa/tasks/TaskMonitor.java | 146 ++ .../apache/samoa/streams/ArffFileStream.java | 120 ++ .../streams/ClusteringEntranceProcessor.java | 252 +++ .../org/apache/samoa/streams/FileStream.java | 174 ++ .../streams/PrequentialSourceProcessor.java | 231 ++ .../org/apache/samoa/streams/StreamSource.java | 92 + .../samoa/streams/StreamSourceProcessor.java | 194 ++ .../samoa/streams/fs/FileStreamSource.java | 64 + .../samoa/streams/fs/HDFSFileStreamSource.java | 150 ++ .../samoa/streams/fs/LocalFileStreamSource.java | 133 ++ .../samoa/tasks/ClusteringEvaluation.java | 186 ++ .../samoa/tasks/PrequentialEvaluation.java | 220 ++ .../main/java/org/apache/samoa/tasks/Task.java | 59 + .../AbstractEntranceProcessingItem.java | 115 + .../samoa/topology/AbstractProcessingItem.java | 168 ++ .../apache/samoa/topology/AbstractStream.java | 118 ++ .../apache/samoa/topology/AbstractTopology.java | 133 ++ .../apache/samoa/topology/ComponentFactory.java | 78 + .../samoa/topology/EntranceProcessingItem.java | 46 + .../apache/samoa/topology/IProcessingItem.java | 47 + .../org/apache/samoa/topology/ISubmitter.java | 46 + .../topology/LocalEntranceProcessingItem.java | 81 + .../apache/samoa/topology/ProcessingItem.java | 68 + .../java/org/apache/samoa/topology/Stream.java | 61 + .../org/apache/samoa/topology/Topology.java | 82 + .../apache/samoa/topology/TopologyBuilder.java | 228 ++ .../apache/samoa/utils/PartitioningScheme.java | 33 + .../apache/samoa/utils/StreamDestination.java | 62 + .../main/java/org/apache/samoa/utils/Utils.java | 183 ++ .../yahoo/labs/samoa/core/DoubleVectorTest.java | 97 - .../streams/fs/HDFSFileStreamSourceTest.java | 306 --- .../streams/fs/LocalFileStreamSourceTest.java | 276 --- .../org/apache/samoa/core/DoubleVectorTest.java | 98 + .../streams/fs/HDFSFileStreamSourceTest.java | 307 +++ .../streams/fs/LocalFileStreamSourceTest.java | 277 +++ samoa-flink/pom.xml | 6 +- .../java/com/yahoo/labs/flink/FlinkDoTask.java | 87 - .../labs/flink/helpers/CircleDetection.java | 99 - .../com/yahoo/labs/flink/helpers/Utils.java | 69 - .../flink/topology/impl/FlinkComponent.java | 68 - .../topology/impl/FlinkComponentFactory.java | 66 - .../impl/FlinkEntranceProcessingItem.java | 101 - .../topology/impl/FlinkProcessingItem.java | 248 --- .../labs/flink/topology/impl/FlinkStream.java | 94 - .../labs/flink/topology/impl/FlinkTopology.java | 185 -- .../labs/flink/topology/impl/SamoaType.java | 42 - .../org/apache/samoa/flink/FlinkDoTask.java | 88 + .../samoa/flink/helpers/CircleDetection.java | 99 + .../org/apache/samoa/flink/helpers/Utils.java | 69 + .../flink/topology/impl/FlinkComponent.java | 68 + .../topology/impl/FlinkComponentFactory.java | 66 + .../impl/FlinkEntranceProcessingItem.java | 101 + .../topology/impl/FlinkProcessingItem.java | 249 +++ .../samoa/flink/topology/impl/FlinkStream.java | 94 + .../flink/topology/impl/FlinkTopology.java | 186 ++ .../samoa/flink/topology/impl/SamoaType.java | 42 + samoa-instances/pom.xml | 2 +- .../yahoo/labs/samoa/instances/ArffLoader.java | 396 ---- .../yahoo/labs/samoa/instances/Attribute.java | 211 -- .../labs/samoa/instances/DenseInstance.java | 74 - .../labs/samoa/instances/DenseInstanceData.java | 97 - .../yahoo/labs/samoa/instances/Instance.java | 93 - .../labs/samoa/instances/InstanceData.java | 55 - .../samoa/instances/InstanceInformation.java | 108 - .../yahoo/labs/samoa/instances/Instances.java | 244 --- .../labs/samoa/instances/InstancesHeader.java | 123 -- .../instances/SingleClassInstanceData.java | 86 - .../samoa/instances/SingleLabelInstance.java | 260 --- .../labs/samoa/instances/SparseInstance.java | 50 - .../samoa/instances/SparseInstanceData.java | 171 -- .../com/yahoo/labs/samoa/instances/Utils.java | 91 - .../org/apache/samoa/instances/ArffLoader.java | 396 ++++ .../org/apache/samoa/instances/Attribute.java | 211 ++ .../apache/samoa/instances/DenseInstance.java | 74 + .../samoa/instances/DenseInstanceData.java | 97 + .../org/apache/samoa/instances/Instance.java | 93 + .../apache/samoa/instances/InstanceData.java | 55 + .../samoa/instances/InstanceInformation.java | 108 + .../org/apache/samoa/instances/Instances.java | 244 +++ .../apache/samoa/instances/InstancesHeader.java | 123 ++ .../instances/SingleClassInstanceData.java | 86 + .../samoa/instances/SingleLabelInstance.java | 260 +++ .../apache/samoa/instances/SparseInstance.java | 50 + .../samoa/instances/SparseInstanceData.java | 171 ++ .../java/org/apache/samoa/instances/Utils.java | 91 + .../labs/samoa/instances/ArffLoaderTest.java | 108 - .../apache/samoa/instances/ArffLoaderTest.java | 111 + samoa-local/pom.xml | 6 +- .../java/com/yahoo/labs/samoa/LocalDoTask.java | 90 - .../topology/impl/SimpleComponentFactory.java | 53 - .../labs/samoa/topology/impl/SimpleEngine.java | 37 - .../impl/SimpleEntranceProcessingItem.java | 33 - .../topology/impl/SimpleProcessingItem.java | 87 - .../labs/samoa/topology/impl/SimpleStream.java | 95 - .../samoa/topology/impl/SimpleTopology.java | 46 - .../main/java/org/apache/samoa/LocalDoTask.java | 90 + .../topology/impl/SimpleComponentFactory.java | 53 + .../samoa/topology/impl/SimpleEngine.java | 37 + .../impl/SimpleEntranceProcessingItem.java | 33 + .../topology/impl/SimpleProcessingItem.java | 87 + .../samoa/topology/impl/SimpleStream.java | 95 + .../samoa/topology/impl/SimpleTopology.java | 46 + .../java/com/yahoo/labs/samoa/AlgosTest.java | 86 - .../impl/SimpleComponentFactoryTest.java | 99 - .../samoa/topology/impl/SimpleEngineTest.java | 60 - .../impl/SimpleEntranceProcessingItemTest.java | 172 -- .../topology/impl/SimpleProcessingItemTest.java | 124 -- .../samoa/topology/impl/SimpleStreamTest.java | 121 -- .../samoa/topology/impl/SimpleTopologyTest.java | 94 - .../test/java/org/apache/samoa/AlgosTest.java | 87 + .../impl/SimpleComponentFactoryTest.java | 103 + .../samoa/topology/impl/SimpleEngineTest.java | 62 + .../impl/SimpleEntranceProcessingItemTest.java | 172 ++ .../topology/impl/SimpleProcessingItemTest.java | 125 ++ .../samoa/topology/impl/SimpleStreamTest.java | 122 ++ .../samoa/topology/impl/SimpleTopologyTest.java | 97 + samoa-s4/pom.xml | 6 +- samoa-s4/samoa-s4-adapter/pom.xml | 10 +- .../samoa/topology/impl/S4ComponentFactory.java | 98 - .../labs/samoa/topology/impl/S4DoTask.java | 268 --- .../topology/impl/S4EntranceProcessingItem.java | 120 -- .../yahoo/labs/samoa/topology/impl/S4Event.java | 92 - .../samoa/topology/impl/S4ProcessingItem.java | 187 -- .../labs/samoa/topology/impl/S4Stream.java | 185 -- .../labs/samoa/topology/impl/S4Submitter.java | 145 -- .../labs/samoa/topology/impl/S4Topology.java | 63 - .../samoa/topology/impl/SamoaSerializer.java | 99 - .../topology/impl/SamoaSerializerModule.java | 35 - .../samoa/topology/impl/S4ComponentFactory.java | 97 + .../apache/samoa/topology/impl/S4DoTask.java | 268 +++ .../topology/impl/S4EntranceProcessingItem.java | 119 ++ .../org/apache/samoa/topology/impl/S4Event.java | 91 + .../samoa/topology/impl/S4ProcessingItem.java | 186 ++ .../apache/samoa/topology/impl/S4Stream.java | 184 ++ .../apache/samoa/topology/impl/S4Submitter.java | 144 ++ .../apache/samoa/topology/impl/S4Topology.java | 63 + .../samoa/topology/impl/SamoaSerializer.java | 99 + .../topology/impl/SamoaSerializerModule.java | 35 + samoa-samza/pom.xml | 4 +- .../java/com/yahoo/labs/samoa/SamzaDoTask.java | 226 -- .../samoa/topology/impl/SamoaSystemFactory.java | 55 - .../topology/impl/SamzaComponentFactory.java | 62 - .../labs/samoa/topology/impl/SamzaEngine.java | 195 -- .../impl/SamzaEntranceProcessingItem.java | 229 -- .../topology/impl/SamzaProcessingItem.java | 167 -- .../topology/impl/SamzaProcessingNode.java | 58 - .../labs/samoa/topology/impl/SamzaStream.java | 246 --- .../labs/samoa/topology/impl/SamzaTopology.java | 64 - .../labs/samoa/utils/SamzaConfigFactory.java | 539 ----- .../labs/samoa/utils/SamzaKryoSerdeFactory.java | 158 -- .../samoa/utils/SerializableSerializer.java | 70 - .../yahoo/labs/samoa/utils/SystemsUtils.java | 386 ---- .../main/java/org/apache/samoa/SamzaDoTask.java | 226 ++ .../samoa/topology/impl/SamoaSystemFactory.java | 54 + .../topology/impl/SamzaComponentFactory.java | 62 + .../apache/samoa/topology/impl/SamzaEngine.java | 194 ++ .../impl/SamzaEntranceProcessingItem.java | 228 ++ .../topology/impl/SamzaProcessingItem.java | 166 ++ .../topology/impl/SamzaProcessingNode.java | 58 + .../apache/samoa/topology/impl/SamzaStream.java | 245 +++ .../samoa/topology/impl/SamzaTopology.java | 64 + .../apache/samoa/utils/SamzaConfigFactory.java | 538 +++++ .../samoa/utils/SamzaKryoSerdeFactory.java | 158 ++ .../samoa/utils/SerializableSerializer.java | 70 + .../org/apache/samoa/utils/SystemsUtils.java | 386 ++++ samoa-samza/src/main/resources/log4j.xml | 2 +- samoa-storm/pom.xml | 6 +- .../com/yahoo/labs/samoa/LocalStormDoTask.java | 79 - .../samoa/topology/impl/StormBoltStream.java | 66 - .../topology/impl/StormComponentFactory.java | 90 - .../labs/samoa/topology/impl/StormDoTask.java | 118 -- .../impl/StormEntranceProcessingItem.java | 212 -- .../samoa/topology/impl/StormJarSubmitter.java | 75 - .../topology/impl/StormProcessingItem.java | 169 -- .../samoa/topology/impl/StormSamoaUtils.java | 109 - .../samoa/topology/impl/StormSpoutStream.java | 65 - .../labs/samoa/topology/impl/StormStream.java | 86 - .../labs/samoa/topology/impl/StormTopology.java | 53 - .../samoa/topology/impl/StormTopologyNode.java | 37 - .../topology/impl/StormTopologySubmitter.java | 132 -- .../java/org/apache/samoa/LocalStormDoTask.java | 78 + .../samoa/topology/impl/StormBoltStream.java | 67 + .../topology/impl/StormComponentFactory.java | 90 + .../apache/samoa/topology/impl/StormDoTask.java | 118 ++ .../impl/StormEntranceProcessingItem.java | 212 ++ .../samoa/topology/impl/StormJarSubmitter.java | 75 + .../topology/impl/StormProcessingItem.java | 169 ++ .../samoa/topology/impl/StormSamoaUtils.java | 109 + .../samoa/topology/impl/StormSpoutStream.java | 66 + .../apache/samoa/topology/impl/StormStream.java | 86 + .../samoa/topology/impl/StormTopology.java | 53 + .../samoa/topology/impl/StormTopologyNode.java | 37 + .../topology/impl/StormTopologySubmitter.java | 132 ++ .../java/com/yahoo/labs/samoa/AlgosTest.java | 66 - .../topology/impl/StormProcessingItemTest.java | 82 - .../test/java/org/apache/samoa/AlgosTest.java | 69 + .../topology/impl/StormProcessingItemTest.java | 83 + samoa-test/pom.xml | 4 +- .../java/com/yahoo/labs/samoa/TestParams.java | 234 --- .../java/com/yahoo/labs/samoa/TestUtils.java | 152 -- .../test/java/org/apache/samoa/TestParams.java | 234 +++ .../test/java/org/apache/samoa/TestUtils.java | 152 ++ samoa-threads/pom.xml | 6 +- .../yahoo/labs/samoa/LocalThreadsDoTask.java | 70 - .../topology/impl/ThreadsComponentFactory.java | 65 - .../labs/samoa/topology/impl/ThreadsEngine.java | 101 - .../impl/ThreadsEntranceProcessingItem.java | 41 - .../topology/impl/ThreadsEventRunnable.java | 61 - .../topology/impl/ThreadsProcessingItem.java | 103 - .../impl/ThreadsProcessingItemInstance.java | 54 - .../labs/samoa/topology/impl/ThreadsStream.java | 109 - .../samoa/topology/impl/ThreadsTopology.java | 65 - .../org/apache/samoa/LocalThreadsDoTask.java | 70 + .../topology/impl/ThreadsComponentFactory.java | 65 + .../samoa/topology/impl/ThreadsEngine.java | 101 + .../impl/ThreadsEntranceProcessingItem.java | 41 + .../topology/impl/ThreadsEventRunnable.java | 61 + .../topology/impl/ThreadsProcessingItem.java | 103 + .../impl/ThreadsProcessingItemInstance.java | 54 + .../samoa/topology/impl/ThreadsStream.java | 108 + .../samoa/topology/impl/ThreadsTopology.java | 65 + .../java/com/yahoo/labs/samoa/AlgosTest.java | 67 - .../impl/ThreadsComponentFactoryTest.java | 117 -- .../samoa/topology/impl/ThreadsEngineTest.java | 133 -- .../impl/ThreadsEntranceProcessingItemTest.java | 151 -- .../topology/impl/ThreadsEventRunnableTest.java | 71 - .../impl/ThreadsProcessingItemInstanceTest.java | 71 - .../impl/ThreadsProcessingItemTest.java | 180 -- .../samoa/topology/impl/ThreadsStreamTest.java | 135 -- .../topology/impl/ThreadsTopologyTest.java | 87 - .../labs/samoa/utils/StreamDestinationTest.java | 82 - .../test/java/org/apache/samoa/AlgosTest.java | 70 + .../impl/ThreadsComponentFactoryTest.java | 121 ++ .../samoa/topology/impl/ThreadsEngineTest.java | 135 ++ .../impl/ThreadsEntranceProcessingItemTest.java | 151 ++ .../topology/impl/ThreadsEventRunnableTest.java | 72 + .../impl/ThreadsProcessingItemInstanceTest.java | 71 + .../impl/ThreadsProcessingItemTest.java | 184 ++ .../samoa/topology/impl/ThreadsStreamTest.java | 136 ++ .../topology/impl/ThreadsTopologyTest.java | 88 + .../samoa/utils/StreamDestinationTest.java | 81 + 668 files changed, 49246 insertions(+), 49170 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/bin/samoa ---------------------------------------------------------------------- diff --git a/bin/samoa b/bin/samoa index 0ace74b..1a0ff15 100755 --- a/bin/samoa +++ b/bin/samoa @@ -144,7 +144,7 @@ if [ $PLATFORM = 'S4' ]; then # END Reading properties file APP_NAME="SamoaS4App" - APP_CLASS="com.yahoo.labs.samoa.topology.impl.S4DoTask" + APP_CLASS="org.apache.samoa.topology.impl.S4DoTask" NAMED_PARAMETERS=$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$OPTIONS") echo "Deploying SAMOA..." @@ -199,10 +199,10 @@ elif [ $PLATFORM = 'STORM' ]; then DEPLOYABLE=$JAR_PATH if [ "$MODE_ARG" = "cluster" ]; then - $STORM_EXEC jar $DEPLOYABLE com.yahoo.labs.samoa.topology.impl.StormDoTask $COMPLETE_ARG $NUM_WORKER $MODE_ARG + $STORM_EXEC jar $DEPLOYABLE org.apache.samoa.topology.impl.StormDoTask $COMPLETE_ARG $NUM_WORKER $MODE_ARG elif [ "$MODE_ARG" = "local" ]; then CLASSPATH="$CLASSPATH:$STORM_HOME/lib/*:$DEPLOYABLE" - java -cp $CLASSPATH com.yahoo.labs.samoa.LocalStormDoTask $COMPLETE_ARG $NUM_WORKER + java -cp $CLASSPATH org.apache.samoa.LocalStormDoTask $COMPLETE_ARG $NUM_WORKER fi elif [ $PLATFORM = 'SAMZA' ]; then @@ -274,7 +274,7 @@ elif [ $PLATFORM = 'SAMZA' ]; then done DEPLOYABLE=$JAR_PATH - java -Dsamza.log.dir=$BASE_DIR/logs -Dsamza.container.name=client -cp $DEPLOYABLE com.yahoo.labs.samoa.SamzaDoTask $COMPLETE_ARG --mode=$MODE_ARG \ + java -Dsamza.log.dir=$BASE_DIR/logs -Dsamza.container.name=client -cp $DEPLOYABLE org.apache.samoa.SamzaDoTask $COMPLETE_ARG --mode=$MODE_ARG \ --yarn_home=$YARN_HOME/conf --zookeeper=$ZOOKEEPER_HOST:$ZOOKEEPER_PORT --kafka=$KAFKA_BROKER_LIST \ --jar_package=$JAR_PATH --yarn_am_mem=$YARN_AM_MEMORY --yarn_container_mem=$YARN_CONTAINER_MEMORY \ --kafka_replication_factor=$KAFKA_REPLICATION_FACTOR --checkpoint_frequency=$CHECKPOINT_FREQUENCY \ @@ -354,7 +354,7 @@ elif [ $PLATFORM = 'THREADS' ]; then fi done - java $JAVA_OPTS -cp $JAR_PATH com.yahoo.labs.samoa.LocalThreadsDoTask $COMPLETE_ARG + java $JAVA_OPTS -cp $JAR_PATH org.apache.samoa.LocalThreadsDoTask $COMPLETE_ARG elif [ $PLATFORM = 'LOCAL' ]; then @@ -369,7 +369,7 @@ elif [ $PLATFORM = 'LOCAL' ]; then fi done - java $JAVA_OPTS -cp $JAR_PATH com.yahoo.labs.samoa.LocalDoTask $COMPLETE_ARG $NUM_WORKER $MODE_ARG + java $JAVA_OPTS -cp $JAR_PATH org.apache.samoa.LocalDoTask $COMPLETE_ARG $NUM_WORKER $MODE_ARG else echo "Specify a valid platform." echo "Usage: samoa <platform> <jar> <task & options>" http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/bin/samza-kryo ---------------------------------------------------------------------- diff --git a/bin/samza-kryo b/bin/samza-kryo index 2857a40..ee2cad4 100644 --- a/bin/samza-kryo +++ b/bin/samza-kryo @@ -1,6 +1,6 @@ -com.yahoo.labs.samoa.learners.classifiers.trees.AttributeContentEvent:com.yahoo.labs.samoa.learners.classifiers.trees.AttributeContentEvent$AttributeCEFullPrecSerializer -com.yahoo.labs.samoa.learners.classifiers.trees.ComputeContentEvent:com.yahoo.labs.samoa.learners.classifiers.trees.ComputeContentEvent$ComputeCEFullPrecSerializer -com.yahoo.labs.samoa.moa.classifiers.core.AttributeSplitSuggestion:com.yahoo.labs.samoa.utils.SerializableSerializer +org.apache.samoa.learners.classifiers.trees.AttributeContentEvent:org.apache.samoa.learners.classifiers.trees.AttributeContentEvent$AttributeCEFullPrecSerializer +org.apache.samoa.learners.classifiers.trees.ComputeContentEvent:org.apache.samoa.learners.classifiers.trees.ComputeContentEvent$ComputeCEFullPrecSerializer +org.apache.samoa.moa.classifiers.core.AttributeSplitSuggestion:org.apache.samoa.utils.SerializableSerializer -com.yahoo.labs.samoa.learners.classifiers.rules.common.TargetMean:com.yahoo.labs.samoa.learners.classifiers.rules.common.TargetMean$TargetMeanSerializer -com.yahoo.labs.samoa.learners.classifiers.rules.common.Perceptron:com.yahoo.labs.samoa.learners.classifiers.rules.common.Perceptron$PerceptronSerializer +org.apache.samoa.learners.classifiers.rules.common.TargetMean:org.apache.samoa.learners.classifiers.rules.common.TargetMean$TargetMeanSerializer +org.apache.samoa.learners.classifiers.rules.common.Perceptron:org.apache.samoa.learners.classifiers.rules.common.Perceptron$PerceptronSerializer http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 819a13c..1599c3f 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ </modules> <packaging>pom</packaging> - <groupId>com.yahoo.labs.samoa</groupId> + <groupId>org.apache.samoa</groupId> <artifactId>samoa</artifactId> <version>0.3.0-SNAPSHOT</version> http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/samoa-api/pom.xml ---------------------------------------------------------------------- diff --git a/samoa-api/pom.xml b/samoa-api/pom.xml index de6a73d..89d1fa2 100644 --- a/samoa-api/pom.xml +++ b/samoa-api/pom.xml @@ -31,7 +31,7 @@ <artifactId>samoa-api</artifactId> <parent> - <groupId>com.yahoo.labs.samoa</groupId> + <groupId>org.apache.samoa</groupId> <artifactId>samoa</artifactId> <version>0.3.0-SNAPSHOT</version> </parent> @@ -62,7 +62,7 @@ </dependency> <dependency> - <groupId>com.yahoo.labs.samoa</groupId> + <groupId>org.apache.samoa</groupId> <artifactId>samoa-instances</artifactId> <version>${project.version}</version> </dependency> http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/samoa-api/src/main/java/com/yahoo/labs/samoa/core/ContentEvent.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/core/ContentEvent.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/core/ContentEvent.java deleted file mode 100644 index 0d88398..0000000 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/core/ContentEvent.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.yahoo.labs.samoa.core; - -/* - * #%L - * SAMOA - * %% - * Copyright (C) 2014 - 2015 Apache Software Foundation - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -/** - * The Interface ContentEvent. - */ -public interface ContentEvent extends java.io.Serializable { - - /** - * Gets the content event key. - * - * @return the key - */ - public String getKey(); - - /** - * Sets the content event key. - * - * @param key - * string - */ - public void setKey(String key); - - public boolean isLastEvent(); -} http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/samoa-api/src/main/java/com/yahoo/labs/samoa/core/DoubleVector.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/core/DoubleVector.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/core/DoubleVector.java deleted file mode 100644 index 96b6c43..0000000 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/core/DoubleVector.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.yahoo.labs.samoa.core; - -/* - * #%L - * SAMOA - * %% - * Copyright (C) 2014 - 2015 Apache Software Foundation - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.util.Arrays; - -import com.google.common.primitives.Doubles; - -public class DoubleVector implements java.io.Serializable { - - /** - * - */ - private static final long serialVersionUID = 8243012708860261398L; - - private double[] doubleArray; - - public DoubleVector() { - this.doubleArray = new double[0]; - } - - public DoubleVector(double[] toCopy) { - this.doubleArray = new double[toCopy.length]; - System.arraycopy(toCopy, 0, this.doubleArray, 0, toCopy.length); - } - - public DoubleVector(DoubleVector toCopy) { - this(toCopy.getArrayRef()); - } - - public double[] getArrayRef() { - return this.doubleArray; - } - - public double[] getArrayCopy() { - return Doubles.concat(this.doubleArray); - } - - public int numNonZeroEntries() { - int count = 0; - for (double element : this.doubleArray) { - if (Double.compare(element, 0.0) != 0) { - count++; - } - } - return count; - } - - public void setValue(int index, double value) { - if (index >= doubleArray.length) { - this.doubleArray = Doubles.ensureCapacity(this.doubleArray, index + 1, 0); - } - this.doubleArray[index] = value; - } - - public void addToValue(int index, double value) { - if (index >= doubleArray.length) { - this.doubleArray = Doubles.ensureCapacity(this.doubleArray, index + 1, 0); - } - this.doubleArray[index] += value; - } - - public double sumOfValues() { - double sum = 0.0; - for (double element : this.doubleArray) { - sum += element; - } - return sum; - } - - public void getSingleLineDescription(StringBuilder out) { - out.append("{"); - out.append(Doubles.join("|", this.doubleArray)); - out.append("}"); - } - - @Override - public String toString() { - return "DoubleVector [doubleArray=" + Arrays.toString(doubleArray) + "]"; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + Arrays.hashCode(doubleArray); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (!(obj instanceof DoubleVector)) - return false; - DoubleVector other = (DoubleVector) obj; - return Arrays.equals(doubleArray, other.doubleArray); - } -} http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/samoa-api/src/main/java/com/yahoo/labs/samoa/core/EntranceProcessor.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/core/EntranceProcessor.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/core/EntranceProcessor.java deleted file mode 100644 index 1b0cfb3..0000000 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/core/EntranceProcessor.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.yahoo.labs.samoa.core; - -/* - * #%L - * SAMOA - * %% - * Copyright (C) 2014 - 2015 Apache Software Foundation - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.io.Serializable; - -import com.github.javacliparser.Configurable; - -/** - * An EntranceProcessor is a specific kind of processor dedicated to providing events to inject in the topology. It can - * be connected to a single output stream. - */ -public interface EntranceProcessor extends Serializable, Configurable, Processor { - - /** - * Initializes the Processor. This method is called once after the topology is set up and before any call to the - * {@link nextTuple} method. - * - * @param the - * identifier of the processor. - */ - public void onCreate(int id); - - /** - * Checks whether the source stream is finished/exhausted. - */ - public boolean isFinished(); - - /** - * Checks whether a new event is ready to be processed. - * - * @return true if the EntranceProcessor is ready to provide the next event, false otherwise. - */ - public boolean hasNext(); - - /** - * Provides the next tuple to be processed by the topology. This method is the entry point for external events into - * the topology. - * - * @return the next event to be processed. - */ - public ContentEvent nextEvent(); - -} http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/samoa-api/src/main/java/com/yahoo/labs/samoa/core/Globals.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/core/Globals.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/core/Globals.java deleted file mode 100644 index c333b8e..0000000 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/core/Globals.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.yahoo.labs.samoa.core; - -/* - * #%L - * SAMOA - * %% - * Copyright (C) 2014 - 2015 Apache Software Foundation - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -/** - * License - */ - -import com.github.javacliparser.StringUtils; - -/** - * Class for storing global information about current version of SAMOA. - * - * @author Albert Bifet - * @version $Revision: 7 $ - */ -public class Globals { - - public static final String workbenchTitle = "SAMOA: Scalable Advanced Massive Online Analysis Platform "; - - public static final String versionString = "0.0.1"; - - public static final String copyrightNotice = "Copyright Yahoo! Inc 2013"; - - public static final String webAddress = "http://github.com/yahoo/samoa"; - - public static String getWorkbenchInfoString() { - StringBuilder result = new StringBuilder(); - result.append(workbenchTitle); - StringUtils.appendNewline(result); - result.append("Version: "); - result.append(versionString); - StringUtils.appendNewline(result); - result.append("Copyright: "); - result.append(copyrightNotice); - StringUtils.appendNewline(result); - result.append("Web: "); - result.append(webAddress); - return result.toString(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/samoa-api/src/main/java/com/yahoo/labs/samoa/core/Processor.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/core/Processor.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/core/Processor.java deleted file mode 100644 index 4e783bd..0000000 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/core/Processor.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.yahoo.labs.samoa.core; - -/* - * #%L - * SAMOA - * %% - * Copyright (C) 2014 - 2015 Apache Software Foundation - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.io.Serializable; - -import com.github.javacliparser.Configurable; - -/** - * The Interface Processor. - */ -public interface Processor extends Serializable, Configurable { - - /** - * Entry point for the {@link Processor} code. This method is called once for every event received. - * - * @param event - * the event to be processed. - * @return true if successful, false otherwise. - */ - boolean process(ContentEvent event); - - /** - * Initializes the Processor. This method is called once after the topology is set up and before any call to the - * {@link process} method. - * - * @param id - * the identifier of the processor. - */ - void onCreate(int id); - - /** - * Creates a copy of a processor. This method is used to instantiate multiple instances of the same {@link Processsor} - * . - * - * @param processor - * the processor to be copied. - * - * @return a new instance of the {@link Processor}. - * */ - Processor newProcessor(Processor processor); // FIXME there should be no need - // for the processor as a - // parameter - // TODO can we substitute this with Cloneable? -} http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/samoa-api/src/main/java/com/yahoo/labs/samoa/core/SerializableInstance.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/core/SerializableInstance.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/core/SerializableInstance.java deleted file mode 100644 index cc888cc..0000000 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/core/SerializableInstance.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.yahoo.labs.samoa.core; - -/* - * #%L - * SAMOA - * %% - * Copyright (C) 2014 - 2015 Apache Software Foundation - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import com.yahoo.labs.samoa.instances.DenseInstance; -import com.yahoo.labs.samoa.instances.Instance; - -/** - * License - */ - -//import weka.core.DenseInstance; -//import weka.core.Instance; - -/** - * The Class SerializableInstance. This class is needed for serialization of kryo - */ -public class SerializableInstance extends DenseInstance { - - /** The Constant serialVersionUID. */ - private static final long serialVersionUID = -3659459626274566468L; - - /** - * Instantiates a new serializable instance. - */ - public SerializableInstance() { - super(0); - } - - /** - * Instantiates a new serializable instance. - * - * @param arg0 - * the arg0 - */ - public SerializableInstance(int arg0) { - super(arg0); - } - - /** - * Instantiates a new serializable instance. - * - * @param inst - * the inst - */ - public SerializableInstance(Instance inst) { - super(inst); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/BasicClassificationPerformanceEvaluator.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/BasicClassificationPerformanceEvaluator.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/BasicClassificationPerformanceEvaluator.java deleted file mode 100644 index 6a03e1d..0000000 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/BasicClassificationPerformanceEvaluator.java +++ /dev/null @@ -1,157 +0,0 @@ -package com.yahoo.labs.samoa.evaluation; - -/* - * #%L - * SAMOA - * %% - * Copyright (C) 2014 - 2015 Apache Software Foundation - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import com.yahoo.labs.samoa.moa.AbstractMOAObject; -import com.yahoo.labs.samoa.moa.core.Measurement; -import com.yahoo.labs.samoa.instances.Instance; -import com.yahoo.labs.samoa.instances.Utils; - -/** - * Classification evaluator that performs basic incremental evaluation. - * - * @author Richard Kirkby ([email protected]) - * @author Albert Bifet (abifet at cs dot waikato dot ac dot nz) - * @version $Revision: 7 $ - */ -public class BasicClassificationPerformanceEvaluator extends AbstractMOAObject implements - ClassificationPerformanceEvaluator { - - private static final long serialVersionUID = 1L; - - protected double weightObserved; - - protected double weightCorrect; - - protected double[] columnKappa; - - protected double[] rowKappa; - - protected int numClasses; - - private double weightCorrectNoChangeClassifier; - - private int lastSeenClass; - - @Override - public void reset() { - reset(this.numClasses); - } - - public void reset(int numClasses) { - this.numClasses = numClasses; - this.rowKappa = new double[numClasses]; - this.columnKappa = new double[numClasses]; - for (int i = 0; i < this.numClasses; i++) { - this.rowKappa[i] = 0.0; - this.columnKappa[i] = 0.0; - } - this.weightObserved = 0.0; - this.weightCorrect = 0.0; - this.weightCorrectNoChangeClassifier = 0.0; - this.lastSeenClass = 0; - } - - @Override - public void addResult(Instance inst, double[] classVotes) { - double weight = inst.weight(); - int trueClass = (int) inst.classValue(); - if (weight > 0.0) { - if (this.weightObserved == 0) { - reset(inst.numClasses()); - } - this.weightObserved += weight; - int predictedClass = Utils.maxIndex(classVotes); - if (predictedClass == trueClass) { - this.weightCorrect += weight; - } - if (rowKappa.length > 0) { - this.rowKappa[predictedClass] += weight; - } - if (columnKappa.length > 0) { - this.columnKappa[trueClass] += weight; - } - } - if (this.lastSeenClass == trueClass) { - this.weightCorrectNoChangeClassifier += weight; - } - this.lastSeenClass = trueClass; - } - - @Override - public Measurement[] getPerformanceMeasurements() { - return new Measurement[] { - new Measurement("classified instances", - getTotalWeightObserved()), - new Measurement("classifications correct (percent)", - getFractionCorrectlyClassified() * 100.0), - new Measurement("Kappa Statistic (percent)", - getKappaStatistic() * 100.0), - new Measurement("Kappa Temporal Statistic (percent)", - getKappaTemporalStatistic() * 100.0) - }; - - } - - public double getTotalWeightObserved() { - return this.weightObserved; - } - - public double getFractionCorrectlyClassified() { - return this.weightObserved > 0.0 ? this.weightCorrect - / this.weightObserved : 0.0; - } - - public double getFractionIncorrectlyClassified() { - return 1.0 - getFractionCorrectlyClassified(); - } - - public double getKappaStatistic() { - if (this.weightObserved > 0.0) { - double p0 = getFractionCorrectlyClassified(); - double pc = 0.0; - for (int i = 0; i < this.numClasses; i++) { - pc += (this.rowKappa[i] / this.weightObserved) - * (this.columnKappa[i] / this.weightObserved); - } - return (p0 - pc) / (1.0 - pc); - } else { - return 0; - } - } - - public double getKappaTemporalStatistic() { - if (this.weightObserved > 0.0) { - double p0 = this.weightCorrect / this.weightObserved; - double pc = this.weightCorrectNoChangeClassifier / this.weightObserved; - - return (p0 - pc) / (1.0 - pc); - } else { - return 0; - } - } - - @Override - public void getDescription(StringBuilder sb, int indent) { - Measurement.getMeasurementsDescription(getPerformanceMeasurements(), - sb, indent); - } -} http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/BasicRegressionPerformanceEvaluator.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/BasicRegressionPerformanceEvaluator.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/BasicRegressionPerformanceEvaluator.java deleted file mode 100644 index 591b1ee..0000000 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/BasicRegressionPerformanceEvaluator.java +++ /dev/null @@ -1,134 +0,0 @@ -package com.yahoo.labs.samoa.evaluation; - -/* - * #%L - * SAMOA - * %% - * Copyright (C) 2014 - 2015 Apache Software Foundation - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import com.yahoo.labs.samoa.instances.Instance; -import com.yahoo.labs.samoa.moa.AbstractMOAObject; -import com.yahoo.labs.samoa.moa.core.Measurement; - -/** - * Regression evaluator that performs basic incremental evaluation. - * - * @author Albert Bifet (abifet at cs dot waikato dot ac dot nz) - * @version $Revision: 7 $ - */ -public class BasicRegressionPerformanceEvaluator extends AbstractMOAObject - implements RegressionPerformanceEvaluator { - - private static final long serialVersionUID = 1L; - - protected double weightObserved; - - protected double squareError; - - protected double averageError; - - protected double sumTarget; - - protected double squareTargetError; - - protected double averageTargetError; - - @Override - public void reset() { - this.weightObserved = 0.0; - this.squareError = 0.0; - this.averageError = 0.0; - this.sumTarget = 0.0; - this.averageTargetError = 0.0; - this.squareTargetError = 0.0; - - } - - @Override - public void addResult(Instance inst, double[] prediction) { - double weight = inst.weight(); - double classValue = inst.classValue(); - if (weight > 0.0) { - if (prediction.length > 0) { - double meanTarget = this.weightObserved != 0 ? - this.sumTarget / this.weightObserved : 0.0; - this.squareError += (classValue - prediction[0]) * (classValue - prediction[0]); - this.averageError += Math.abs(classValue - prediction[0]); - this.squareTargetError += (classValue - meanTarget) * (classValue - meanTarget); - this.averageTargetError += Math.abs(classValue - meanTarget); - this.sumTarget += classValue; - this.weightObserved += weight; - } - } - } - - @Override - public Measurement[] getPerformanceMeasurements() { - return new Measurement[] { - new Measurement("classified instances", - getTotalWeightObserved()), - new Measurement("mean absolute error", - getMeanError()), - new Measurement("root mean squared error", - getSquareError()), - new Measurement("relative mean absolute error", - getRelativeMeanError()), - new Measurement("relative root mean squared error", - getRelativeSquareError()) - }; - } - - public double getTotalWeightObserved() { - return this.weightObserved; - } - - public double getMeanError() { - return this.weightObserved > 0.0 ? this.averageError - / this.weightObserved : 0.0; - } - - public double getSquareError() { - return Math.sqrt(this.weightObserved > 0.0 ? this.squareError - / this.weightObserved : 0.0); - } - - public double getTargetMeanError() { - return this.weightObserved > 0.0 ? this.averageTargetError - / this.weightObserved : 0.0; - } - - public double getTargetSquareError() { - return Math.sqrt(this.weightObserved > 0.0 ? this.squareTargetError - / this.weightObserved : 0.0); - } - - @Override - public void getDescription(StringBuilder sb, int indent) { - Measurement.getMeasurementsDescription(getPerformanceMeasurements(), - sb, indent); - } - - private double getRelativeMeanError() { - return this.averageTargetError > 0 ? - this.averageError / this.averageTargetError : 0.0; - } - - private double getRelativeSquareError() { - return Math.sqrt(this.squareTargetError > 0 ? - this.squareError / this.squareTargetError : 0.0); - } -} http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClassificationPerformanceEvaluator.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClassificationPerformanceEvaluator.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClassificationPerformanceEvaluator.java deleted file mode 100644 index 5ce04df..0000000 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClassificationPerformanceEvaluator.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.yahoo.labs.samoa.evaluation; - -/* - * #%L - * SAMOA - * %% - * Copyright (C) 2014 - 2015 Apache Software Foundation - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -public interface ClassificationPerformanceEvaluator extends PerformanceEvaluator { -} http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClusteringEvaluationContentEvent.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClusteringEvaluationContentEvent.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClusteringEvaluationContentEvent.java deleted file mode 100644 index b541b2b..0000000 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClusteringEvaluationContentEvent.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.yahoo.labs.samoa.evaluation; - -/* - * #%L - * SAMOA - * %% - * Copyright (C) 2014 - 2015 Apache Software Foundation - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ -import com.yahoo.labs.samoa.core.*; -import com.yahoo.labs.samoa.instances.Instance; -import com.yahoo.labs.samoa.moa.cluster.Clustering; -import com.yahoo.labs.samoa.moa.core.DataPoint; - -/** - * License - */ -/** - * The Class Clustering ResultEvent. - */ -final public class ClusteringEvaluationContentEvent implements ContentEvent { - - private static final long serialVersionUID = -7746983521296618922L; - private Clustering gtClustering; - private DataPoint dataPoint; - private final boolean isLast; - private String key = "0"; - - public ClusteringEvaluationContentEvent() { - this.isLast = false; - } - - public ClusteringEvaluationContentEvent(boolean isLast) { - this.isLast = isLast; - } - - /** - * Instantiates a new gtClustering result event. - * - * @param clustering - * the gtClustering result - * @param instance - * data point - * @param isLast - * is the last result - */ - public ClusteringEvaluationContentEvent(Clustering clustering, DataPoint instance, boolean isLast) { - this.gtClustering = clustering; - this.isLast = isLast; - this.dataPoint = instance; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public boolean isLastEvent() { - return this.isLast; - } - - Clustering getGTClustering() { - return this.gtClustering; - } - - DataPoint getDataPoint() { - return this.dataPoint; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClusteringEvaluatorProcessor.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClusteringEvaluatorProcessor.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClusteringEvaluatorProcessor.java deleted file mode 100644 index 7841030..0000000 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClusteringEvaluatorProcessor.java +++ /dev/null @@ -1,321 +0,0 @@ -package com.yahoo.labs.samoa.evaluation; - -/* - * #%L - * SAMOA - * %% - * Copyright (C) 2014 - 2015 Apache Software Foundation - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.PrintStream; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.yahoo.labs.samoa.core.ContentEvent; -import com.yahoo.labs.samoa.core.Processor; -import com.yahoo.labs.samoa.evaluation.measures.SSQ; -import com.yahoo.labs.samoa.evaluation.measures.StatisticalCollection; -import com.yahoo.labs.samoa.moa.cluster.Clustering; -import com.yahoo.labs.samoa.moa.clusterers.KMeans; -import com.yahoo.labs.samoa.moa.core.DataPoint; -import com.yahoo.labs.samoa.moa.core.Measurement; -import com.yahoo.labs.samoa.moa.evaluation.LearningCurve; -import com.yahoo.labs.samoa.moa.evaluation.LearningEvaluation; -import com.yahoo.labs.samoa.moa.evaluation.MeasureCollection; - -public class ClusteringEvaluatorProcessor implements Processor { - - /** - * - */ - private static final long serialVersionUID = -2778051819116753612L; - - private static final Logger logger = LoggerFactory.getLogger(EvaluatorProcessor.class); - - private static final String ORDERING_MEASUREMENT_NAME = "evaluation instances"; - - private final int samplingFrequency; - private final int decayHorizon; - private final File dumpFile; - private transient PrintStream immediateResultStream = null; - private transient boolean firstDump = true; - - private long totalCount = 0; - private long experimentStart = 0; - - private LearningCurve learningCurve; - - private MeasureCollection[] measures; - - private int id; - - protected Clustering gtClustering; - - protected ArrayList<DataPoint> points; - - private ClusteringEvaluatorProcessor(Builder builder) { - this.samplingFrequency = builder.samplingFrequency; - this.dumpFile = builder.dumpFile; - this.points = new ArrayList<>(); - this.decayHorizon = builder.decayHorizon; - } - - @Override - public boolean process(ContentEvent event) { - boolean ret = false; - if (event instanceof ClusteringResultContentEvent) { - ret = process((ClusteringResultContentEvent) event); - } - if (event instanceof ClusteringEvaluationContentEvent) { - ret = process((ClusteringEvaluationContentEvent) event); - } - return ret; - } - - private boolean process(ClusteringResultContentEvent result) { - // evaluate - Clustering clustering = KMeans.gaussianMeans(gtClustering, result.getClustering()); - for (MeasureCollection measure : measures) { - try { - measure.evaluateClusteringPerformance(clustering, gtClustering, points); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - this.addMeasurement(); - - if (result.isLastEvent()) { - this.concludeMeasurement(); - return true; - } - - totalCount += 1; - - if (totalCount == 1) { - experimentStart = System.nanoTime(); - } - - return false; - } - - private boolean process(ClusteringEvaluationContentEvent result) { - boolean ret = false; - if (result.getGTClustering() != null) { - gtClustering = result.getGTClustering(); - ret = true; - } - if (result.getDataPoint() != null) { - points.add(result.getDataPoint()); - if (points.size() > this.decayHorizon) { - points.remove(0); - } - ret = true; - } - return ret; - } - - @Override - public void onCreate(int id) { - this.id = id; - this.learningCurve = new LearningCurve(ORDERING_MEASUREMENT_NAME); - // create the measure collection - measures = getMeasures(getMeasureSelection()); - - if (this.dumpFile != null) { - try { - if (dumpFile.exists()) { - this.immediateResultStream = new PrintStream(new FileOutputStream(dumpFile, true), true); - } else { - this.immediateResultStream = new PrintStream(new FileOutputStream(dumpFile), true); - } - - } catch (FileNotFoundException e) { - this.immediateResultStream = null; - logger.error("File not found exception for {}:{}", this.dumpFile.getAbsolutePath(), e.toString()); - - } catch (Exception e) { - this.immediateResultStream = null; - logger.error("Exception when creating {}:{}", this.dumpFile.getAbsolutePath(), e.toString()); - } - } - - this.firstDump = true; - } - - private static ArrayList<Class> getMeasureSelection() { - ArrayList<Class> mclasses = new ArrayList<>(); - // mclasses.add(EntropyCollection.class); - // mclasses.add(F1.class); - // mclasses.add(General.class); - // *mclasses.add(CMM.class); - mclasses.add(SSQ.class); - // *mclasses.add(SilhouetteCoefficient.class); - mclasses.add(StatisticalCollection.class); - // mclasses.add(Separation.class); - - return mclasses; - } - - private static MeasureCollection[] getMeasures(ArrayList<Class> measure_classes) { - MeasureCollection[] measures = new MeasureCollection[measure_classes.size()]; - for (int i = 0; i < measure_classes.size(); i++) { - try { - MeasureCollection m = (MeasureCollection) measure_classes.get(i).newInstance(); - measures[i] = m; - - } catch (Exception ex) { - java.util.logging.Logger.getLogger("Couldn't create Instance for " + measure_classes.get(i).getName()); - ex.printStackTrace(); - } - } - return measures; - } - - @Override - public Processor newProcessor(Processor p) { - ClusteringEvaluatorProcessor originalProcessor = (ClusteringEvaluatorProcessor) p; - ClusteringEvaluatorProcessor newProcessor = new ClusteringEvaluatorProcessor.Builder(originalProcessor).build(); - - if (originalProcessor.learningCurve != null) { - newProcessor.learningCurve = originalProcessor.learningCurve; - } - - return newProcessor; - } - - @Override - public String toString() { - StringBuilder report = new StringBuilder(); - - report.append(EvaluatorProcessor.class.getCanonicalName()); - report.append("id = ").append(this.id); - report.append('\n'); - - if (learningCurve.numEntries() > 0) { - report.append(learningCurve.toString()); - report.append('\n'); - } - return report.toString(); - } - - private void addMeasurement() { - // printMeasures(); - List<Measurement> measurements = new ArrayList<>(); - measurements.add(new Measurement(ORDERING_MEASUREMENT_NAME, totalCount * this.samplingFrequency)); - - addClusteringPerformanceMeasurements(measurements); - Measurement[] finalMeasurements = measurements.toArray(new Measurement[measurements.size()]); - - LearningEvaluation learningEvaluation = new LearningEvaluation(finalMeasurements); - learningCurve.insertEntry(learningEvaluation); - logger.debug("evaluator id = {}", this.id); - // logger.info(learningEvaluation.toString()); - - if (immediateResultStream != null) { - if (firstDump) { - immediateResultStream.println(learningCurve.headerToString()); - firstDump = false; - } - - immediateResultStream.println(learningCurve.entryToString(learningCurve.numEntries() - 1)); - immediateResultStream.flush(); - } - } - - private void addClusteringPerformanceMeasurements(List<Measurement> measurements) { - for (MeasureCollection measure : measures) { - for (int j = 0; j < measure.getNumMeasures(); j++) { - Measurement measurement = new Measurement(measure.getName(j), measure.getLastValue(j)); - measurements.add(measurement); - } - } - } - - private void concludeMeasurement() { - logger.info("last event is received!"); - logger.info("total count: {}", this.totalCount); - - String learningCurveSummary = this.toString(); - logger.info(learningCurveSummary); - - long experimentEnd = System.nanoTime(); - long totalExperimentTime = TimeUnit.SECONDS.convert(experimentEnd - experimentStart, TimeUnit.NANOSECONDS); - logger.info("total evaluation time: {} seconds for {} instances", totalExperimentTime, totalCount); - // logger.info("average throughput rate: {} instances/seconds", - // (totalCount/totalExperimentTime)); - } - - private void printMeasures() { - StringBuilder sb = new StringBuilder(); - for (MeasureCollection measure : measures) { - - sb.append("Mean ").append(measure.getClass().getSimpleName()).append(":").append(measure.getNumMeasures()) - .append("\n"); - for (int j = 0; j < measure.getNumMeasures(); j++) { - sb.append("[").append(measure.getName(j)).append("=").append(measure.getLastValue(j)).append("] \n"); - - } - sb.append("\n"); - } - - logger.debug("\n MEASURES: \n\n {}", sb.toString()); - System.out.println(sb.toString()); - } - - public static class Builder { - - private int samplingFrequency = 1000; - private File dumpFile = null; - private int decayHorizon = 1000; - - public Builder(int samplingFrequency) { - this.samplingFrequency = samplingFrequency; - } - - public Builder(ClusteringEvaluatorProcessor oldProcessor) { - this.samplingFrequency = oldProcessor.samplingFrequency; - this.dumpFile = oldProcessor.dumpFile; - this.decayHorizon = oldProcessor.decayHorizon; - } - - public Builder samplingFrequency(int samplingFrequency) { - this.samplingFrequency = samplingFrequency; - return this; - } - - public Builder decayHorizon(int decayHorizon) { - this.decayHorizon = decayHorizon; - return this; - } - - public Builder dumpFile(File file) { - this.dumpFile = file; - return this; - } - - public ClusteringEvaluatorProcessor build() { - return new ClusteringEvaluatorProcessor(this); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-samoa/blob/9b178f63/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClusteringResultContentEvent.java ---------------------------------------------------------------------- diff --git a/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClusteringResultContentEvent.java b/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClusteringResultContentEvent.java deleted file mode 100644 index fbb6d3b..0000000 --- a/samoa-api/src/main/java/com/yahoo/labs/samoa/evaluation/ClusteringResultContentEvent.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.yahoo.labs.samoa.evaluation; - -/* - * #%L - * SAMOA - * %% - * Copyright (C) 2014 - 2015 Apache Software Foundation - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import com.yahoo.labs.samoa.core.ContentEvent; -import com.yahoo.labs.samoa.moa.cluster.Clustering; - -/** - * License - */ -/** - * The Class Clustering ResultEvent. - */ -final public class ClusteringResultContentEvent implements ContentEvent { - - private static final long serialVersionUID = -7746983521296618922L; - private Clustering clustering; - private final boolean isLast; - private String key = "0"; - - public ClusteringResultContentEvent() { - this.isLast = false; - } - - public ClusteringResultContentEvent(boolean isLast) { - this.isLast = isLast; - } - - /** - * Instantiates a new clustering result event. - * - * @param clustering - * the clustering result - * @param isLast - * is the last result - */ - public ClusteringResultContentEvent(Clustering clustering, boolean isLast) { - this.clustering = clustering; - this.isLast = isLast; - } - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public boolean isLastEvent() { - return this.isLast; - } - - public Clustering getClustering() { - return this.clustering; - } -}
