Generate random deviates from an exponential distribution

Generate random deviates from an exponential distribution

Methods

Public methods


Method new()

Create a new Exponential object.

Usage

Exponential$new(sc, mean, size, num_partitions, seed)

Arguments

sc

A spark_connection.

mean

integer(1). The mean (1 / lambda) for the exponential distribution.

size

integer(1). The number of deviates to generate.

num_partitions

integer(1). Number of partitions in the RDD (default: sc.defaultParallelism).

seed

integer(1). The seed to set.

Returns

A new Exponential object which is a RDD[Double] comprised of comprised of i.i.d. samples ~ Exp(mean)..

Examples

\dontrun{
  sc <- sparklyr::spark_connect(master = "local")
  exp <- Exponential$new(
    sc = sc,
    mean = 2,
    size = 10L,
    num_partitions = 1L,
    seed = 1L
  )
}


Method collect()

Collect the random deviates into R.

Usage

Exponential$collect()

Examples

\dontrun{
  exp$collect()
}


Method count()

Collect the random deviates into R.

Usage

Exponential$count()

Examples

\dontrun{
  exp$collect()
}


Method first()

Count the number of deviates.

Usage

Exponential$first()

Examples

\dontrun{
  exp$count()
}


Method get_num_partitions()

Get the number of partitions

Usage

Exponential$get_num_partitions()

Examples

\dontrun{
  exp$get_num_partitions()
}


Method clone()

The objects of this class are cloneable with this method.

Usage

Exponential$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

## ------------------------------------------------ ## Method `Exponential$new` ## ------------------------------------------------ if (FALSE) { sc <- sparklyr::spark_connect(master = "local") exp <- Exponential$new( sc = sc, mean = 2, size = 10L, num_partitions = 1L, seed = 1L ) } ## ------------------------------------------------ ## Method `Exponential$collect` ## ------------------------------------------------ if (FALSE) { exp$collect() } ## ------------------------------------------------ ## Method `Exponential$count` ## ------------------------------------------------ if (FALSE) { exp$collect() } ## ------------------------------------------------ ## Method `Exponential$first` ## ------------------------------------------------ if (FALSE) { exp$count() } ## ------------------------------------------------ ## Method `Exponential$get_num_partitions` ## ------------------------------------------------ if (FALSE) { exp$get_num_partitions() }