Ejemplo n.º 1
0
def test_multivariate_timeseries_transformation_ok():
    mv_timeseries = MultivariateTimeseries(
        [[1, 2, 3, 4, 5], [0, 1, 2, 3, 4]], [6, 7, 8, 9, 10], ['foo', 'bar'], 'baz'
    )
    matrix, output = mv_timeseries.convert_to_snapshot_matrix(2)
    assert_array_equal(
        matrix,
        array([[[1, 0], [2, 1], [3, 2]], [[2, 1], [3, 2], [4, 3]], [[3, 2], [4, 3], [5, 4]]]),
    )
    assert_array_equal(output, array([8, 9, 10]))
Ejemplo n.º 2
0
def test_mutlivariate_timeseries_transformation_from_dataframe_ok():
    mv_timeseries_df = DataFrame({'foo': [1, 2, 3], 'bar': [4, 5, 6], 'baz': [0, 0, 0]})
    mv_timeseries = MultivariateTimeseries.from_dataframe(mv_timeseries_df, ['foo', 'bar'], 'baz')
    assert mv_timeseries
    assert mv_timeseries.input_timeseries_collection[0].sequence == [1, 2, 3]
    assert mv_timeseries.input_timeseries_collection[1].sequence == [4, 5, 6]
    assert mv_timeseries.output_timeseries.sequence == [0, 0, 0]