/// <summary> /// All the input columns needed by an evaluator should be added here. /// The base class ipmlementation gets the score column, the label column (if exists) and the weight column (if exists). /// Override if additional columns are needed. /// </summary> protected virtual IEnumerable <KeyValuePair <RoleMappedSchema.ColumnRole, string> > GetInputColumnRolesCore(RoleMappedSchema schema) { // Get the score column information. var scoreInfo = EvaluateUtils.GetScoreColumnInfo(Host, schema.Schema, ScoreCol, nameof(ArgumentsBase.ScoreColumn), ScoreColumnKind); yield return(RoleMappedSchema.CreatePair(MetadataUtils.Const.ScoreValueKind.Score, scoreInfo.Name)); // Get the label column information. string lab = EvaluateUtils.GetColName(LabelCol, schema.Label, DefaultColumnNames.Label); yield return(RoleMappedSchema.CreatePair(RoleMappedSchema.ColumnRole.Label, lab)); var weight = EvaluateUtils.GetColName(WeightCol, schema.Weight, null); if (!string.IsNullOrEmpty(weight)) { yield return(RoleMappedSchema.CreatePair(RoleMappedSchema.ColumnRole.Weight, weight)); } }
protected override IEnumerable <KeyValuePair <RoleMappedSchema.ColumnRole, string> > GetInputColumnRolesCore(RoleMappedSchema schema) { foreach (var col in base.GetInputColumnRolesCore(schema)) { if (!col.Key.Equals(RoleMappedSchema.ColumnRole.Label)) { yield return(col); } else if (schema.Schema.TryGetColumnIndex(col.Value, out int labelIndex)) { yield return(col); } } if (_calculateDbi) { string feat = EvaluateUtils.GetColName(_featureCol, schema.Feature, DefaultColumnNames.Features); if (!schema.Schema.TryGetColumnIndex(feat, out int featCol)) { throw Host.ExceptUserArg(nameof(Arguments.FeatureColumn), "Features column '{0}' not found", feat); } yield return(RoleMappedSchema.ColumnRole.Feature.Bind(feat)); } }