-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathexample.py
More file actions
34 lines (29 loc) · 978 Bytes
/
example.py
File metadata and controls
34 lines (29 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from whar_datasets import (
WINDOW_TIME_MEDIUM,
Loader,
LOSOSplitter,
PostProcessingPipeline,
PreProcessingPipeline,
TorchAdapter,
WHARDatasetID,
get_dataset_cfg,
)
# create cfg for WISDM dataset
cfg = get_dataset_cfg(WHARDatasetID.WISDM)
cfg.window_time = WINDOW_TIME_MEDIUM
# create and run pre-processing pipeline
pre_pipeline = PreProcessingPipeline(cfg)
activity_df, session_df, window_df = pre_pipeline.run()
# create LOSO splits
splitter = LOSOSplitter(cfg)
splits = splitter.get_splits(session_df, window_df)
split = splits[0]
# create and run post-processing pipeline for the specific split
post_pipeline = PostProcessingPipeline(
cfg, pre_pipeline, window_df, split.train_indices
)
samples = post_pipeline.run()
# create dataloaders for the specific split
loader = Loader(session_df, window_df, post_pipeline.samples_dir, samples)
adapter = TorchAdapter(cfg, loader, split)
dataloaders = adapter.get_dataloaders(batch_size=64)