Documentation ¶
Index ¶
- func RandomBipartiteGraph(leftDegrees, rightDegrees []int, maxTries int) (edges [][2]int, err error)
- type MultipleBSCModel
- func (model *MultipleBSCModel) AddChannel(name string, noise float64)
- func (model *MultipleBSCModel) AddObservation(input, channel string, value bool)
- func (model *MultipleBSCModel) EM(maxRounds int, tolerance float64, ...)
- func (model MultipleBSCModel) HasChannel(name string) bool
- func (model MultipleBSCModel) HasInput(name string) bool
- func (model MultipleBSCModel) Score() float64
- type MultipleBSCPairModel
- func (model *MultipleBSCPairModel) AddChannel(name1 string, noise1 float64, name2 string, noise2 float64)
- func (model *MultipleBSCPairModel) AddObservation(input, channel1, channel2 string, value bool)
- func (model *MultipleBSCPairModel) EM(maxRounds int, tolerance float64, ...)
- func (model MultipleBSCPairModel) HasChannel(name1, name2 string) bool
- func (model MultipleBSCPairModel) HasInput(name string) bool
- func (model MultipleBSCPairModel) Score() float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RandomBipartiteGraph ¶
func RandomBipartiteGraph(leftDegrees, rightDegrees []int, maxTries int) (edges [][2]int, err error)
Generates a random bipartite graph with the specified node degrees. The graph is selected approximately uniformly at random from the space of all graphs with the specified node degrees. Implements the algorithm in:
M. Bayati, J. H. Kim, and A. Saberi, "A Sequential Algorithm for Generating Random Graphs," Algorithmica, vol. 58, no. 4, pp. 860–910, 2010.
If successful, returns a list of edges. Each edge contains an index from the left nodes and an index from the right nodes.
Types ¶
type MultipleBSCModel ¶
type MultipleBSCModel struct { // The variables sent over the noisy channels Inputs map[string]*variable.DiscreteRV // The posterior probability that each latent input variable is true InputScores map[string]float64 // Whether to use soft or hard assignments to inputs during inference SoftInputs bool // The noisy channels Channels map[string]*bsc.BSC // A factor graph relating inputs to outputs FactorGraph *factor.FactorGraph }
A noisy channel model which explains a data set as passing through one of a set of BSC channels with unknown noise rates. For instance, this can be used to infer the answers of independent binary-valued crowdsourcing questions.
func NewMultipleBSCModel ¶
func NewMultipleBSCModel() *MultipleBSCModel
Create a new MultipleBSCModel
func (*MultipleBSCModel) AddChannel ¶
func (model *MultipleBSCModel) AddChannel(name string, noise float64)
Adds a new BSC to the model with the given name and noise rate.
func (*MultipleBSCModel) AddObservation ¶
func (model *MultipleBSCModel) AddObservation(input, channel string, value bool)
Adds a new observation to the model for the given channel and input. If the input is new, it will be created automatically.
func (*MultipleBSCModel) EM ¶
func (model *MultipleBSCModel) EM(maxRounds int, tolerance float64, callback func(model *MultipleBSCModel, round int, stage string))
Train noise rates and input values using expectation maximization.
func (MultipleBSCModel) HasChannel ¶
func (model MultipleBSCModel) HasChannel(name string) bool
Ask whether a given channel exists
func (MultipleBSCModel) HasInput ¶
func (model MultipleBSCModel) HasInput(name string) bool
Ask whether a given input exists
func (MultipleBSCModel) Score ¶
func (model MultipleBSCModel) Score() float64
Score the model, using the current parameter values
type MultipleBSCPairModel ¶
type MultipleBSCPairModel struct {
// The noise rates
Noise1Rates, Noise2Rates map[string]*variable.ContinuousRV
// The variables sent over the noisy channels
Inputs map[string]*variable.DiscreteRV
// The posterior probability that each latent input variable is true
InputScores map[string]float64
// Whether to use soft or hard assignments to inputs during inference
SoftInputs bool
// The noisy channels
Channels map[string]map[string]*bsc.BSCPair
// A factor graph relating inputs to outputs
FactorGraph *factor.FactorGraph
}
A noisy channel model which explains a data set as passing through one of a set of BSC channels with unknown noise rates. For instance, this can be used to infer the answers of independent binary-valued crowdsourcing questions.
func NewMultipleBSCPairModel ¶
func NewMultipleBSCPairModel() *MultipleBSCPairModel
Create a new MultipleBSCPairModel
func (*MultipleBSCPairModel) AddChannel ¶
func (model *MultipleBSCPairModel) AddChannel(name1 string, noise1 float64, name2 string, noise2 float64)
Adds a new BSCPair to the model with the given layer names and noise rates. If a given noise rate has already been added, it will not be changed.
func (*MultipleBSCPairModel) AddObservation ¶
func (model *MultipleBSCPairModel) AddObservation(input, channel1, channel2 string, value bool)
Adds a new observation to the model for the given channel and input. If the input is new, it will be created automatically.
func (*MultipleBSCPairModel) EM ¶
func (model *MultipleBSCPairModel) EM(maxRounds int, tolerance float64, callback func(model *MultipleBSCPairModel, round int, stage string))
Train noise rates and input values using expectation maximization.
func (MultipleBSCPairModel) HasChannel ¶
func (model MultipleBSCPairModel) HasChannel(name1, name2 string) bool
Ask whether a given channel exists
func (MultipleBSCPairModel) HasInput ¶
func (model MultipleBSCPairModel) HasInput(name string) bool
Ask whether a given input exists
func (MultipleBSCPairModel) Score ¶
func (model MultipleBSCPairModel) Score() float64
Score the model, using the current parameter values