Esempio n. 1
0
func (self *PredictionForest) Train(inputLog il.Interface) {
	for _, key := range inputLog.Keys() {
		var newTree dt.Interface
		newTree = dt.New()
		newTree.Train(inputLog, key)
		self.Trees[key] = newTree
	}
}
Esempio n. 2
0
var (
	mockCtrl        *gomock.Controller
	myTree          dt.Interface
	mockBinaryTree  *mbt.MockInterface
	binaryTreeNew   func() bt.Interface = bt.New
	decisionTreeNew func() dt.Interface = dt.New
)

var _ = Describe("DecisionTree", func() {
	BeforeEach(func() {
		mockCtrl = gomock.NewController(gomocktestreporter.New())
		mockBinaryTree = mbt.NewMockInterface(mockCtrl)
		bt.New = func() bt.Interface {
			return mockBinaryTree
		}
		myTree = dt.New()
	})

	AfterEach(func() {
		mockCtrl.Finish()

		bt.New = binaryTreeNew
		dt.New = decisionTreeNew
	})

	Describe("#Train", func() {
		var (
			inputLog, leftInputLog, rightInputLog *mil.MockInterface
			targetKey, nextKey                    string
			maxEntropyCall                        *gomock.Call
			keyCountCall                          *gomock.Call