private BindingsImpl(DataViewSchema input, ISchemaBoundRowMapper mapper, string suffix, string scoreColumnKind, bool user, int scoreColIndex, DataViewType predColType) : base(input, mapper, suffix, user, DefaultColumnNames.PredictedLabel) { Contracts.AssertNonEmpty(scoreColumnKind); Contracts.Assert(DerivedColumnCount == 1); ScoreColumnIndex = scoreColIndex; ScoreColumnKind = scoreColumnKind; PredColType = predColType; _getScoreColumnKind = GetScoreColumnKind; _getScoreValueKind = GetScoreValueKind; // REVIEW: This logic is very specific to multiclass, which is deeply // regrettable, but the class structure as designed and the status of this schema // bearing object makes pushing the logic into the multiclass scorer almost impossible. if (predColType is KeyType predColKeyType && predColKeyType.Count > 0) { var scoreColMetadata = mapper.OutputSchema[scoreColIndex].Metadata; var slotColumn = scoreColMetadata.Schema.GetColumnOrNull(MetadataUtils.Kinds.SlotNames); if (slotColumn?.Type is VectorType slotColVecType && (ulong)slotColVecType.Size == predColKeyType.Count) { Contracts.Assert(slotColVecType.Size > 0); _predColMetadata = Utils.MarshalInvoke(KeyValueMetadataFromMetadata <int>, slotColVecType.RawType, scoreColMetadata, slotColumn.Value); }
internal static DataViewRow MetadataAsRow(DataViewSchema.Metadata metadata) { Contracts.CheckValue(metadata, nameof(metadata)); return(new MetadataRow(metadata)); }
public MetadataRow(DataViewSchema.Metadata metadata) { Contracts.AssertValue(metadata); _metadata = metadata; }