Skip to content

Commit fc1925c

Browse files
committed
Changed Binarizer node to be cast to the type of the predicted label column's data type
1 parent 6b6f04b commit fc1925c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Microsoft.ML.Data/Scorers/BinaryClassifierScorer.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,11 @@ the predicted label is based on the sign of the score.
216216
node = ctx.CreateNode(opType, ctx.GetVariableName(outColumnNames[1]), binarizerOutput, ctx.GetNodeName(opType));
217217
node.AddAttribute("threshold", 0.0);
218218
}
219+
219220
opType = "Cast";
220221
node = ctx.CreateNode(opType, binarizerOutput, ctx.GetVariableName(outColumnNames[0]), ctx.GetNodeName(opType), "");
221-
var t = InternalDataKindExtensions.ToInternalDataKind(DataKind.Boolean).ToType();
222-
node.AddAttribute("to", t);
222+
var predictedLabelCol = OutputSchema.GetColumnOrNull(outColumnNames[0]);
223+
node.AddAttribute("to", predictedLabelCol.HasValue ? predictedLabelCol.Value.Type.RawType : typeof(bool));
223224
}
224225

225226
private protected override IDataTransform ApplyToDataCore(IHostEnvironment env, IDataView newSource)

0 commit comments

Comments
 (0)