cc.factorie.infer

MHSampler

abstract class MHSampler[C] extends ProposalSampler[C]

A Metropolis-Hastings sampler. The abstract method 'propose' should be defined to make a random proposal, putting changes in its implicit DiffList, and returning the log ratio of q/q' (backward to forward jump probabilities.)

Since

0.8

See also

GibbsSampler

ProposalSampler

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. MHSampler
  2. ProposalSampler
  3. Sampler
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new MHSampler(model: model.Model)(implicit random: Random)

Type Members

  1. type ContextType = C

    Definition Classes
    Sampler
  2. case class Proposal[C](diff: variable.DiffList, modelScore: Double, objectiveScore: Double, acceptanceScore: Double, bfRatio: Double, temperature: Double, context: C) extends infer.Proposal[C] with Product with Serializable

    Specialization of cc.

Abstract Value Members

  1. abstract def propose(context: C)(implicit d: variable.DiffList): Double

    This method must be implemented in concrete subclasses.

    This method must be implemented in concrete subclasses. It should return the log of the ratio of backwards-to-forwards jump probabilities.

Concrete Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def bestConfigHook(): Unit

    Called whenever we accept a proposal that results in the best configuration seen so far.

    Called whenever we accept a proposal that results in the best configuration seen so far. If you override, you must call super.bestConfigHook!

  8. var changeCount: Int

    The number of calls to process that resulted in a change (a non-empty DiffList)

    The number of calls to process that resulted in a change (a non-empty DiffList)

    Definition Classes
    Sampler
  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. var currentModelScore: Double

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

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

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

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

    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

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

    Definition Classes
    Any
  17. var iterationCount: Int

    The number of calls to process(numIterations:Int) or process(contexts:C,numIterations:Int).

    The number of calls to process(numIterations:Int) or process(contexts:C,numIterations:Int).

    Definition Classes
    Sampler
  18. var makeNewDiffList: Boolean

    If true, calls to "newDiffList" will create a new DiffList to describe the changes they made, otherwise "newDiffList" will return null.

    If true, calls to "newDiffList" will create a new DiffList to describe the changes they made, otherwise "newDiffList" will return null.

    Definition Classes
    Sampler
  19. var maxModelScore: Double

  20. val model: model.Model

    Definition Classes
    MHSamplerProposalSampler
  21. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  22. def newDiffList: variable.DiffList

    In your implementation of "process1" use this method to optionally create a new DiffList, obeying "makeNewDiffList".

    In your implementation of "process1" use this method to optionally create a new DiffList, obeying "makeNewDiffList".

    Definition Classes
    Sampler
  23. def noDiffList: MHSampler.this.type

    Convenient method for setting makeNewDiffList to false, and returning this.

    Convenient method for setting makeNewDiffList to false, and returning this.

    Definition Classes
    Sampler
  24. final def notify(): Unit

    Definition Classes
    AnyRef
  25. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  26. var numAcceptedMoves: Int

  27. var numNegativeMoves: Int

  28. var numProposedMoves: Int

  29. def objective: model.Model

    If you want the Proposals to actually contain the objectiveScore, override this method appropriately.

    If you want the Proposals to actually contain the objectiveScore, override this method appropriately. Used for training.

  30. def pickProposal(proposals: Seq[infer.Proposal[C]]): infer.Proposal[C]

    Definition Classes
    ProposalSampler
  31. def postAcceptanceHook(logAcceptanceProb: Double, d: variable.DiffList): Unit

    Called after accepting the proposed change.

    Called after accepting the proposed change. If you override, you must call super.postAcceptanceHook!

  32. def postIterationHook: Boolean

    Called after each iteration of sampling the full list of variables.

    Called after each iteration of sampling the full list of variables. Return false if you want sampling to stop early.

    Definition Classes
    Sampler
  33. val postIterationHooks: Hooks0

    Definition Classes
    Sampler
  34. def postProcessHook(context: C, difflist: DiffList): Unit

    Call just after each step of sampling.

    Call just after each step of sampling.

    Definition Classes
    Sampler
  35. def postProposalHook(d: variable.DiffList): Unit

    Called just after making the proposed change.

    Called just after making the proposed change. If you override, you must call super.postProposalHook!

  36. def postUndoHook(acceptScore: Double, d: variable.DiffList): Unit

    Called just after undoing the proposed change.

    Called just after undoing the proposed change. If you override, you must call super.postUndoHook!

  37. def preProcessHook(context: C): C

    Called just before each step of sampling.

    Called just before each step of sampling. Return an alternative variable if you want that one sampled instead. Return null if you want to abort sampling of this context.

    Definition Classes
    Sampler
  38. def preProposalHook(): Unit

  39. val preProposalHooks: Hooks0

    Called just before making the proposed change.

    Called just before making the proposed change. If you override, you must call super.preProposalHook!

  40. final def process(count: Int): Unit

    Definition Classes
    Sampler
  41. final def process(context: C, repeat: Int): Unit

    Definition Classes
    Sampler
  42. final def process(context: C): DiffList

    Do one step of sampling.

    Do one step of sampling. This is a method intended to be called by users. It manages hooks and processCount.

    Definition Classes
    Sampler
  43. def process1(context: C): DiffList

    The underlying protected method that actually does the work.

    The underlying protected method that actually does the work. Use this.newDiffList to optionally create returned DiffList. Needs to be defined in subclasses.

    Definition Classes
    ProposalSamplerSampler
  44. def process1unused(context: C): variable.DiffList

  45. final def processAll(contexts: Iterable[C], numIterations: Int): Unit

    Definition Classes
    Sampler
  46. final def processAll(contexts: Iterable[C], returnDiffs: Boolean = false): DiffList

    Definition Classes
    Sampler
  47. var processCount: Int

    The number of calls to process(context:C)

    The number of calls to process(context:C)

    Definition Classes
    Sampler
  48. def processProposals(props: Seq[infer.Proposal[C]]): DiffList

    Definition Classes
    ProposalSampler
  49. var proposalAccepted: Boolean

  50. def proposalHook(proposal: infer.Proposal[C]): Unit

    Definition Classes
    MHSamplerProposalSampler
  51. val proposalHooks: Hooks1[infer.Proposal[C]]

    Definition Classes
    ProposalSampler
  52. def proposals(context: C): Seq[Proposal[C]]

    Definition Classes
    MHSamplerProposalSampler
  53. var proposalsCount: Int

  54. def proposalsHook(proposals: Seq[infer.Proposal[C]]): Unit

    Definition Classes
    ProposalSampler
  55. val proposalsHooks: Hooks1[Seq[infer.Proposal[C]]]

    Definition Classes
    ProposalSampler
  56. implicit val random: Random

    Definition Classes
    MHSamplerSampler
  57. def skipEmptyProposals: Boolean

    Definition Classes
    ProposalSampler
  58. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  59. var temperature: Double

    Definition Classes
    ProposalSampler
  60. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from ProposalSampler[C]

Inherited from Sampler[C]

Inherited from AnyRef

Inherited from Any

Ungrouped