Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit 89afa9e

Browse files
committed
fix cv ranker
1 parent 298a66c commit 89afa9e

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

src/python/nimbusml/internal/utils/data_roles.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,20 @@ def to_attribute(role, suffix="_column_name"):
8181
return "row_id" + suffix
8282
return role.lower() + suffix
8383

84+
@staticmethod
85+
def to_parameter(role, suffix="ColumnName"):
86+
"""
87+
Converts a role into (as per manifesrt.json) parameter name.
88+
``GroupId --> RowGroupColumnName``.
89+
"""
90+
if not isinstance(role, str):
91+
raise TypeError("Unexpected role '{0}'".format(role))
92+
if role == "Weight":
93+
return "ExampleWeight" + suffix
94+
if role == "GroupId":
95+
return "RowGroup" + suffix
96+
return role + suffix
97+
8498
@staticmethod
8599
def to_role(column_name, suffix="_column_name"):
86100
"""

src/python/nimbusml/pipeline.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -924,17 +924,17 @@ def process_input_output(classname, node, input_schema):
924924
else:
925925
assigned = []
926926
for role in sorted(DataRoles._allowed):
927-
attr = role + 'Column'
927+
attr = DataRoles.to_parameter(role)
928928
if attr in inp:
929929
assigned.append(inp[attr])
930930
assigned = set(assigned)
931931
not_assigned = [
932932
col for col in input_schema if col not in assigned]
933933

934934
for role in sorted(DataRoles._allowed):
935-
attr = role + 'Column'
935+
attr = DataRoles.to_parameter(role)
936936
if attr in inp:
937-
if attr == 'FeatureColumn' and inp[attr]\
937+
if attr == 'FeatureColumnName' and inp[attr]\
938938
not in input_schema:
939939
val = not_assigned
940940
else:

0 commit comments

Comments
 (0)