예제 #1
0
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))
}
예제 #2
0
파일: roar.go 프로젝트: postfix/rlbayes
func PosteriorCFGDefault() (cfg PosteriorCFG) {
	cfg.Partition = 1
	cfg.Calpha, cfg.Galpha = 1, 1
	cfg.M = 1
	cfg.Psi = matrix.Eye(2)

	return
}