GH-18: feat(pipeline): Add serialization for pipeline scores#61
GH-18: feat(pipeline): Add serialization for pipeline scores#61
Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds serialization support for pipeline scores by implementing Pydantic models and serialization logic to handle both classification and regression score types as a discriminated union.
- Implements
ClassificationScoreandRegressionScorePydantic models with type discrimination - Adds
serialize_scoresfunction to convert getML scores into the new models with type validation - Updates
PipelineInformationmodel to include the newscoresfield with comprehensive test coverage
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/getml_io/getml/scores.py |
Defines Pydantic models for classification and regression scores with discriminated union |
src/getml_io/serialize/pipeline.py |
Implements score serialization logic with type validation and error handling |
src/getml_io/serialize/exception.py |
Adds custom exception for score type mismatches during serialization |
src/getml_io/metadata/pipeline_information.py |
Updates PipelineInformation model to include scores field |
| Test files | Comprehensive test coverage for score serialization and pipeline information updates |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request introduces serialization for pipeline scores, a valuable addition. The implementation is well-structured, defining Pydantic models for different score types, adding serialization logic, and including comprehensive tests. My review focuses on a few areas for improvement: refining the Pydantic model for scores to be more idiomatic and flexible, optimizing the serialization functions for better performance and readability, and strengthening the test assertions to be more comprehensive.
4a919d7 to
d8cdb40
Compare
8e973bd to
a34c757
Compare
Adds Pydantic models and serialization logic for `pipeline.scores`. This includes support for both classification and regression scores, which are handled as a discriminated union. - Defines `ClassificationScore` and `RegressionScore` Pydantic models. - Implements `serialize_scores` to convert getML scores into the new models. - Adds a custom `WrongPipelineScoreTypeError` exception for score type mismatches during serialization. - Updates the `PipelineInformation` model and associated tests to include the new `scores` field. Resolves #18
d8cdb40 to
a8d9594
Compare
Adds Pydantic models and serialization logic for
pipeline.scores. This includes support for both classification and regression scores, which are handled as a discriminated union.ClassificationScoreandRegressionScorePydantic models.serialize_scoresto convert getML scores into the new models.WrongPipelineScoreTypeErrorexception for score type mismatches during serialization.PipelineInformationmodel and associated tests to include the newscoresfield.Resolves #18