Skip to content

Commit 887f6e3

Browse files
authored
Merge PR #15 Add array content in scoring output schema
from task/scoring-output-schema-array-content
2 parents 94e2483 + fd6176f commit 887f6e3

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## Version 1.1.1 (2024-05-07)
4+
* Scoring recipe: Specify array content type for decision_rules in output schema
5+
36
## Version 1.1.0 (2023-05-11)
47
* Webapp: Fix autosplit (outdated kwarg in sklearn's DecisionTreeClassifier)
58
* Evaluation recipe: Fix recipe with multiclass tasks + import error

plugin.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"id" : "decision-tree-builder",
3-
"version" : "1.1.0",
3+
"version" : "1.1.1",
44
"meta" : {
55
"label" : "Interactive Decision Tree Builder",
66
"description" : "Build and explore decision trees, and use them to score and evaluate data",

python-lib/dku_idtb_scoring/score.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ def update_input_schema(input_schema, columns):
1818
return new_input_schema
1919

2020
def _add_column(name, type, schema, columns=None):
21-
schema.append({'type': type, 'name': name})
21+
col = {'type': type, 'name': name}
22+
if type == 'array':
23+
col['arrayContent'] = {'type': 'string'}
24+
schema.append(col)
2225
if columns is not None:
2326
columns.append(name)
2427

python-tests/test_score.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def test_scored_df_schema():
122122
{"type": "double", "name": "proba_A"},
123123
{"type": "double", "name": "proba_B"},
124124
{"type": "string", "name": "prediction"},
125-
{"type": "array", "name": "decision_rule"},
125+
{"type": "array", "name": "decision_rule", "arrayContent": {"type": "string"}},
126126
{"type": "int", "name": "leaf_id"},
127127
{"type": "string", "name": "label"}
128128
]
@@ -131,7 +131,7 @@ def test_scored_df_schema():
131131
schema = get_scored_df_schema(tree, get_input_schema(), columns, False, True, False)
132132
expected_schema = [
133133
{"type": "string", "name": "prediction"},
134-
{"type": "array", "name": "decision_rule"},
134+
{"type": "array", "name": "decision_rule", "arrayContent": {"type": "string"}},
135135
{"type": "int", "name": "leaf_id"},
136136
{"type": "string", "name": "label"}
137137
]
@@ -144,7 +144,7 @@ def test_scored_df_schema():
144144
{"type": "double", "name": "num"},
145145
{"type": "string", "name": "prediction"},
146146
{"type": "boolean", "name": "prediction_correct"},
147-
{"type": "array", "name": "decision_rule"},
147+
{"type": "array", "name": "decision_rule", "arrayContent": {"type": "string"}},
148148
{"type": "int", "name": "leaf_id"},
149149
{"type": "string", "name": "label"}
150150
]

0 commit comments

Comments
 (0)