Return-Path: X-Original-To: apmail-flink-issues-archive@minotaur.apache.org Delivered-To: apmail-flink-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C29DA1880C for ; Tue, 23 Jun 2015 14:34:07 +0000 (UTC) Received: (qmail 34925 invoked by uid 500); 23 Jun 2015 14:34:07 -0000 Delivered-To: apmail-flink-issues-archive@flink.apache.org Received: (qmail 34876 invoked by uid 500); 23 Jun 2015 14:34:07 -0000 Mailing-List: contact issues-help@flink.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flink.apache.org Delivered-To: mailing list issues@flink.apache.org Received: (qmail 34867 invoked by uid 99); 23 Jun 2015 14:34:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Jun 2015 14:34:07 +0000 X-ASF-Spam-Status: No, hits=-2001.4 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO mail.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 23 Jun 2015 14:31:56 +0000 Received: (qmail 34358 invoked by uid 99); 23 Jun 2015 14:33:43 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Jun 2015 14:33:43 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 384FAE0019; Tue, 23 Jun 2015 14:33:43 +0000 (UTC) From: thvasilo To: issues@flink.incubator.apache.org Reply-To: issues@flink.incubator.apache.org References: In-Reply-To: Subject: [GitHub] flink pull request: [Flink-2030][ml]Online Histogram: Discrete and... Content-Type: text/plain Message-Id: <20150623143343.384FAE0019@git1-us-west.apache.org> Date: Tue, 23 Jun 2015 14:33:43 +0000 (UTC) X-Virus-Checked: Checked by ClamAV on apache.org Github user thvasilo commented on a diff in the pull request: https://github.com/apache/flink/pull/861#discussion_r33046983 --- Diff: flink-staging/flink-ml/src/main/scala/org/apache/flink/ml/math/OnlineHistogram.scala --- @@ -0,0 +1,81 @@ +/* + * 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.flink.ml.math + +/** Base trait for an Online Histogram + * + */ +trait OnlineHistogram { + + /** Number of bins currently being used + * + * @return number of bins + */ + def bins: Int + + /** Adds a new instance + * + * @param p value to be added + */ + def add(p: Double): Unit + + /** Merges the histogram with h and returns a histogram with capacity B + * + * @param h histogram to be merged + * @param B capacity of the resultant histogram + * @return Merged histogram with capacity B + */ + def merge(h: OnlineHistogram, B: Int): OnlineHistogram + + /** Returns the qth quantile of the histogram + * Should fail for a discrete version + * + * @param q Quantile value in (0,1) + * @return Value at quantile q + */ + def quantile(q: Double): Double --- End diff -- About quantile and count, why not make them functions of the respective implementing classes? I don't think we should provide access to functions in the base class that just fail in certain implementations. --- 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 infrastructure@apache.org or file a JIRA ticket with INFRA. ---