Ejemplo n.º 1
0
    def test_adding_batch_frame_with_outcomes_returns_new_batch_frame(self):
        batch_1 = Batch(frames=create_dataframe())
        batch_2 = Batch(frames=create_dataframe())

        batch_3 = Batch(frames=create_dataframe_same(2))

        self.assertEqual(batch_3, batch_1 + batch_2)
Ejemplo n.º 2
0
 def test_fetching_frames_by_index_should_also_return_temp_outcomes(self):
     batch = Batch(frames=create_dataframe_same(2),
                   outcomes={'test': [[1], [2]]},
                   temp_outcomes={'test2': [[3], [4]]})
     expected = Batch(frames=create_dataframe(),
                      outcomes={'test': [[1]]},
                      temp_outcomes={'test2': [[3]]})
     self.assertEqual(expected, batch[[0]])
Ejemplo n.º 3
0
    def test_adding_batch_frame_with_outcomes_returns_new_batch_frame(self):
        batch_1 = Batch(frames=create_dataframe(),
                        outcomes={'1': [1]},
                        temp_outcomes={'2': [1]})
        batch_2 = Batch(frames=create_dataframe(),
                        outcomes={'1': [2]},
                        temp_outcomes={'2': [2]})

        batch_3 = Batch(frames=create_dataframe_same(2),
                        outcomes={'1': [1, 2]},
                        temp_outcomes={'2': [1, 2]})

        self.assertEqual(batch_3, batch_1 + batch_2)
Ejemplo n.º 4
0
 def test_frames_as_numpy_array_should_frames_as_numpy_array(self):
     batch = Batch(frames=create_dataframe_same(2))
     expected = list(np.ones((2, 1, 1)))
     actual = list(batch.column_as_numpy_array())
     self.assertEqual(expected, actual)
Ejemplo n.º 5
0
 def test_add_should_get_new_batch_frame_with_addition_no_outcomes(self):
     batch_1 = Batch(frames=create_dataframe())
     batch_2 = Batch(frames=create_dataframe())
     batch_3 = Batch(frames=create_dataframe_same(2))
     self.assertEqual(batch_3, batch_1 + batch_2)
Ejemplo n.º 6
0
 def test_fetching_frames_by_index(self):
     batch = Batch(frames=create_dataframe_same(2))
     expected = Batch(frames=create_dataframe())
     self.assertEqual(expected, batch[[0]])
Ejemplo n.º 7
0
 def test_concat_batch(self):
     batch_1 = Batch(frames=create_dataframe())
     batch_2 = Batch(frames=create_dataframe())
     batch_3 = Batch(frames=create_dataframe_same(2))
     self.assertEqual(batch_3, Batch.concat([batch_1, batch_2], copy=False))
Ejemplo n.º 8
0
 def test_fetching_frames_by_index_should_raise(self):
     batch = Batch(frames=create_dataframe_same(2))
     with self.assertRaises(TypeError):
         batch[1.0]
Ejemplo n.º 9
0
 def test_fetching_frames_by_index_should_also_return_outcomes(self):
     batch = FrameBatch(frames=create_dataframe_same(2),
                        outcomes={'test': [[None], [None]]})
     expected = FrameBatch(frames=create_dataframe(),
                           outcomes={'test': [[None]]})
     self.assertEqual(expected, batch[[0]])