Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Random numbers generation functions #88

Open
1 of 5 tasks
SemyonSinchenko opened this issue Mar 31, 2023 · 3 comments
Open
1 of 5 tasks

[Feature Request] Random numbers generation functions #88

SemyonSinchenko opened this issue Mar 31, 2023 · 3 comments
Assignees

Comments

@SemyonSinchenko
Copy link
Collaborator

SemyonSinchenko commented Mar 31, 2023

What we have

Currently PySpark provide only two methods of generating random numbers:

  1. rand which generates numbers from $\sim U(0, 1)$
  2. randn which generates numbers from $\sim N(0, 1)$

What I want to have?

  • Random integers generation
  • Samples from $\sim U(\alpha, \beta)$
  • Samples from $\sim N(\alpha, \beta)$
  • Samples from $\sim L(\alpha, \beta)$ (Laplace distribution)
  • Samples from $\sim \Gamma (\alpha, \beta)$ (Gamma distribution)

Motivation

  1. Random integers is important for a lot of reasons and re-partitioning is one of them.
  2. Gaussian, Laplace and Gamma distributions are a key part to implement Differential Privacy Driven aggregations (for example, Additive noise mechanism and especially Laplace mechanism).

How to do it?

All distribution can be generated from the uniform. The idea is to provide a top level functions.

@MrPowers
Copy link
Collaborator

MrPowers commented Apr 2, 2023

@SemyonSinchenko - yep, I like this idea. Can you please propose the function names => expected interfaces at a high level? e.g. "I think we should have a quinn.laplace(col: Column) function that returns a Leplace number". These should be useful in a variety of contexts.

@SemyonSinchenko
Copy link
Collaborator Author

My proposal is quinn.math.laplace(a: float, b: float) -> Column
I can make a PR with this and we will discuss it.

@MrPowers
Copy link
Collaborator

MrPowers commented Apr 2, 2023

@SemyonSinchenko - sounds good, going to assign you this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants