flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thvasilo <...@git.apache.org>
Subject [GitHub] flink pull request: [Flink-2030][ml]Online Histogram: Discrete and...
Date Tue, 23 Jun 2015 14:33:43 GMT
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.
---

Mime
View raw message