Example #1
0
func TestComputeDiscrete(t *testing.T) {
	gini := gini.Gini{}
	target := make([]string, len(targetValues))

	for _, sample := range discreteSamples {
		copy(target, targetValues)

		fmt.Println("target:", target)
		fmt.Println("data:", sample)

		gini.ComputeDiscrete(&sample, &discreteValues, &target,
			&classes)

		fmt.Println(gini)
	}
}
Example #2
0
func TestComputeContinu(t *testing.T) {
	target := make([]string, len(targetValues))

	copy(target, targetValues)

	fmt.Println("target:", target)

	fmt.Println("data:", data[0])
	GINI := gini.Gini{}
	GINI.ComputeContinu(&data[0], &target, &classes)
	fmt.Println(">>> gini:", GINI)

	fmt.Println("data:", data[1])
	GINI = gini.Gini{}
	GINI.ComputeContinu(&data[1], &target, &classes)
	fmt.Println(">>> gini:", GINI)
}