You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "zhipeng93 (via GitHub)" <gi...@apache.org> on 2023/03/31 12:39:37 UTC

[GitHub] [flink-ml] zhipeng93 commented on a diff in pull request #227: [FLINK-31623] Fix DataStreamUtils#sample to uniform sampling.

zhipeng93 commented on code in PR #227:
URL: https://github.com/apache/flink-ml/pull/227#discussion_r1154426414


##########
flink-ml-core/src/main/java/org/apache/flink/ml/common/datastream/DataStreamUtils.java:
##########
@@ -280,6 +280,15 @@ public static <IN, ACC, OUT> DataStream<OUT> aggregate(
      * <p>This method takes samples without replacement. If the number of elements in the stream is
      * smaller than expected number of samples, all elements will be included in the sample.
      *
+     * <p>Technical details about this method: Firstly, the input elements are rebalanced. Then, in

Review Comment:
   nit: How about we update the java doc as follows and move the technique details to the implementation part or remove it?
   
   `Performs an approximate uniform sampling over the elements in a bounded data stream. The difference of probablity of two data points been sampled is bounded by O(numSamples * p * p / (M * M)), where p is the paralellism of the input stream, M is the total number of data points that the input stream contains.`
   
   This method takes samples without replacement. If the number of elements in the stream is smaller than expected number of samples, all elements will be included in the sample.



##########
flink-ml-core/src/main/java/org/apache/flink/ml/common/datastream/DataStreamUtils.java:
##########
@@ -280,6 +280,15 @@ public static <IN, ACC, OUT> DataStream<OUT> aggregate(
      * <p>This method takes samples without replacement. If the number of elements in the stream is
      * smaller than expected number of samples, all elements will be included in the sample.
      *
+     * <p>Technical details about this method: Firstly, the input elements are rebalanced. Then, in

Review Comment:
   nit: How about we update the java doc as follows and move the technique details to the implementation part or remove it?
   
   `Performs an approximate uniform sampling over the elements in a bounded data stream. The difference of probablity of two data points been sampled is bounded by O(numSamples * p * p / (M * M)), where p is the paralellism of the input stream, M is the total number of data points that the input stream contains.`
   
   `This method takes samples without replacement. If the number of elements in the stream is smaller than expected number of samples, all elements will be included in the sample.`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org