def test_has_outcomes_returns_true_if_the_given_name_is_in_outcomes(self): batch = FrameBatch(frames=create_dataframe()) batch.set_outcomes('test_temp', [1], is_temp=True) batch.set_outcomes('test', [1]) self.assertTrue(batch.has_outcome('test')) self.assertTrue(batch.has_outcome('test_temp'))
def test_set_outcomes_method_should_set_temp_outcome_when_bool_is_true( self): batch = FrameBatch(frames=create_dataframe()) batch.set_outcomes('test', [1], is_temp=True) expected = FrameBatch(frames=create_dataframe(), temp_outcomes={'test': [1]}) self.assertEqual(expected, batch)
def test_has_outcomes_returns_true_if_the_given_name_is_in_outcomes(self): batch = FrameBatch(frames=[Frame(1, np.ones((1, 1)), None)], info=None) batch.set_outcomes('test_temp', [1], is_temp=True) batch.set_outcomes('test', [1]) self.assertTrue(batch.has_outcome('test')) self.assertTrue(batch.has_outcome('test_temp'))
def test_set_outcomes_method_should_set_temp_outcome_when_bool_is_true( self): batch = FrameBatch(frames=[Frame(1, np.ones((1, 1)), None)], info=None) batch.set_outcomes('test', [1], is_temp=True) expected = FrameBatch(frames=[Frame(1, np.ones((1, 1)), None)], info=None, temp_outcomes={'test': [1]}) self.assertEqual(expected, batch)
def evaluate(self, batch: FrameBatch): args = [] if self.get_children_count() > 0: child = self.get_child(0) args.append(child.evaluate(batch)) else: args.append(batch) outcome = self.function(*args) if self.mode == ExecutionMode.EXEC: batch.set_outcomes(self.name, outcome, is_temp=self.is_temp) return outcome
def test_set_outcomes_method_should_set_the_predictions_with_udf_name( self): batch = FrameBatch(frames=create_dataframe()) batch.set_outcomes('test', [None]) self.assertEqual([None], batch.get_outcomes_for('test'))
def test_set_outcomes_method_should_set_the_predictions_with_udf_name( self): batch = FrameBatch(frames=[Frame(1, np.ones((1, 1)), None)], info=None) batch.set_outcomes('test', [None]) self.assertEqual([None], batch.get_outcomes_for('test'))