mockBinaryTree.EXPECT().InsertLeft(leftDecisionTree) mockBinaryTree.EXPECT().InsertRight(rightDecisionTree) keySetCall = mockBinaryTree.EXPECT().Set(nextKey).AnyTimes() rightAnyCall = rightInputLog.EXPECT().Any().Return(false) leftAnyCall = leftInputLog.EXPECT().Any().Return(false) }) Context("and the deciding feature has positive entries", func() { BeforeEach(func() { rightAnyCall.Return(true) }) It("recurses on the right input set", func() { rightDecisionTree.EXPECT().Train(rightInputLog, targetKey) myTree.Train(inputLog, targetKey) }) }) Context("and the deciding feature has negative entries", func() { BeforeEach(func() { leftAnyCall.Return(true) }) It("recurses on the left input set", func() { leftDecisionTree.EXPECT().Train(leftInputLog, targetKey) myTree.Train(inputLog, targetKey) })
predictionForestInputSet = il.InputLog{ {"1", "3"}, {"0", "1", "3"}, {"1", "3"}, {"0", "1", "3"}, {"1", "2"}, {"0", "1", "2"}, {}, {"0"}, } }) It("Builds a map of decision trees targeted at each input", func() { gomock.InOrder( mockDecisionTree.EXPECT().Train(gomock.Any(), gomock.Any()), mockDecisionTree.EXPECT().Train(gomock.Any(), gomock.Any()), mockDecisionTree.EXPECT().Train(gomock.Any(), gomock.Any()), mockDecisionTree.EXPECT().Train(gomock.Any(), gomock.Any()), ) myForest = pf.New().(*pf.PredictionForest) myForest.Train(predictionForestInputSet) }) }) Describe("Predict", func() { var ( mockHelloTree, mockWorldTree *mdt.MockInterface )