Github user cestella commented on a diff in the pull request:
https://github.com/apache/incubator-metron/pull/226#discussion_r76100309
--- Diff:
metron-platform/metron-common/src/main/java/org/apache/metron/common/dsl/functions/StellarStatistics.java
---
@@ -0,0 +1,207 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ *
+ */
+
+package org.apache.metron.common.dsl.functions;
+
+import org.apache.commons.lang.NotImplementedException;
+import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
+
+import java.io.Serializable;
+
+/**
+ * Provides basic summary statistics to Stellar.
+ *
+ * Used as an adapter to provide a single interface to two underlying
Commons
+ * Math classes that provide summary statistics.
+ */
+public class StellarStatistics implements Serializable {
+
+ /**
+ * DescriptiveStatistics stores a rolling window of input data elements
+ * which is then used to calculate the summary statistic. There are some
+ * summary statistics like kurtosis and percentiles, that can only
+ * be calculated with this.
+ *
+ * This implementation is used if the windowSize > 0.
+ */
+ private DescriptiveStatistics descStats;
+
+ /**
+ * SummaryStatistics can be used for summary statistics that only
+ * require a single pass over the input data. This has the advantage
+ * of being less memory intensive, but not all summary statistics are
+ * available.
+ *
+ * This implementation is used if the windowSize == 0.
+ */
+ private SummaryStatistics summStats;
+
+ /**
+ * @param windowSize The number of input data elements to maintain in
memory. If
+ * windowSize == 0, then no data elements will be
maintained in
+ * memory.
+ */
+ public StellarStatistics(int windowSize) {
--- End diff --
Can we move the functions for StellarStatistics into their own interface
and have two implementations, one backed by SummaryStatistics and one backed by
DescriptiveStatistics? We will likely have a third implementation,
ProbabalisticStatistics that supports approximate distributional stats while
not requiring a window size and I'd like it to be as simple as implementing an
interface, not adding to a branch at every method.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---