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

Chore: First class predictions #187

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open

Conversation

kirahowe
Copy link
Contributor

@kirahowe kirahowe commented Sep 1, 2024

Changelogs


Checklist:

  • Was this PR discussed in an issue? It is recommended to first discuss a new feature into a GitHub issue before opening a PR.
  • Add tests to cover the fixed bug(s) or the newly introduced feature(s) (if appropriate).
  • Update the API documentation if a new function is added, or an existing one is deleted.
  • Write concise and explanatory changelogs above.
  • If possible, assign one of the following labels to the PR: feature, fix, chore, documentation or test (or ask a maintainer to do it for you).

Copy link
Collaborator

@cwognum cwognum left a 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!

polaris/utils/types.py Outdated Show resolved Hide resolved
polaris/utils/types.py Outdated Show resolved Hide resolved
tests/test_benchmark_predictions.py Outdated Show resolved Hide resolved
docs/api/competition.evaluation.md Outdated Show resolved Hide resolved
polaris/benchmark/_base.py Outdated Show resolved Hide resolved
polaris/benchmark/predictions/_base.py Outdated Show resolved Hide resolved
polaris/benchmark/predictions/_base.py Outdated Show resolved Hide resolved
polaris/evaluate/utils.py Outdated Show resolved Hide resolved
polaris/evaluate/utils.py Outdated Show resolved Hide resolved
polaris/evaluate/utils.py Outdated Show resolved Hide resolved
@cwognum cwognum self-assigned this Sep 11, 2024
@cwognum cwognum changed the title First class predictions Feature: First class predictions Sep 11, 2024
@cwognum cwognum changed the title Feature: First class predictions Chore: First class predictions Sep 11, 2024
Copy link
Contributor

@Andrewq11 Andrewq11 left a 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.

polaris/benchmark/_base.py Outdated Show resolved Hide resolved
polaris/evaluate/_predictions.py Outdated Show resolved Hide resolved
polaris/evaluate/_predictions.py Outdated Show resolved Hide resolved
polaris/evaluate/_predictions.py Outdated Show resolved Hide resolved
polaris/evaluate/_predictions.py Show resolved Hide resolved
polaris/evaluate/_predictions.py Outdated Show resolved Hide resolved
polaris/evaluate/_results.py Show resolved Hide resolved
polaris/evaluate/utils.py Outdated Show resolved Hide resolved
polaris/utils/types.py Show resolved Hide resolved
tests/test_benchmark_predictions.py Outdated Show resolved Hide resolved
Copy link
Contributor

@jstlaurent jstlaurent left a 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:
Copy link
Contributor

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 utilsmodule.

return True

@classmethod
def _check_test_set_size(
Copy link
Contributor

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)
Copy link
Contributor

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():
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion

Suggested change
for _, test_set_predictions in predictions.items():
for test_set_predictions in predictions.values():

}

@classmethod
def _normalize_predictions(
Copy link
Contributor

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. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants