-
Notifications
You must be signed in to change notification settings - Fork 6
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
Chore: First class predictions #187
base: main
Are you sure you want to change the base?
Conversation
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 is already giving me peace of mind! 🧘
Seeing it all clearly in one spot did raise some questions. Let me know if any of it doesn't make sense. Happy to elaborate!
Nicer union syntax Co-authored-by: Cas Wognum <[email protected]>
Co-authored-by: Cas Wognum <[email protected]>
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.
Great work @cwognum and @kiramclean 🚀
I think this PR is very clean and adds much needed structure to prediction objects, thank you. I've added some comments but I don't think any are blocking.
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 looks very fine indeed. I had some suggestions, nothing blocking.
return predictions | ||
|
||
@classmethod | ||
def _convert_lists_to_arrays(cls, predictions: IncomingPredictionsType) -> IncomingPredictionsType: |
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.
Suggestion
This could go outside the class. Maybe even in the utils
module.
return True | ||
|
||
@classmethod | ||
def _check_test_set_size( |
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.
Suggestion
This could also be a function outside the class.
predictions = cls._normalize_predictions(predictions, target_labels, test_set_labels) | ||
|
||
# Normalize the predictions to a standard representation | ||
cls._check_test_set_size(predictions, test_set_sizes) |
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.
Comment
I feel like this would be a better for an after model validator. That would fit better with the intent of the Pydantic validator API.
return False | ||
|
||
# Inner-level of the dictionary should correspond to the target columns | ||
for _, test_set_predictions in predictions.items(): |
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.
Suggestion
for _, test_set_predictions in predictions.items(): | |
for test_set_predictions in predictions.values(): |
} | ||
|
||
@classmethod | ||
def _normalize_predictions( |
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.
Comment
This is very nice. Very soothing to me. 😄
Changelogs
Checklist:
feature
,fix
,chore
,documentation
ortest
(or ask a maintainer to do it for you).