Skip to content

Commit

Permalink
Demo: started adding Resiliency, fixed some Spec issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-echeverria committed Oct 1, 2024
1 parent 7b357e3 commit 582cf79
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 22 deletions.
22 changes: 9 additions & 13 deletions demo/scenarios/1_requirements.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
" SystemDescriptor,\n",
" GoalDescriptor,\n",
" ProblemType,\n",
" RiskDescriptor\n",
" RiskDescriptor,\n",
")\n",
"\n",
"card = NegotiationCard(\n",
Expand Down Expand Up @@ -542,6 +542,7 @@
"from values.multiple_ranksums import MultipleRanksums\n",
"from properties.monitorability import Monitorability\n",
"from properties.interoperability import Interoperability\n",
"from properties.resilience import Resilience\n",
"from properties.accuracy import Accuracy\n",
"from values.string import String\n",
"\n",
Expand Down Expand Up @@ -582,7 +583,9 @@
" ): {\n",
" \"predicting cpu\": LocalProcessCPUUtilization.value().max_utilization_less_than(\n",
" 30.0\n",
" )\n",
" ),\n",
" # Performance: Inference time on Operational Platform\n",
" \"predicting cpu time\": Real.less_than(2.0),\n",
" },\n",
" Interpretability(\"Important to understand what the model is doing\"): {\n",
" \"image attributions\": Image.ignore(\"Inspect the image.\")\n",
Expand All @@ -605,20 +608,13 @@
" \"Model - Input Validation Error\"\n",
" )\n",
" },\n",
" # Monitorability: Detect OOD inputs\n",
" Monitorability(\"Monitor inputs for OOD data\"): {\n",
" \"detect ood inputs\": String.contains(\"Model - Input OOD Error\")\n",
" },\n",
" # Monitorability: Detect output shifts\n",
" Monitorability(\"Monitor outputs for unexpected shifts\"): {\n",
" # Monitorability: Detect OOD inputs and unexpected shifts\n",
" Monitorability(\"Monitor inputs for OOD data and unexpected shifts\"): {\n",
" \"detect ood inputs\": String.contains(\"Model - Input OOD Error\"),\n",
" \"monitor output confidence shift\": String.contains(\n",
" \"Model - Output Confidence Error\"\n",
" )\n",
" ),\n",
" },\n",
" # Performance: Inference time on Operational Platform\n",
" PredictingComputeCost(\n",
" \"End to end latency for inference on operational platform\"\n",
" ): {\"predicting cpu time\": Real.less_than(2.0)},\n",
" }\n",
")\n",
"spec.save(parents=True, force=True)"
Expand Down
6 changes: 3 additions & 3 deletions demo/scenarios/properties/accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def __init__(self, rationale: str):
super().__init__(
instance=self,
description="""
The Accuracy property assesses the total predictive performance requirements of a
model and system. These requirements are typically given as a single real valued number.
""",
The Accuracy property assesses the total predictive performance requirements of a
model and system. These requirements are typically given as a single real valued number.
""",
rationale=rationale,
)
1 change: 0 additions & 1 deletion demo/scenarios/properties/interoperability.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def __init__(self, rationale: str):
The Interoperability property evaluates the requirements on the interfaces to a model and system.
These requirements may be expressed in a variety of ways,
including requriements on line formats in log files, timestamps, and log content.
""",
rationale=rationale,
)
10 changes: 5 additions & 5 deletions demo/scenarios/properties/monitorability.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

class Monitorability(Property):
"""
The Interoperability property reflects contract requirements on model interfaces.
The Monitorability property reflects monitoring requirements.
"""

def __init__(self, rationale: str):
"""Initialize a Interoperability instance."""
"""Initialize a Monitorability instance."""
super().__init__(
instance=self,
description="""
The Monitorability property assesses the monitoring requirements of a
model and system. These requirements may be expressed in a variety of ways,
including requriements on line formats in log files, timestamps, and log content.
The Monitorability property assesses the monitoring requirements of a
model and system. These requirements may be expressed in a variety of ways,
including requriements on line formats in log files, timestamps, and log content.
""",
rationale=rationale,
)
17 changes: 17 additions & 0 deletions demo/scenarios/properties/resilience.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from mlte.property.base import Property


class Resilience(Property):
"""
The Resilience property reflects ...
"""

def __init__(self, rationale: str):
"""Initialize a Resilience instance."""
super().__init__(
instance=self,
description="""
The Resilience property assesses ...
""",
rationale=rationale,
)

0 comments on commit 582cf79

Please sign in to comment.