-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Validate feature: setting baseline models (#266)
add new set model as baseline functions to client, remove add_criteria in favor of add_eval_function, bump version number and changelog
- Loading branch information
1 parent
f9d1173
commit c9f1f59
Showing
18 changed files
with
160 additions
and
89 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
6 changes: 1 addition & 5 deletions
6
nucleus/validate/data_transfer_objects/scenario_test_metric.py
This file contains 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,12 +1,8 @@ | ||
from nucleus.pydantic_base import ImmutableModel | ||
|
||
from ..constants import ThresholdComparison | ||
|
||
|
||
class AddScenarioTestMetric(ImmutableModel): | ||
class AddScenarioTestFunction(ImmutableModel): | ||
"""Data transfer object to add a scenario test.""" | ||
|
||
scenario_test_name: str | ||
eval_function_id: str | ||
threshold: float | ||
threshold_comparison: ThresholdComparison |
This file contains 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 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 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,14 +1,33 @@ | ||
from nucleus.pydantic_base import ImmutableModel | ||
from dataclasses import dataclass, field | ||
from typing import Dict, Optional | ||
|
||
from ..connection import Connection | ||
from .constants import ThresholdComparison | ||
|
||
|
||
class ScenarioTestMetric(ImmutableModel): | ||
@dataclass | ||
class ScenarioTestMetric: | ||
"""A Scenario Test Metric is an evaluation function combined with a comparator and associated with a Scenario Test. | ||
Scenario Test Metrics serve as the basis when evaluating a Model on a Scenario Test. | ||
""" | ||
|
||
scenario_test_id: str | ||
eval_function_id: str | ||
threshold: float | ||
threshold_comparison: ThresholdComparison | ||
threshold: Optional[float] | ||
connection: Connection | ||
eval_func_arguments: Optional[Dict] = field(default_factory=dict) | ||
threshold_comparison: ThresholdComparison = ( | ||
ThresholdComparison.GREATER_THAN_EQUAL_TO | ||
) | ||
|
||
def set_threshold(self, threshold: Optional[float] = None) -> None: | ||
"""Sets the threshold of the metric to the new value passed in as a parameters. | ||
Attributes: | ||
threshold (str): The ID of the scenario test. | ||
""" | ||
payload = {"threshold": threshold} | ||
response = self.connection.post( | ||
payload, | ||
f"validate/metric/set_threshold/{self.scenario_test_id}/{self.eval_function_id}", | ||
) | ||
self.threshold = response.get("threshold") |
This file contains 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 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 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 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
Oops, something went wrong.