Class

com.linkedin.photon.ml.hyperparameter

SliceSampler

Related Doc: package hyperparameter

Permalink

class SliceSampler extends AnyRef

This class implements the slice sampling algorithm. Slice sampling is an Markov chain Monte Carlo algorithm for sampling from an arbitrary continuous distribution function.

Consider the ASCII-normal distribution function shown below.

/-\ /-\ f(x) /-\ /-\ /-\ / \ / |\ / |\ / \ / \ / \ / | \ /---|-\ /-x'--\ / \ --/ x \-- --/ x \-- --/ x \-- --/ \-- --/ x' \--

1 2 3 4 5

The procedure for drawing a sample from the function is as follows:

1) Start with an initial point x in the domain (e.g. the sample from a previous iteration). 2) Sample a vertical value uniformly between zero and f(x). 3) Step out horizontally in both directions from the value obtained in step 2 until reaching the boundary of the function. This is the "slice". 4) Sample uniformly from the slice to obtain the new point x'. 5) Back to step 1 with the new point.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SliceSampler
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new SliceSampler(stepSize: Double = 1.0, maxStepsOut: Int = 1000, seed: Long = System.currentTimeMillis)

    Permalink

    stepSize

    the size to expand a slice while taking one step in a single direction from the starting point

    maxStepsOut

    the maximum number of steps in either direction while expanding a slice

    seed

    the random seed

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def draw(x: DenseVector[Double], y: Double, logp: (DenseVector[Double]) ⇒ Double, direction: DenseVector[Double], slice: (DenseVector[Double], DenseVector[Double])): DenseVector[Double]

    Permalink

    Draws a new point uniformly from the given horizontal slice through the function, along the given direction

    Draws a new point uniformly from the given horizontal slice through the function, along the given direction

    x

    the original point

    y

    the value of the function slice

    logp

    the log-transformed function from which to sample. Note that this need not sum to 1, and need only be proportional to the target PDF.

    direction

    the direction along which to draw a new point

    slice

    the slice bounds

    returns

    the new point

    Attributes
    protected
    Annotations
    @tailrec()
  7. def draw(x: DenseVector[Double], logp: (DenseVector[Double]) ⇒ Double, direction: DenseVector[Double]): DenseVector[Double]

    Permalink

    Draws a new point from the target distribution along the given direction

    Draws a new point from the target distribution along the given direction

    x

    the original point

    logp

    the log-transformed function from which to sample. Note that this need not sum to 1, and need only be proportional to the target PDF.

    direction

    the direction along which to draw a new point

    returns

    the new point

    Attributes
    protected
  8. def draw(x: DenseVector[Double], logp: (DenseVector[Double]) ⇒ Double): DenseVector[Double]

    Permalink

    Draws a new point from the target distribution

    Draws a new point from the target distribution

    x

    the original point

    logp

    the log-transformed function from which to sample. Note that this need not sum to 1, and need only be proportional to the target PDF.

    returns

    the new point

  9. def drawDimensionWise(x: DenseVector[Double], logp: (DenseVector[Double]) ⇒ Double): DenseVector[Double]

    Permalink

    Draws a new point from the target distribution, sampling from each dimension one-by-one

    Draws a new point from the target distribution, sampling from each dimension one-by-one

    x

    the original point

    logp

    the log-transformed function from which to sample. Note that this need not sum to 1, and need only be proportional to the target PDF.

    returns

    the new point

  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  14. def getDirection(i: Int, dim: Int): DenseVector[Double]

    Permalink

    Builds a direction basis vector from the index

    Builds a direction basis vector from the index

    i

    the active index

    dim

    size of the vector

    returns

    the direction basis vector

    Attributes
    protected
  15. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. val random: Random

    Permalink
  21. def shrink(slice: (DenseVector[Double], DenseVector[Double]), x: DenseVector[Double], newX: DenseVector[Double], direction: DenseVector[Double]): (DenseVector[Double], DenseVector[Double])

    Permalink

    Shrinks the slice by clamping to the new point x.

    Shrinks the slice by clamping to the new point x.

    slice

    the original slice

    x

    the original point x

    newX

    the new point x

    direction

    the direction along which to shrink the slice

    returns

    the shrunken slice

    Attributes
    protected
  22. def stepOut(x: DenseVector[Double], y: Double, logp: (DenseVector[Double]) ⇒ Double, direction: DenseVector[Double]): (DenseVector[Double], DenseVector[Double])

    Permalink

    Performs the step out procedure.

    Performs the step out procedure. Start at the given x position, and expand outwards along the given direction until the slice extends beyond where the PDF lies above the y value.

    x

    the starting point

    y

    the value at which the function will be sliced

    logp

    the log-transformed function from which to sample. Note that this need not sum to 1, and need only be proportional to the target PDF.

    direction

    the direction along which to slice

    returns

    the slice lower and upper bounds

    Attributes
    protected
  23. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  24. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  25. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped