-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbim-policies-basic-embedded.rego
50 lines (46 loc) · 1.48 KB
/
bim-policies-basic-embedded.rego
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# one example of qoa4ml policies for a contract for bts scenario
package qoa4ml.bim.basic.embedded
# the contract data is embedded into this policies
default mlfair_violation = true
default mlaccuracy_violation=false
#load the contract data
qoa4ml_contract :={
"stakeholders":
{
"id": "solibri",
"roles": ["mlprovider"]
},
"resources":{
"services": [
{"id": "bimclassification", "serviceapi": ["rest"],"machinetypes":["small"], "processortypes": ["GPU"]}
],
"data": [
{"id": "bimdata", "datatypes": ["files"], "formats": ["smc"]}
],
"mlmodels": [
{"id": "model1", "formats": ["kerash5"], "mlinfrastructures": ["tensorflow"]}
]
},
"quality": {
"services":{
"ResponseTime":{"operators":["min"],"value":"300"}
},
"data":{
"Accuracy": {"operators":["min"],"value":"0.99"}
},
"mlmodels": {
"Accuracy":{"operators":["min"],"value":"0.99"}
}
},
"interpretability": {
"explanability":{"modes": ["full"]}
}
}
# The policy checker will receive two inputs: the contract and the runtime information
# input variable: the input of runtime metrics
mlaccuracy_violation = {
qoa4ml_contract.quality.mlmodels.Accuracy.value > input.quality.mlmodels.Accuracy.value
}
mlfair_violation = {
qoa4ml_contract.interpretability.explainability.modes[_]!=input.interpretability.explainability.modes[0]
}