FocusingProtocol

class rfbp.FocusingProtocol.Focusing_Protocol(protocol='standard_reinforcement', size=101)[source]

Bases: object

Focusing Protocol object. Abstract type representing a protocol for the focusing procedure, i.e. a way to produce successive values for the quantities γ, y and β. Currently, however, only β=Inf is supported. To be provided as an argument to focusingBP.

Available protocols are: StandardReinforcement, Scoping, PseudoReinforcement and FreeScoping.

  • StandardReinforcement: returns γ=Inf and y=1/(1-x), where x is taken from the given range r.
  • Scoping: fixed y and a varying γ taken from the given γr range.
  • PseudoReinforcement: both γ and y are progressively increased, according to the formulas
>>> γ = atanh(ρ**x)
>>> y = 1+ρ**(1-2*x)/(1-ρ)

where ρ is taken from the given range(s) r. With x=0, this is basically the same as StandardReinforcement.

  • FreeScoping: just returns the values of (γ,y) from the given list
Parameters:
  • protocol (string) – The value of string can be only one of [‘scoping’, ‘pseudo_reinforcement’, ‘free_scoping’, ‘standard_reinforcement’]
  • size (int (default = 101)) – Dimension of update protocol

Example

>>> from ReplicatedFocusingBeliefPropagation import Focusing_Protocol
>>>
>>> fprotocol = Focusing_Protocol('scoping', 101)
>>> fprotocol
  Focusing_Protocol(protocol=scoping, size=101)
beta

Return the ‘beta’ array

Returns:beta – The vector of the beta values
Return type:array-like
fprotocol

Return the Cython object

Returns:fprotocol – The cython object wrapped by the Pattern class
Return type:Cython object

Notes

Warning

We discourage the use of this property if you do not know exactly what you are doing!

gamma

Return the ‘gamma’ array

Returns:gamma – The vector of the gamma values
Return type:array-like
n_rep

Return the ‘n_rep’ array

Returns:n_rep – The vector of the n_rep values
Return type:array-like
num_of_replicas

Return the number of replicas

Returns:nrep – The number of replicas
Return type:int