154 references to AnnotationUtils
Microsoft.ML.Core (2)
Data\AnnotationBuilderExtensions.cs (2)
19
=> builder.Add(
AnnotationUtils
.Kinds.SlotNames, new VectorDataViewType(TextDataViewType.Instance, size), getter);
30
=> builder.Add(
AnnotationUtils
.Kinds.KeyValues, new VectorDataViewType(valueType, size), getter);
Microsoft.ML.Core.Tests (62)
UnitTests\ScoreSchemaTest.cs (13)
41
AnnotationUtils
.Const.ScoreColumnKind.SequenceClassification, keyNames);
48
Assert.Equal(
AnnotationUtils
.Const.ScoreValueKind.PredictedLabel, scoreColumn.Name);
61
Assert.Equal(
AnnotationUtils
.Kinds.KeyValues, scoreMetadata.Schema[0].Name);
62
Assert.Equal(
AnnotationUtils
.Kinds.ScoreColumnKind, scoreMetadata.Schema[1].Name);
63
Assert.Equal(
AnnotationUtils
.Kinds.ScoreValueKind, scoreMetadata.Schema[2].Name);
82
Assert.Equal(
AnnotationUtils
.Const.ScoreColumnKind.SequenceClassification, scoreColumnKindValue.ToString());
87
Assert.Equal(
AnnotationUtils
.Const.ScoreValueKind.PredictedLabel, scoreValueKindValue.ToString());
98
AnnotationUtils
.Const.ScoreColumnKind.SequenceClassification, keyNames);
105
Assert.Equal(
AnnotationUtils
.Const.ScoreValueKind.PredictedLabel, scoreColumn.Name);
118
Assert.Equal(
AnnotationUtils
.Kinds.ScoreColumnKind, scoreMetadata.Schema[0].Name);
119
Assert.Equal(
AnnotationUtils
.Kinds.ScoreValueKind, scoreMetadata.Schema[1].Name);
129
Assert.Equal(
AnnotationUtils
.Const.ScoreColumnKind.SequenceClassification, scoreColumnKindValue.ToString());
134
Assert.Equal(
AnnotationUtils
.Const.ScoreValueKind.PredictedLabel, scoreValueKindValue.ToString());
UnitTests\TestEntryPoints.cs (49)
438
(
AnnotationUtils
.Const.ScoreValueKind.Score + i).ToString(),
439
AnnotationUtils
.Const.ScoreValueKind.Score)
442
individualScores[i] = new ColumnSelectingTransformer(Env, null, new[] {
AnnotationUtils
.Const.ScoreValueKind.Score }).Transform(individualScores[i]);
472
var scoreColumn = curs1.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
476
scoreColumn = curs2.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
480
scoreColumn = curs3.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
487
scoreColumn = curs4.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score + i);
1631
var scoreCol = binaryScored.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1633
var type = binaryScored.Schema[scoreCol.Value.Index].Annotations.Schema.GetColumnOrNull(
AnnotationUtils
.Kinds.ScoreColumnKind)?.Type;
1636
binaryScored.Schema[scoreCol.Value.Index].Annotations.GetValue(
AnnotationUtils
.Kinds.ScoreColumnKind, ref kind);
1637
Assert.True(ReadOnlyMemoryUtils.EqualsStr(
AnnotationUtils
.Const.ScoreColumnKind.BinaryClassification, kind),
1638
$"Binary ensemble scored data column type should be '{
AnnotationUtils
.Const.ScoreColumnKind.BinaryClassification}', but is instead '{kind}'");
1640
scoreCol = regressionScored.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1642
type = regressionScored.Schema[scoreCol.Value.Index].Annotations.Schema[
AnnotationUtils
.Kinds.ScoreColumnKind].Type;
1644
regressionScored.Schema[scoreCol.Value.Index].Annotations.GetValue(
AnnotationUtils
.Kinds.ScoreColumnKind, ref kind);
1645
Assert.True(ReadOnlyMemoryUtils.EqualsStr(
AnnotationUtils
.Const.ScoreColumnKind.Regression, kind),
1646
$"Regression ensemble scored data column type should be '{
AnnotationUtils
.Const.ScoreColumnKind.Regression}', but is instead '{kind}'");
1648
scoreCol = anomalyScored.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1650
type = anomalyScored.Schema[scoreCol.Value.Index].Annotations.Schema[
AnnotationUtils
.Kinds.ScoreColumnKind].Type;
1652
anomalyScored.Schema[scoreCol.Value.Index].Annotations.GetValue(
AnnotationUtils
.Kinds.ScoreColumnKind, ref kind);
1653
Assert.True(ReadOnlyMemoryUtils.EqualsStr(
AnnotationUtils
.Const.ScoreColumnKind.AnomalyDetection, kind),
1654
$"Anomaly detection ensemble scored data column type should be '{
AnnotationUtils
.Const.ScoreColumnKind.AnomalyDetection}', but is instead '{kind}'");
1684
var scoreColumn = curs0.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1687
scoreColumn = curs1.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1690
scoreColumn = curs2.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1693
scoreColumn = curs3.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1696
scoreColumn = curs4.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1699
scoreColumn = cursReg.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1702
scoreColumn = cursBin.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1705
scoreColumn = cursBinCali.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1708
scoreColumn = cursSaved.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1711
scoreColumn = cursAnom.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1910
var scoreColumn = curs0.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1913
scoreColumn = curs1.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1916
scoreColumn = curs2.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1919
scoreColumn = curs3.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1922
scoreColumn = curs4.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1925
scoreColumn = cursReg.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1928
scoreColumn = cursBin.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1931
scoreColumn = cursBinCali.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
1934
scoreColumn = cursSaved.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
2068
var scoreColumn = curs0.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
2071
scoreColumn = curs1.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
2074
scoreColumn = curs2.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
2077
scoreColumn = curs3.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
2080
scoreColumn = curs4.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
2083
scoreColumn = curs.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
2086
scoreColumn = cursSaved.Schema.GetColumnOrNull(
AnnotationUtils
.Const.ScoreValueKind.Score);
5406
var type = schema["Count"].Annotations.Schema[
AnnotationUtils
.Kinds.SlotNames].Type;
Microsoft.ML.Data (5)
DataLoadSave\Text\TextLoader.cs (1)
692
/// <see cref="Infos"/>[i] stores the i-th column's metadata, named <see cref="
AnnotationUtils
.Kinds.SlotNames"/>
Prediction\CalibratorCatalog.cs (1)
81
/// The same annotation data that would be produced by <see cref="
AnnotationUtils
.GetTrainerOutputAnnotation(bool)"/> is marked as
Scorers\ScoreSchemaFactory.cs (3)
20
/// <param name="scoreColumnKindValue">The kind of the score column. It's the value of <see cref="
AnnotationUtils
.Kinds.ScoreColumnKind"/> in the score column's metadata.</param>
109
/// This function returns a schema for sequence predictor's output. Its output column is always called <see cref="
AnnotationUtils
.Const.ScoreValueKind.PredictedLabel"/>.
113
/// <see cref="
AnnotationUtils
.Kinds.ScoreColumnKind"/>.</param>
Microsoft.ML.FastTree (1)
TreeEnsemble\InternalTreeEnsemble.cs (1)
436
/// <seealso cref="
AnnotationUtils
.Kinds.SlotNames"/>
Microsoft.ML.Tests (84)
Scenarios\Api\Estimators\PredictAndMetadata.cs (3)
47
engine.OutputSchema[nameof(IrisPrediction.Score)].Annotations.GetValue(
AnnotationUtils
.Kinds.TrainingLabelValues, ref originalLabels);
92
Assert.NotNull(scoredData.Schema["Score"].Annotations.Schema.GetColumnOrNull(
AnnotationUtils
.Kinds.SlotNames));
126
Assert.Null(scoredData2.Schema["Score"].Annotations.Schema.GetColumnOrNull(
AnnotationUtils
.Kinds.SlotNames));
SvmLightTests.cs (1)
162
AnnotationUtils
.Kinds.SlotNames, new VBuffer<ReadOnlyMemory<char>>(3, new[] { "aurora".AsMemory(), "beachwood".AsMemory(), "chagrin".AsMemory() }),
TrainerEstimators\TreeEnsembleFeaturizerTest.cs (5)
68
treeValuesColumn.Annotations.GetValue(
AnnotationUtils
.Kinds.SlotNames, ref slotNames);
87
treeLeafIdsColumn.Annotations.GetValue(
AnnotationUtils
.Kinds.IsNormalized, ref leafIdsNormalizedFlag);
91
treeLeafIdsColumn.Annotations.GetValue(
AnnotationUtils
.Kinds.SlotNames, ref leafIdsSlotNames);
110
treePathIdsColumn.Annotations.GetValue(
AnnotationUtils
.Kinds.IsNormalized, ref pathIdsNormalizedFlag);
114
treePathIdsColumn.Annotations.GetValue(
AnnotationUtils
.Kinds.SlotNames, ref pathIdsSlotNames);
Transformers\CategoricalHashTests.cs (19)
143
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.SlotNames });
149
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[2] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.IsNormalized });
156
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.SlotNames });
162
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[2] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.IsNormalized });
169
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[3] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.CategoricalSlotRanges,
AnnotationUtils
.Kinds.IsNormalized });
175
column.Annotations.GetValue(
AnnotationUtils
.Kinds.CategoricalSlotRanges, ref slotRanges);
181
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[3] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.CategoricalSlotRanges,
AnnotationUtils
.Kinds.IsNormalized });
185
column.Annotations.GetValue(
AnnotationUtils
.Kinds.CategoricalSlotRanges, ref slotRanges);
191
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.KeyValues });
197
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.KeyValues });
203
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.SlotNames });
208
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[2] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.IsNormalized });
Transformers\CategoricalTests.cs (22)
221
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.SlotNames });
227
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[2] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.IsNormalized });
234
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.SlotNames });
240
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[2] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.IsNormalized });
247
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[3] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.CategoricalSlotRanges,
AnnotationUtils
.Kinds.IsNormalized });
251
column.Annotations.GetValue(
AnnotationUtils
.Kinds.CategoricalSlotRanges, ref slotRanges);
257
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[3] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.CategoricalSlotRanges,
AnnotationUtils
.Kinds.IsNormalized });
261
column.Annotations.GetValue(
AnnotationUtils
.Kinds.CategoricalSlotRanges, ref slotRanges);
267
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.KeyValues });
273
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.KeyValues });
279
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.SlotNames });
285
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[2] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.IsNormalized });
292
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.SlotNames });
298
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[2] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.IsNormalized });
Transformers\ConvertTests.cs (4)
296
output.Schema["CatA"].Annotations.GetValue(
AnnotationUtils
.Kinds.KeyValues, ref slotNames);
352
Assert.Equal(result.Schema["ConvA"].Annotations.Schema.Select(x => x.Name), new string[2] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.IsNormalized });
359
Assert.Equal(result.Schema["ConvB"].Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.KeyValues });
Transformers\HashTests.cs (6)
87
Assert.Equal(
AnnotationUtils
.Kinds.KeyValues, column.Annotations.Schema.Single().Name);
92
Assert.Equal(
AnnotationUtils
.Kinds.KeyValues, column.Annotations.Schema.Single().Name);
97
Assert.Equal(
AnnotationUtils
.Kinds.KeyValues, column.Annotations.Schema.Single().Name);
135
var inRow =
AnnotationUtils
.AnnotationsAsRow(builder.ToAnnotations());
167
inRow =
AnnotationUtils
.AnnotationsAsRow(builder.ToAnnotations());
198
inRow =
AnnotationUtils
.AnnotationsAsRow(builder.ToAnnotations());
Transformers\KeyToBinaryVectorEstimatorTest.cs (4)
117
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.SlotNames });
123
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[2] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.IsNormalized });
133
Assert.Equal(
AnnotationUtils
.Kinds.IsNormalized, column.Annotations.Schema.Single().Name);
Transformers\KeyToVectorEstimatorTests.cs (20)
136
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.SlotNames });
142
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[3] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.CategoricalSlotRanges,
AnnotationUtils
.Kinds.IsNormalized });
146
column.Annotations.GetValue(
AnnotationUtils
.Kinds.CategoricalSlotRanges, ref slotRanges);
152
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[3] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.CategoricalSlotRanges,
AnnotationUtils
.Kinds.IsNormalized });
156
column.Annotations.GetValue(
AnnotationUtils
.Kinds.CategoricalSlotRanges, ref slotRanges);
162
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[2] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.IsNormalized });
169
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[2] {
AnnotationUtils
.Kinds.CategoricalSlotRanges,
AnnotationUtils
.Kinds.IsNormalized });
170
column.Annotations.GetValue(
AnnotationUtils
.Kinds.CategoricalSlotRanges, ref slotRanges);
176
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.IsNormalized });
180
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[1] {
AnnotationUtils
.Kinds.SlotNames });
186
Assert.Equal(column.Annotations.Schema.Select(x => x.Name), new string[3] {
AnnotationUtils
.Kinds.SlotNames,
AnnotationUtils
.Kinds.CategoricalSlotRanges,
AnnotationUtils
.Kinds.IsNormalized });
190
column.Annotations.GetValue(
AnnotationUtils
.Kinds.CategoricalSlotRanges, ref slotRanges);