Skip to content

Commit 9e74880

Browse files
committed
review comments
1 parent 38f137b commit 9e74880

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/Microsoft.ML.Data/DataLoadSave/DataOperationsCatalog.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public IDataView FilterByKeyColumnFraction(IDataView input, string columnName, d
8686

8787
var type = input.Schema[columnName].Type;
8888
if (type.GetKeyCount() == 0)
89-
throw Environment.ExceptSchemaMismatch(nameof(columnName), "filter", columnName, "a known cardinality key", type.ToString());
89+
throw Environment.ExceptSchemaMismatch(nameof(columnName), "filter", columnName, "a key", type.ToString());
9090
return new RangeFilter(Environment, input, columnName, lowerBound, upperBound, false);
9191
}
9292
}

src/Microsoft.ML.Data/Evaluators/BinaryClassifierEvaluator.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,11 @@ private protected override void CheckScoreAndLabelTypes(RoleMappedSchema schema)
128128
var host = Host.SchemaSensitive();
129129
var t = score.Type;
130130
if (t != NumberType.Float)
131-
throw host.ExceptSchemaMismatch(nameof(schema), "score", score.Name, "R4", t.ToString());
131+
throw host.ExceptSchemaMismatch(nameof(schema), "score", score.Name, "float", t.ToString());
132132
host.Check(schema.Label.HasValue, "Could not find the label column");
133133
t = schema.Label.Value.Type;
134134
if (t != NumberType.R4 && t != NumberType.R8 && t != BoolType.Instance && t.GetKeyCount() != 2)
135-
throw host.ExceptSchemaMismatch(nameof(schema), "label", schema.Label.Value.Name, "R4, R8, BL or a 2-value key", t.ToString());
135+
throw host.ExceptSchemaMismatch(nameof(schema), "label", schema.Label.Value.Name, "float, double, bool, or a 2-value key", t.ToString());
136136
}
137137

138138
private protected override void CheckCustomColumnTypesCore(RoleMappedSchema schema)
@@ -144,7 +144,7 @@ private protected override void CheckCustomColumnTypesCore(RoleMappedSchema sche
144144
host.CheckParam(prob.Count == 1, nameof(schema), "Cannot have multiple probability columns");
145145
var probType = prob[0].Type;
146146
if (probType != NumberType.Float)
147-
throw host.ExceptSchemaMismatch(nameof(schema), "probability", prob[0].Name, "R4", probType.ToString());
147+
throw host.ExceptSchemaMismatch(nameof(schema), "probability", prob[0].Name, "float", probType.ToString());
148148
}
149149
else if (!_useRaw)
150150
{

src/Microsoft.ML.Data/Evaluators/ClusteringEvaluator.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ private protected override void CheckScoreAndLabelTypes(RoleMappedSchema schema)
9999
if (type != null && type != NumberType.Float && !(type is KeyType keyType && keyType.Count > 0))
100100
{
101101
throw Host.ExceptSchemaMismatch(nameof(schema), "label", schema.Label.Value.Name,
102-
"R4 or key of known cardinality", type.ToString());
102+
"float or key", type.ToString());
103103
}
104104

105105
var score = schema.GetUniqueColumn(MetadataUtils.Const.ScoreValueKind.Score);
106106
type = score.Type;
107107
if (!(type is VectorType vectorType) || !vectorType.IsKnownSize || vectorType.ItemType != NumberType.Float)
108-
throw Host.ExceptSchemaMismatch(nameof(schema), "score", score.Name, "R4 vector of known size", type.ToString());
108+
throw Host.ExceptSchemaMismatch(nameof(schema), "score", score.Name, "known-size vector of float", type.ToString());
109109
}
110110

111111
private protected override void CheckCustomColumnTypesCore(RoleMappedSchema schema)

src/Microsoft.ML.Data/Evaluators/MultiClassClassifierEvaluator.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -814,10 +814,10 @@ private void CheckInputColumnTypes(Schema schema)
814814

815815
var scoreType = schema[ScoreIndex].Type as VectorType;
816816
if (scoreType == null || scoreType.Size < 2 || scoreType.ItemType != NumberType.Float)
817-
throw Host.Except(nameof(schema), "score", "vector of two or more items of type float", ScoreCol, scoreType.ToString());
817+
throw Host.ExceptSchemaMismatch(nameof(schema), "score", ScoreCol, "vector of two or more items of type float", scoreType.ToString());
818818
var labelType = schema[LabelIndex].Type;
819819
if (labelType != NumberType.Float && labelType.GetKeyCount() <= 0)
820-
throw Host.Except(nameof(schema), "label", LabelCol, "float or key", labelType.ToString());
820+
throw Host.ExceptSchemaMismatch(nameof(schema), "label", LabelCol, "float or key", labelType.ToString());
821821
}
822822
}
823823

src/Microsoft.ML.Data/Evaluators/MultiOutputRegressionEvaluator.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ private void CheckInputColumnTypes(Schema schema, out VectorType labelType, out
547547

548548
var t = schema[LabelIndex].Type as VectorType;
549549
if (t == null || !t.IsKnownSize || (t.ItemType != NumberType.R4 && t.ItemType != NumberType.R8))
550-
throw Host.Except(nameof(schema), "label", LabelCol, "known-size vector of float or double", t.ToString());
550+
throw Host.ExceptSchemaMismatch(nameof(schema), "label", LabelCol, "known-size vector of float or double", t.ToString());
551551
labelType = new VectorType((PrimitiveType)t.ItemType, t.Size);
552552
var slotNamesType = new VectorType(TextType.Instance, t.Size);
553553
var builder = new MetadataBuilder();
@@ -556,7 +556,7 @@ private void CheckInputColumnTypes(Schema schema, out VectorType labelType, out
556556

557557
t = schema[ScoreIndex].Type as VectorType;
558558
if (t == null || !t.IsKnownSize || t.ItemType != NumberType.Float)
559-
throw Host.Except(nameof(schema), "score", ScoreCol, "known-size vector of float", t.ToString());
559+
throw Host.ExceptSchemaMismatch(nameof(schema), "score", ScoreCol, "known-size vector of float", t.ToString());
560560
scoreType = new VectorType((PrimitiveType)t.ItemType, t.Size);
561561
builder = new MetadataBuilder();
562562
builder.AddSlotNames(t.Size, CreateSlotNamesGetter(schema, ScoreIndex, scoreType.Size, "Predicted"));

0 commit comments

Comments
 (0)