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.factorie.Proposal that adds a MH forward-backward transition ratio, typically notated as a ratio of Qs.

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: Any): Boolean

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

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

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

    Definition Classes
    Any
  5. 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!

  6. 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
  7. def clone(): AnyRef

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

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

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

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

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

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

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

    Definition Classes
    Any
  15. 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
  16. 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
  17. var maxModelScore: Double

  18. val model: model.Model

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

    Definition Classes
    AnyRef
  20. 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
  21. 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
  22. final def notify(): Unit

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

    Definition Classes
    AnyRef
  24. var numAcceptedMoves: Int

  25. var numNegativeMoves: Int

  26. var numProposedMoves: Int

  27. 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.

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

    Definition Classes
    ProposalSampler
  29. 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!

  30. 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
  31. val postIterationHooks: Hooks0

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

    Call just after each step of sampling.

    Call just after each step of sampling.

    Definition Classes
    Sampler
  33. 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!

  34. 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!

  35. 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
  36. def preProposalHook(): Unit

  37. 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!

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

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

    Definition Classes
    Sampler
  40. 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
  41. 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
  42. def process1unused(context: C): variable.DiffList

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

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

    Definition Classes
    Sampler
  45. var processCount: Int

    The number of calls to process(context:C)

    The number of calls to process(context:C)

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

    Definition Classes
    ProposalSampler
  47. var proposalAccepted: Boolean

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

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

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

    Definition Classes
    MHSamplerProposalSampler
  51. var proposalsCount: Int

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

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

    Definition Classes
    ProposalSampler
  54. implicit val random: Random

    Definition Classes
    MHSamplerSampler
  55. def skipEmptyProposals: Boolean

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

    Definition Classes
    AnyRef
  57. var temperature: Double

    Definition Classes
    ProposalSampler
  58. def toString(): String

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  61. 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