spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joseph K. Bradley (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (SPARK-4500) Improve exact stratified sampling implementation
Date Wed, 19 Nov 2014 22:01:33 GMT

     [ https://issues.apache.org/jira/browse/SPARK-4500?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Joseph K. Bradley updated SPARK-4500:
-------------------------------------
    Description: 
The current implementation for exact stratified sampling (sampleByKeyExact) could be more
efficient.  Proposed algorithm sketch:

* Sampling is done separately for each stratum.  Here, all counts are w.r.t. a fixed stratum.
* Let n_partition = number of elements in a given partition
* This method uses 2-tiered sampling:
** Tier 1 (on driver): Select the sample sizes {n_partition} for each partition.
*** Without replacement, this uses a multivariate hypergeometric distribution.
*** With replacement, this should use a multinomial distribution.
** Tier 2 (in parallel): Select a sample of size n_partition.

If anyone is interested in implementing this, I have a rough draft which works without replacement,
but it needs to be cleaned up and augmented to do sampling with replacement too.

  was:
The current implementation for exact stratified sampling (sampleByKeyExact) could be more
efficient.  Proposed algorithm sketch:

* Sampling is done separately for each stratum.  Here, all counts are w.r.t. a fixed stratum.
* Let:
** N = total number of elements in all partitions
** n_partition = number of elements in a given partition
* This method uses 2-tiered sampling:
** Tier 1 (on driver): Select the sample sizes {n_partition} for each partition.
*** Without replacement, this uses a multivariate hypergeometric distribution.
*** With replacement, this should use a multinomial distribution.
** Tier 2 (in parallel): Select a sample of size n_partition.

If anyone is interested in implementing this, I have a rough draft which works without replacement,
but it needs to be cleaned up and augmented to do sampling with replacement too.


> Improve exact stratified sampling implementation
> ------------------------------------------------
>
>                 Key: SPARK-4500
>                 URL: https://issues.apache.org/jira/browse/SPARK-4500
>             Project: Spark
>          Issue Type: Improvement
>          Components: MLlib
>    Affects Versions: 1.2.0
>            Reporter: Joseph K. Bradley
>
> The current implementation for exact stratified sampling (sampleByKeyExact) could be
more efficient.  Proposed algorithm sketch:
> * Sampling is done separately for each stratum.  Here, all counts are w.r.t. a fixed
stratum.
> * Let n_partition = number of elements in a given partition
> * This method uses 2-tiered sampling:
> ** Tier 1 (on driver): Select the sample sizes {n_partition} for each partition.
> *** Without replacement, this uses a multivariate hypergeometric distribution.
> *** With replacement, this should use a multinomial distribution.
> ** Tier 2 (in parallel): Select a sample of size n_partition.
> If anyone is interested in implementing this, I have a rough draft which works without
replacement, but it needs to be cleaned up and augmented to do sampling with replacement too.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message