Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add I/O wrappers to high-level gait functions #66

Merged
merged 10 commits into from
Oct 4, 2024
Merged

Conversation

Erikpostt
Copy link
Contributor

@Erikpostt Erikpostt commented Oct 2, 2024

Handles feature request #65 . Change of .bin files is intentional.

@Erikpostt Erikpostt requested a review from KarsVeldkamp October 2, 2024 13:17
@@ -80,7 +85,18 @@ def detect_gait(input_path: Union[str, Path], output_path: Union[str, Path], pat

# Make prediction
df['pred_gait_proba'] = clf.predict_proba(X)[:, 1]
df['pred_gait'] = df['pred_gait_proba'] > threshold
df['pred_gait'] = df['pred_gait_proba'] >= threshold
Copy link
Contributor

Choose a reason for hiding this comment

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

Sharp ;)

X = df.loc[:, clf.feature_names_in_]

# Make prediction
# df['pred_arm_swing_proba'] = clf.predict_proba(X)[:, 1]
df['pred_arm_swing'] = clf.predict(X)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is dit alleen een label of een probability?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dit is een probability (zie 'proba' in feature name). De reden dat ik deze weg haal vergt misschien wat uitleg.

Windows zijn overlapping, dus om een probability van een timestamp te bepalen pak je de windows die over deze timestamp heen gaan en pakt de mean. Dit kan je het beste doen met de probabilities, omdat de mean van de rounded predictions een ander resultaat kan geven. Bij PPP kijken we alleen niet per se naar voorspellingen per seconde, of per timestamp, en meer over een langere periode, dus is het naar mijn mening niet meer van belang om te dealen met overlapping windows. In dat geval kan je dus gewoon de rounded prediction pakken, in plaats van de probability.

@@ -379,6 +381,35 @@ def quantify_arm_swing(path_to_feature_input: Union[str, Path], path_to_predicti
df_aggregates['segment_duration_ms'] = df_aggregates['segment_duration_s'] * 1000
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this necessary for your code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was already present in the main branch. However, I think the reason why this is useful (especially in tsdf) is because the time column can now be stored as integer, instead of float.


# Validate
# Dataframes have same length
assert df_features.shape[0] == df_predictions.shape[0]
Copy link
Contributor

@KarsVeldkamp KarsVeldkamp Oct 4, 2024

Choose a reason for hiding this comment

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

Kan dit ook niet zo zijn dan? Of is dit redundant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In principe kan dit niet anders zijn, dus is het redundant. Het is een test die we in een heel vroeg stadium hebben toegevoegd, en die we later wel kunnen verwijderen als we weten dat het geen invloed heeft. Echter is het wel van belang dat ze hetzelfde zijn, anders kan de concatenation in een later stadium niet werken. Eigenlijk werkt de concatenation wel, maar krijg je vreemde resultaten, wat nog erger is (daarom heb je liever een warning/error).

Copy link
Contributor

@KarsVeldkamp KarsVeldkamp left a comment

Choose a reason for hiding this comment

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

Ha,
Het ziet er grotendeels heel logisch uit wat er gebeurd alleen heb ik wat comments nog geplaatst waar ik het zelf nog niet heel duidelijk vond.

Copy link
Contributor

@KarsVeldkamp KarsVeldkamp left a comment

Choose a reason for hiding this comment

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

Zie laatste comment

@Erikpostt Erikpostt assigned KarsVeldkamp and unassigned Erikpostt Oct 4, 2024
@biomarkersParkinson biomarkersParkinson deleted a comment from Erikpostt Oct 4, 2024
Copy link
Contributor

@KarsVeldkamp KarsVeldkamp left a comment

Choose a reason for hiding this comment

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

Well done! You have earned your weekend off

@KarsVeldkamp KarsVeldkamp merged commit 82a3a68 into main Oct 4, 2024
1 check passed
@KarsVeldkamp KarsVeldkamp deleted the io_wrapper branch October 4, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants