flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ChengXiangLi <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-2533] [core] Gap based random sample op...
Date Wed, 09 Sep 2015 03:06:27 GMT
Github user ChengXiangLi commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1110#discussion_r39003481
  
    --- Diff: flink-java/src/main/java/org/apache/flink/api/java/sampling/PoissonSampler.java
---
    @@ -93,29 +98,59 @@ public boolean hasNext() {
     					}
     				}
     			}
    -
    -			private void moveToNextElement() {
    -				while (input.hasNext()) {
    +			
    +			public int poisson_ge1(double p){
    +				// sample 'k' from Poisson(p), conditioned to k >= 1
    +				double q = Math.pow(Math.E, -p);
    +				// simulate a poisson trial such that k >= 1
    +				double t = q + (1 - q)*random.nextDouble();
    --- End diff --
    
    Format: require blanks before and after *.


---
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