-
Notifications
You must be signed in to change notification settings - Fork 7
Claude generated feedback #1022
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,10 @@ | ||
| from citrine._serialization import properties | ||
| from citrine._serialization.polymorphic_serializable import PolymorphicSerializable | ||
| from citrine._serialization.serializable import Serializable | ||
| from citrine.informatics.predictor_evaluation_metrics import PredictorEvaluationMetric | ||
| from citrine.informatics.data_sources import DataSource | ||
| from citrine.informatics.predictor_evaluation_metrics import PredictorEvaluationMetric | ||
|
|
||
| __all__ = ['PredictorEvaluator', | ||
| 'CrossValidationEvaluator', | ||
| 'HoldoutSetEvaluator' | ||
| ] | ||
| __all__ = ["PredictorEvaluator", "CrossValidationEvaluator", "HoldoutSetEvaluator"] | ||
|
|
||
|
|
||
| class PredictorEvaluator(PolymorphicSerializable["PredictorEvaluator"]): | ||
|
|
@@ -18,21 +15,23 @@ def get_type(cls, data) -> type[Serializable]: | |
| """Return the subtype.""" | ||
| return { | ||
| "CrossValidationEvaluator": CrossValidationEvaluator, | ||
| "HoldoutSetEvaluator": HoldoutSetEvaluator | ||
| "HoldoutSetEvaluator": HoldoutSetEvaluator, | ||
| }[data["type"]] | ||
|
|
||
| def __eq__(self, other): | ||
| if isinstance(other, Serializable): | ||
| self_dict = self.dump() | ||
| other_dict = other.dump() | ||
|
|
||
| self_dict['responses'] = set(self_dict.get('responses', [])) | ||
| self_dict['metrics'] = frozenset( | ||
| frozenset((k, v) for k, v in dct.items()) for dct in self_dict.get('metrics', []) | ||
| self_dict["responses"] = set(self_dict.get("responses", [])) | ||
| self_dict["metrics"] = frozenset( | ||
| frozenset((k, v) for k, v in dct.items()) | ||
| for dct in self_dict.get("metrics", []) | ||
| ) | ||
| other_dict['responses'] = set(other_dict.get('responses', [])) | ||
| other_dict['metrics'] = frozenset( | ||
| frozenset((k, v) for k, v in dct.items()) for dct in other_dict.get('metrics', []) | ||
| other_dict["responses"] = set(other_dict.get("responses", [])) | ||
| other_dict["metrics"] = frozenset( | ||
| frozenset((k, v) for k, v in dct.items()) | ||
| for dct in other_dict.get("metrics", []) | ||
| ) | ||
|
|
||
| return self_dict == other_dict | ||
|
|
@@ -55,13 +54,15 @@ def name(self) -> str: | |
|
|
||
| A name is required by all evaluators because it is used as the top-level key | ||
| in the results returned by a | ||
| :class:`citrine.informatics.workflows.PredictorEvaluationWorkflow`. | ||
| :class:`citrine.informatics.executions.predictor_evaluation.PredictorEvaluation`. | ||
| As such, the names of all evaluators within a single workflow must be unique. | ||
| """ | ||
| raise NotImplementedError # pragma: no cover | ||
|
|
||
|
|
||
| class CrossValidationEvaluator(Serializable["CrossValidationEvaluator"], PredictorEvaluator): | ||
| class CrossValidationEvaluator( | ||
| Serializable["CrossValidationEvaluator"], PredictorEvaluator | ||
| ): | ||
|
Comment on lines
+63
to
+65
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like Claude is breaking on 80 characters, not our setting of 99 |
||
| """Evaluate a predictor via cross validation. | ||
|
|
||
| Performs cross-validation on requested predictor responses and computes the requested metrics | ||
|
|
@@ -103,21 +104,27 @@ class CrossValidationEvaluator(Serializable["CrossValidationEvaluator"], Predict | |
| _responses = properties.Set(properties.String, "responses") | ||
| n_folds = properties.Integer("n_folds") | ||
| n_trials = properties.Integer("n_trials") | ||
| _metrics = properties.Optional(properties.Set(properties.Object(PredictorEvaluationMetric)), | ||
| "metrics") | ||
| ignore_when_grouping = properties.Optional(properties.Set(properties.String), | ||
| "ignore_when_grouping") | ||
| typ = properties.String("type", default="CrossValidationEvaluator", deserializable=False) | ||
|
|
||
| def __init__(self, | ||
| name: str, | ||
| *, | ||
| description: str = "", | ||
| responses: set[str], | ||
| n_folds: int = 5, | ||
| n_trials: int = 3, | ||
| metrics: set[PredictorEvaluationMetric] | None = None, | ||
| ignore_when_grouping: set[str] | None = None): | ||
| _metrics = properties.Optional( | ||
| properties.Set(properties.Object(PredictorEvaluationMetric)), "metrics" | ||
| ) | ||
| ignore_when_grouping = properties.Optional( | ||
| properties.Set(properties.String), "ignore_when_grouping" | ||
| ) | ||
| typ = properties.String( | ||
| "type", default="CrossValidationEvaluator", deserializable=False | ||
| ) | ||
|
|
||
| def __init__( | ||
| self, | ||
| name: str, | ||
| *, | ||
| description: str = "", | ||
| responses: set[str], | ||
| n_folds: int = 5, | ||
| n_trials: int = 3, | ||
| metrics: set[PredictorEvaluationMetric] | None = None, | ||
| ignore_when_grouping: set[str] | None = None, | ||
| ): | ||
| self.name: str = name | ||
| self.description: str = description | ||
| self._responses: set[str] = responses | ||
|
|
@@ -161,16 +168,20 @@ class HoldoutSetEvaluator(Serializable["HoldoutSetEvaluator"], PredictorEvaluato | |
| description = properties.String("description") | ||
| _responses = properties.Set(properties.String, "responses") | ||
| data_source = properties.Object(DataSource, "data_source") | ||
| _metrics = properties.Optional(properties.Set(properties.Object(PredictorEvaluationMetric)), | ||
| "metrics") | ||
| _metrics = properties.Optional( | ||
| properties.Set(properties.Object(PredictorEvaluationMetric)), "metrics" | ||
| ) | ||
| typ = properties.String("type", default="HoldoutSetEvaluator", deserializable=False) | ||
|
|
||
| def __init__(self, | ||
| name: str, *, | ||
| description: str = "", | ||
| responses: set[str], | ||
| data_source: DataSource, | ||
| metrics: set[PredictorEvaluationMetric] | None = None): | ||
| def __init__( | ||
| self, | ||
| name: str, | ||
| *, | ||
| description: str = "", | ||
| responses: set[str], | ||
| data_source: DataSource, | ||
| metrics: set[PredictorEvaluationMetric] | None = None, | ||
| ): | ||
| self.name: str = name | ||
| self.description: str = description | ||
| self._responses: set[str] = responses | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The actual issue in this file.