-
Notifications
You must be signed in to change notification settings - Fork 0
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
Conversation
@@ -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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sharp ;)
src/paradigma/gait_analysis.py
Outdated
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
src/paradigma/gait_analysis.py
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
There was a problem hiding this 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zie laatste comment
There was a problem hiding this 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
Handles feature request #65 . Change of
.bin
files is intentional.