예제 #1
0
 def test_aggregation_max(self):
     columnName = TupleValueExpression(col_name=0)
     aggr_expr = AggregationExpression(
         ExpressionType.AGGREGATION_MAX,
         None,
         columnName
     )
     tuples = Batch(pd.DataFrame({0: [1, 2, 3], 1: [2, 3, 4], 2: [3, 4, 5]}))
     self.assertEqual(3, aggr_expr.evaluate(tuples, None))
예제 #2
0
 def test_aggregation_min(self):
     columnName = TupleValueExpression(col_name=0)
     aggr_expr = AggregationExpression(
         ExpressionType.AGGREGATION_MIN,
         None,
         columnName
     )
     tuples = Batch(pd.DataFrame(
         {0: [1, 2, 3], 1: [2, 3, 4], 2: [3, 4, 5]}))
     batch = aggr_expr.evaluate(tuples, None)
     self.assertEqual(1, batch.frames.iloc[0][0])
예제 #3
0
    def test_aggregation_min(self):
        columnName = TupleValueExpression(0)
        aggr_expr = AggregationExpression(
            ExpressionType.AGGREGATION_MIN,
            None,
            columnName
        )

        frame_1 = Frame(1, np.ones((1, 1)), None)
        frame_2 = Frame(2, 2 * np.ones((1, 1)), None)
        frame_3 = Frame(3, 3 * np.ones((1, 1)), None)
        outcome_1 = Prediction(frame_1, ["car", "bus"], [0.5, 0.6])
        outcome_2 = Prediction(frame_2, ["bus"], [0.5, 0.6])
        outcome_3 = Prediction(frame_3, ["car", "train"], [0.5, 0.6])
        input_batch = FrameBatch(frames=[
            frame_1,
            frame_2,
            frame_3,
        ], info=None)

        expected_value = 1
        output_value  = aggr_expr.evaluate(input_batch)
        self.assertEqual(expected_value, output_value)
예제 #4
0
 def test_aggregation_max(self):
     columnName = TupleValueExpression(col_idx=0)
     aggr_expr = AggregationExpression(ExpressionType.AGGREGATION_MAX, None,
                                       columnName)
     tuples = [[1, 2, 3], [2, 3, 4], [3, 4, 5]]
     self.assertEqual(3, aggr_expr.evaluate(tuples, None))