Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,7 @@ feature_dynamics_interpretation.pdf
feature_dynamics_interpretation.md
# dask
dask-worker-space
dask-worker-space/
dask-worker-space/

tests/*/__pycache__/
tests/*/*/__pycache__/
2 changes: 1 addition & 1 deletion tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -1271,4 +1271,4 @@ def create_split_up_test_data_expected_tuples_wide(self):
),
),
]
return (wide_test_data_expected_chunked_up_tuples, window_length)
return (wide_test_data_expected_chunked_up_tuples, window_length)
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,4 @@ def test_zero_split_size_dask(self):
pass

def test_fractional_split_size_dask(self):
pass
pass
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,87 @@ def test_extract_feature_dynamics_alphabetically_sorted(self):

self.assertEqual(col_name_chunks, list(sorted(col_name_chunks)))

def test_extract_feature_dynamics_wide(self):
ts_wide_df,_,_ = self.create_simple_test_data_sample_wide()

fc_test_params = {"minimum": None}
window_length = 3

extracted_feature_dynamics = extract_feature_dynamics(
timeseries_container=ts_wide_df,
column_id="id",
column_sort="sort",
column_kind=None, #"kind", None since wide format
column_value=None, #"val",
n_jobs= 1,#self.n_jobs,
feature_timeseries_fc_parameters={window_length: fc_test_params},
feature_dynamics_fc_parameters={window_length: fc_test_params},
)

expected_ans = pd.DataFrame(
data={
'y1||minimum@window_3__minimum': {1: 1.0, 2: -34.0},
'y2||minimum@window_3__minimum': {1: -10.0, 2: 3.0},
'y3||minimum@window_3__minimum': {1: 4.0, 2: 1.0}
}
)

pd.testing.assert_frame_equal(extracted_feature_dynamics, expected_ans)

def test_extract_feature_dynamics_long(self):

ts_long_df,_,_ = self.create_simple_test_data_sample_stacked()

fc_test_params = {"minimum": None}
window_length = 3

extracted_feature_dynamics = extract_feature_dynamics(
timeseries_container=ts_long_df,
column_id="id",
column_sort="sort",
column_kind="kind", #None since wide format
column_value="val",
n_jobs= 1,#self.n_jobs,
feature_timeseries_fc_parameters={window_length: fc_test_params},
feature_dynamics_fc_parameters={window_length: fc_test_params},
)

expected_ans = pd.DataFrame(
data={
'y1||minimum@window_3__minimum': {1: 1.0, 2: -34.0},
'y2||minimum@window_3__minimum': {1: -10.0, 2: 3.0},
'y3||minimum@window_3__minimum': {1: 4.0, 2: 1.0}
}
)

pd.testing.assert_frame_equal(extracted_feature_dynamics, expected_ans)

def test_extract_feature_dynamics_dict(self):

ts_list_of_dicts = self.create_simple_test_data_sample_dict()
fc_test_params = {"minimum": None}
window_length = 3

extracted_feature_dynamics = extract_feature_dynamics(
timeseries_container=ts_list_of_dicts,
column_id="id",
column_sort="sort",
column_kind=None, #None since wide format
column_value="val",
n_jobs= 1,#self.n_jobs,
feature_timeseries_fc_parameters={window_length: fc_test_params},
feature_dynamics_fc_parameters={window_length: fc_test_params},
)

expected_ans = pd.DataFrame(
data={
'y1||minimum@window_3__minimum': {1: 1.0, 2: -34.0},
'y2||minimum@window_3__minimum': {1: -10.0, 2: 3.0},
'y3||minimum@window_3__minimum': {1: 4.0, 2: 1.0}
}
)

pd.testing.assert_frame_equal(extracted_feature_dynamics, expected_ans)

class ParallelDynamicsExtractionTestCase(DataTestCase):
def setUp(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pandas as pd
from pandas.api.types import is_numeric_dtype
from typing import List
from md2pdf.core import md2pdf
#from md2pdf.core import md2pdf
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can ignore - just needed to change to fix depedencies on my end

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an alternate option to md2pfd that we could look at
image

from tsfresh.feature_extraction import feature_calculators
from tsfresh.utilities.string_manipulation import get_config_from_string
from tsfresh.feature_extraction.data import (
Expand Down