Documentation ¶
Index ¶
- func Accuracy(S spn.SPN, T spn.Dataset, U []int, Sc map[int]*learn.Variable)
- type DVModel
- func (M *DVModel) Infer(I spn.VarSet) (int, []float64)
- func (M *DVModel) LearnDiscriminative(D spn.Dataset, L []int, Sc map[int]*learn.Variable)
- func (M *DVModel) LearnGenerative(D spn.Dataset, L []int, Sc map[int]*learn.Variable)
- func (M *DVModel) LearnStructure(D spn.Dataset, L []int, Sc map[int]*learn.Variable)
- func (M *DVModel) Save(filename string) error
- func (M *DVModel) TestAccuracy(D spn.Dataset, L []int)
- type GensModel
- func (M *GensModel) Infer(I spn.VarSet) (int, []float64)
- func (M *GensModel) LearnDiscriminative(D spn.Dataset, L []int, Sc map[int]*learn.Variable)
- func (M *GensModel) LearnGenerative(D spn.Dataset, L []int, Sc map[int]*learn.Variable)
- func (M *GensModel) LearnStructure(D spn.Dataset, L []int, Sc map[int]*learn.Variable)
- func (M *GensModel) Save(filename string) error
- func (M *GensModel) TestAccuracy(D spn.Dataset, L []int)
- type Model
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DVModel ¶
type DVModel struct { S []spn.SPN // Each sub-SPN S[i] is restricted to label i. Y *learn.Variable // Y is the query variable. Namely the direction variable. // contains filtered or unexported fields }
DVModel is an SPN based on the Dennis-Ventura algorithm (gospn/learn/dennis), but optimized for parallel programming. We assume that we have at least 4 CPU cores (e.g. Raspberry Pi B+).
func LoadDVModel ¶
func (*DVModel) Infer ¶
Infer takes an instance X and returns argmax_y P(Y=y|X), where Y is the query variable set on construction. Returns the most probable label and its probability.
func (*DVModel) LearnDiscriminative ¶
LearnDiscriminative fits the DVModel to the dataset (D, L) and scope Sc.
func (*DVModel) LearnGenerative ¶
LearnGenerative fits the DVModel to the dataset (D, L) and scope Sc.
func (*DVModel) LearnStructure ¶
LearnStructure learns only the DV structure.
type GensModel ¶
func LoadGensModel ¶
func NewGensModel ¶
func (*GensModel) LearnDiscriminative ¶
func (*GensModel) LearnGenerative ¶
func (*GensModel) LearnStructure ¶
type Model ¶
type Model interface { // LearnStructure generates only the structure. LearnStructure(D spn.Dataset, L []int, Sc map[int]*learn.Variable) // LearnGenerative generates the structure and then applies generative gradient descent learning // on the model. LearnGenerative(D spn.Dataset, L []int, Sc map[int]*learn.Variable) // LearnDiscriminative generates the structure and then applies discriminative gradient descent // learning on the model. LearnDiscriminative(D spn.Dataset, L []int, Sc map[int]*learn.Variable) // Infer takes an instance spn.VarSet and returns the prediction and its probabilities. Infer(I spn.VarSet) (int, []float64) // TestAccuracy runs an accuracy test with a test dataset (D, L). TestAccuracy(D spn.Dataset, L []int) // Save saves this model to a file. Save(filename string) error }
Click to show internal directories.
Click to hide internal directories.