def test_trim_2D(random): node = Pipeline(steps=dummy_classifier) data = DummyData(rate=1).next(20) node._X_train = data.values node._X_train_indices = np.array(data.index.values, dtype=np.datetime64) start = np.datetime64('2018-01-01T00:00:05') stop = np.datetime64('2018-01-01T00:00:15') node._dimensions = 2 node._accumulate(start, stop) assert len(node._X_train_indices) == 10 assert len(node._X_train) == 10
def test_trim_3D(random): node = Pipeline(steps=dummy_classifier) node.i_training_0.data = DummyData(start_date='2018-01-01T00:00:00').next() node.i_training_1.data = DummyData(start_date='2018-01-01T00:00:10').next() node.i_training_2.data = DummyData(start_date='2018-01-01T00:00:20').next() node.i_training_3.data = DummyData(start_date='2018-01-01T00:00:30').next() node.i_training_0.meta = { 'epoch': { 'context': { 'target': 1 }}} node.i_training_1.meta = { 'epoch': { 'context': { 'target': 2 }}} node.i_training_2.meta = { 'epoch': { 'context': { 'target': 3 }}} node.i_training_3.meta = { 'epoch': { 'context': { 'target': 4 }}} node._accumulation_start = np.datetime64('2017-12-31T00:00:00') node._accumulation_stop = np.datetime64('2018-01-01T00:01:00') node._status = 1 node.update() node._dimensions = 0 # Bypass accumulation start = np.datetime64('2018-01-01T00:00:05') stop = np.datetime64('2018-01-01T00:00:25') node._accumulate(start, stop) assert len(node._X_train_indices) == 2 assert len(node._X_train) == 2 assert len(node._y_train) == 2 assert node._y_train.tolist() == [2, 3]