Skip to content

Commit

Permalink
resetting changes out of scope of this PR
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-p-2000 committed Jan 17, 2025
1 parent 140d8db commit 9bb5e28
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
5 changes: 2 additions & 3 deletions examples/classifiers/wrn_gru_mesa.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
set_nsrr_token,
)

set_nsrr_token("YOUR TOKEN HERE")
set_nsrr_token("your-token-here")

TRAIN = False # set to False to skip training and load classifier from disk
TRAIN = True # set to False to skip training and load classifier from disk

# silence warnings (which might pop up during feature extraction)
warnings.filterwarnings(
Expand All @@ -38,7 +38,6 @@
"recording_start_time",
"age",
"gender",
"activity_counts",
],
"min_rri": 0.3,
"max_rri": 2,
Expand Down
20 changes: 6 additions & 14 deletions examples/classifiers/ws_gru_mesa.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
prepare_data_keras,
print_class_balance,
read_mesa,
read_shhs,
save_classifier,
set_nsrr_token,
)

set_nsrr_token("YOUR TOKEN HERE")
set_nsrr_token("your-token-here")

TRAIN = False # set to False to skip training and load classifier from disk
TRAIN = True # set to False to skip training and load classifier from disk

# silence warnings (which might pop up during feature extraction)
warnings.filterwarnings(
Expand All @@ -37,7 +38,6 @@
"recording_start_time",
"age",
"gender",
"activity_counts",
],
"min_rri": 0.3,
"max_rri": 2,
Expand Down Expand Up @@ -105,18 +105,10 @@
clf = load_classifier("ws-gru-mesa", "./classifiers")

print("‣‣ Extracting features...")
# shhs = list(read_shhs(offline=False))
test_data = list(
read_mesa(
offline=False,
activity_source="actigraphy",
keep_edfs=True,
data_dir="D:/SleepData/",
records_pattern="2***",
)
)
shhs = list(read_shhs(offline=False))

features_test, stages_test, feature_ids = extract_features(
tqdm(test_data),
tqdm(shhs),
**clf.feature_extraction_params,
n_jobs=-1,
)
Expand Down
4 changes: 0 additions & 4 deletions src/sleepecg/feature_extraction.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"LF_HF_ratio",
),
"metadata": ("recording_start_time", "age", "gender", "weight"),
"actigraphy": ("activity_counts", "dummy_feature"),
}
_FEATURE_ID_TO_GROUP = {id: group for group, ids in _FEATURE_GROUPS.items() for id in ids}

Expand Down Expand Up @@ -657,9 +656,6 @@ def _extract_features_single(
)
elif feature_group == "metadata":
X.append(_metadata_features(record, num_stages))
elif feature_group == "actigraphy":
if record.activity_counts is not None:
X.append(record.activity_counts.reshape(-1, 1))
features = np.hstack(X)[:, col_indices]

if record.sleep_stages is None or sleep_stage_duration == record.sleep_stage_duration:
Expand Down

0 comments on commit 9bb5e28

Please sign in to comment.