func TestScatterRatio(t *testing.T) { points := []*matrix.DenseMatrix{ matrix.MakeDenseMatrix([]float64{-1, 0}, 2, 1), matrix.MakeDenseMatrix([]float64{1, 0}, 2, 1), matrix.MakeDenseMatrix([]float64{0, 1}, 2, 1), matrix.MakeDenseMatrix([]float64{0, -1}, 2, 1), } iw1 := NewIWPosterior(1, matrix.Eye(2)) iw2 := NewIWPosterior(1, matrix.Eye(2)) scatter1 := NewScatter(2) scatter2 := NewScatter(2) for _, point := range points { scatter1.Insert(point) offset, _ := point.PlusDense(matrix.MakeDenseMatrix([]float64{5, 0}, 2, 1)) scatter2.Insert(offset) } iw1.InsertScatter(scatter1) iw2.InsertScatter(scatter2) fmt.Printf("%f\n", iw1.InsertScatterLogRatio(scatter1)) fmt.Printf("%f\n", iw1.InsertScatterLogRatio(scatter2)) fmt.Printf("%f\n", iw2.InsertScatterLogRatio(scatter1)) fmt.Printf("%f\n", iw2.InsertScatterLogRatio(scatter2)) }
func PosteriorCFGDefault() (cfg PosteriorCFG) { cfg.Partition = 1 cfg.Calpha, cfg.Galpha = 1, 1 cfg.M = 1 cfg.Psi = matrix.Eye(2) return }