Skip to content

Commit 737f2ae

Browse files
author
Phani
committed
drafted ML json schema and examples
1 parent 9d22814 commit 737f2ae

File tree

18 files changed

+378
-0
lines changed

18 files changed

+378
-0
lines changed

example/job/ml_model.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"name": "model",
3+
"type": "ml",
4+
"subtype": "supervised",
5+
"references": [
6+
"http://scikit-learn.org/stable/tutorial/machine_learning_map/index.html"
7+
],
8+
"method": {
9+
"...": "include(model/ml_method.json)"
10+
}
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"units": [
3+
{
4+
"...": "include(workflow/ml_unit.json)"
5+
}
6+
],
7+
"name": "property-prediction"
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"head": true,
3+
"flowchartId": "1",
4+
"name": "ml_predict",
5+
"type": "predict",
6+
"interface": {
7+
"...": "include(ml_unit/ml_predict.json)"
8+
}
9+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"results": [
3+
{
4+
"name": "band_gaps",
5+
"args": [
6+
{
7+
"key": "model_coefficients",
8+
"value": [
9+
-3.339e-01,
10+
2.555e-01,
11+
-1.005e-02
12+
]
13+
},
14+
{
15+
"key": "intercept",
16+
"value": 0.45
17+
},
18+
{
19+
"key": "score",
20+
"value": 0.8
21+
22+
},
23+
{
24+
"key": "model_data",
25+
"value": "JSON formatted string of input data table"
26+
}
27+
28+
]
29+
}
30+
]
31+
}

example/job/model/ml_method.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "regression",
3+
"subtype": "linear_regression",
4+
"workflow": {
5+
"...": "include(method/ml_workflow.json)"
6+
}
7+
}

example/job/theory/ml/regression.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "regression",
3+
"subtype":"linear_regression",
4+
"precision":{
5+
"...": "include(theory/ml/regression/precision.json)"
6+
}
7+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"score": 0.8
3+
}

schema/job/ml_model.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"title": "ML model schema",
4+
"properties": {
5+
"type": {
6+
"description": "general type of the model, eg. `ml`",
7+
"type": "string"
8+
},
9+
"subtype": {
10+
"description": "general subtype of the model, eg. `supervised`",
11+
"type": "string"
12+
},
13+
"method": {
14+
"$ref": "file:model/ml_method.json"
15+
},
16+
"references": {
17+
"type": "array",
18+
"items": {
19+
"description": "literature reference, webpage etc.",
20+
"type": "string"
21+
}
22+
}
23+
},
24+
"oneOf": [
25+
{
26+
"$ref": "file:theory/ml.json"
27+
}
28+
],
29+
"required": [
30+
"type",
31+
"subtype",
32+
"method"
33+
]
34+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"title": "ml workflow schema",
4+
"type": "object",
5+
"properties": {
6+
"name": {
7+
"description": "Name of the workflow. e.g. property-prediction",
8+
"type": "string"
9+
},
10+
"units": {
11+
"description": "Contains the Units of the Workflow",
12+
"type": "array",
13+
"items": {
14+
"$ref": "file:workflow/ml_unit.json"
15+
}
16+
}
17+
},
18+
"required": [
19+
"name"
20+
]
21+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema#",
3+
"title": "ml unit schema",
4+
"type": "object",
5+
"properties": {
6+
"type": {
7+
"description": "type of the unit.",
8+
"type": "string",
9+
"enum": [
10+
"interface",
11+
"modelfit",
12+
"predict"
13+
]
14+
},
15+
"name": {
16+
"description": "name of the unit. e.g. ml_interface",
17+
"type": "string"
18+
},
19+
"head": {
20+
"description": "Whether this unit is the first one to be executed.",
21+
"type": "boolean"
22+
},
23+
"flowchartId": {
24+
"description": "Identity of the unit in the workflow. Used to trace the execution flow of the workflow.",
25+
"type": "string"
26+
},
27+
"next": {
28+
"description": "Next unit's flowchartId. If empty, the current unit is the last.",
29+
"type": "string"
30+
},
31+
"results": {
32+
"description": "Resulting properties extracted from the unit.",
33+
"type": "array",
34+
"items": {
35+
"$ref": "file:ml_unit/_result.json"
36+
}
37+
},
38+
"interface": {
39+
"description": "Contains information about the ML interface unit..",
40+
"$ref": "file:ml_unit/ml_interface.json"
41+
},
42+
"modelfit": {
43+
"description": "Contains information about the assignment unit.",
44+
"$ref": "file:ml_unit/ml_modelfit.json"
45+
},
46+
"predict": {
47+
"description": "Contains information about the condition unit.",
48+
"$ref": "file:ml_unit/ml_predict.json"
49+
}
50+
},
51+
"required": [
52+
"type",
53+
"name",
54+
"head",
55+
"flowchartId"
56+
]
57+
}

0 commit comments

Comments
 (0)