示例#1
0
    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'))
示例#2
0
 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)
示例#3
0
    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'))
示例#4
0
 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)
示例#5
0
    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
示例#6
0
 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'))
示例#7
0
 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'))