29 instantiations of RoleMappedSchema
Microsoft.ML.Core (3)
Data\RoleMappedSchema.cs (3)
442: this(Contracts.CheckRef(data, nameof(data)), new RoleMappedSchema(data.Schema, Contracts.CheckRef(roles, nameof(roles)), opt)) 457: this(Contracts.CheckRef(data, nameof(data)), new RoleMappedSchema(data.Schema, Contracts.CheckRef(roles, nameof(roles)), opt)) 479new RoleMappedSchema(data.Schema, label, feature, group, weight, name, custom, opt))
Microsoft.ML.Data (17)
Commands\DataCommand.cs (1)
308trainSchema = new RoleMappedSchema(trainPipe.Schema, trainRoleMappings);
Commands\SavePredictorCommand.cs (1)
223schema = new RoleMappedSchema(emptyView.Schema, roles, opt: true);
Commands\ScoreCommand.cs (2)
121var schema = new RoleMappedSchema(loader.Schema, label: null, feature: feat, group: group, custom: customCols, opt: true); 267var schema = new RoleMappedSchema(input.Schema, label: null, feature: featureColName, group: groupColName, custom: customColumns, opt: true);
Deprecated\Instances\HeaderSchema.cs (2)
308Schema = new RoleMappedSchema(new FeatureNameCollectionBinding(this).FeatureNameCollectionSchema, 400_schema = new RoleMappedSchema(new FeatureNameCollectionBinding(this).FeatureNameCollectionSchema,
EntryPoints\PredictorModelImpl.cs (1)
142var trainRms = new RoleMappedSchema(predInput.Schema, _roleMappings, opt: true);
Scorers\GenericScorer.cs (1)
74var mapper = bindable.Bind(env, new RoleMappedSchema(input, roles));
Scorers\PredictedLabelScorerBase.cs (2)
112var schema = new RoleMappedSchema(input, RowMapper.GetInputColumnRoles()); 143var mapper = bindable.Bind(env, new RoleMappedSchema(input, roles));
Scorers\PredictionTransformer.cs (6)
306var schema = new RoleMappedSchema(TrainSchema, null, FeatureColumnName); 348var schema = new RoleMappedSchema(TrainSchema, null, FeatureColumnName); 440var schema = new RoleMappedSchema(TrainSchema, LabelColumnName, FeatureColumnName); 532var schema = new RoleMappedSchema(TrainSchema, _trainLabelColumn, FeatureColumnName); 674var schema = new RoleMappedSchema(inputSchema, null, featureColumn); 686var schema = new RoleMappedSchema(TrainSchema, null, FeatureColumnName);
Utilities\ModelFileUtils.cs (1)
351return new RoleMappedSchema(pipe.Schema, roleMappings);
Microsoft.ML.Ensemble (1)
PipelineEnsemble.cs (1)
330var bound = new Bound(this, new RoleMappedSchema(data.Schema));
Microsoft.ML.EntryPoints (1)
FeatureCombiner.cs (1)
55var rms = new RoleMappedSchema(viewTrain.Schema, input.GetRoles());
Microsoft.ML.FastTree (1)
TreeEnsembleFeaturizationTransformer.cs (1)
66return new RoleMappedSchema(schema, roles);
Microsoft.ML.Predictor.Tests (2)
TestIniModels.cs (2)
535var roleMappedSchema = new RoleMappedSchema(data.Schema, false, 574var roleMappedSchema = new RoleMappedSchema(data.Schema, false,
Microsoft.ML.Recommender (1)
MatrixFactorizationPredictor.cs (1)
474var schema = new RoleMappedSchema(TrainSchema, roles);
Microsoft.ML.StandardTrainers (2)
FactorizationMachine\FieldAwareFactorizationMachineModelParameters.cs (1)
427var schema = new RoleMappedSchema(TrainSchema, roles);
FactorizationMachine\FieldAwareFactorizationMachineUtils.cs (1)
88InputRoleMappedSchema = new RoleMappedSchema(schema.Schema, inputFeatureColumns);
Microsoft.ML.Tests (1)
TrainerEstimators\TreeEnsembleFeaturizerTest.cs (1)
49var roleMappedSchema = new RoleMappedSchema(dataView.Schema,
495 references to RoleMappedSchema
Microsoft.ML.Core (27)
Data\AnnotationUtils.cs (2)
298public static void GetSlotNames(RoleMappedSchema schema, RoleMappedSchema.ColumnRole role, int vectorSize, ref VBuffer<ReadOnlyMemory<char>> slotNames)
Data\ISchemaBindableMapper.cs (6)
12/// A mapper that can be bound to a <see cref="RoleMappedSchema"/> (which encapsulates a <see cref="DataViewSchema"/> and has mappings from column kinds 13/// to columns of that schema). Binding an <see cref="ISchemaBindableMapper"/> to a <see cref="RoleMappedSchema"/> produces an 27ISchemaBoundMapper Bind(IHostEnvironment env, RoleMappedSchema schema); 38/// The <see cref="RoleMappedSchema"/> that was passed to the <see cref="ISchemaBoundMapper"/> in the binding process. 40RoleMappedSchema InputRoleMappedSchema { get; } 55IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRoles();
Data\RoleMappedSchema.cs (17)
33/// Note that there is no need for components consuming a <see cref="RoleMappedData"/> or <see cref="RoleMappedSchema"/> 51/// Instances of this are the keys of a <see cref="RoleMappedSchema"/>. This class also holds some important 112/// for giving to constructors of <see cref="RoleMappedSchema"/> and <see cref="RoleMappedData"/>. 391IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> custom = null, bool opt = false) 404/// Encapsulates an <see cref="IDataView"/> plus a corresponding <see cref="RoleMappedSchema"/>. 405/// Note that the schema of <see cref="RoleMappedSchema.Schema"/> of <see cref="Schema"/> is 417/// The role mapped schema. Note that <see cref="Schema"/>'s <see cref="RoleMappedSchema.Schema"/> is 420public RoleMappedSchema Schema { get; } 422private RoleMappedData(IDataView data, RoleMappedSchema schema) 441public RoleMappedData(IDataView data, bool opt = false, params KeyValuePair<RoleMappedSchema.ColumnRole, string>[] roles) 456public RoleMappedData(IDataView data, IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> roles, bool opt = false) 466/// <param name="label">The column name that will be mapped to the <see cref="RoleMappedSchema.ColumnRole.Label"/> role</param> 467/// <param name="feature">The column name that will be mapped to the <see cref="RoleMappedSchema.ColumnRole.Feature"/> role</param> 468/// <param name="group">The column name that will be mapped to the <see cref="RoleMappedSchema.ColumnRole.Group"/> role</param> 469/// <param name="weight">The column name that will be mapped to the <see cref="RoleMappedSchema.ColumnRole.Weight"/> role</param> 470/// <param name="name">The column name that will be mapped to the <see cref="RoleMappedSchema.ColumnRole.Name"/> role</param> 477IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> custom = null, bool opt = false)
EntryPoints\PredictorModel.cs (2)
64/// Returns the <see cref="RoleMappedSchema"/> that was used in training. 67internal abstract RoleMappedSchema GetTrainingSchema(IHostEnvironment env);
Microsoft.ML.Core.Tests (4)
UnitTests\TestEntryPoints.cs (4)
2184RoleMappedSchema.CreatePair(RoleMappedSchema.ColumnRole.Feature, "Features"), 2185RoleMappedSchema.CreatePair(RoleMappedSchema.ColumnRole.Label, "Label"));
Microsoft.ML.Data (273)
Commands\CrossValidationCommand.cs (5)
34public IComponentFactory<IDataView, ISchemaBoundMapper, RoleMappedSchema, IDataScorerTransform> Scorer; 335public readonly RoleMappedSchema TrainSchema; 337public FoldResult(Dictionary<string, IDataView> metrics, DataViewSchema scoreSchema, RoleMappedData perInstance, RoleMappedSchema trainSchema) 352private readonly IComponentFactory<IDataView, ISchemaBoundMapper, RoleMappedSchema, IDataScorerTransform> _scorer; 392IComponentFactory<IDataView, ISchemaBoundMapper, RoleMappedSchema, IDataScorerTransform> scorer,
Commands\DataCommand.cs (1)
249bool wantTrainSchema, out RoleMappedSchema trainSchema,
Commands\SavePredictorCommand.cs (3)
132RoleMappedSchema schema; 141public static void SavePredictor(IChannel ch, IPredictor predictor, RoleMappedSchema schema, 207public static void LoadModel(IHostEnvironment env, Stream modelStream, bool loadNames, out IPredictor predictor, out RoleMappedSchema schema)
Commands\ScoreCommand.cs (10)
21using TScorerFactory = IComponentFactory<IDataView, ISchemaBoundMapper, RoleMappedSchema, IDataScorerTransform>; 37internal delegate void SignatureDataScorer(IDataView data, ISchemaBoundMapper mapper, RoleMappedSchema trainSchema); 104LoadModelObjects(ch, true, out var predictor, true, out var trainSchema, out var loader); 121var schema = new RoleMappedSchema(loader.Schema, label: null, feature: feat, group: group, custom: customCols, opt: true); 241public static IDataScorerTransform GetScorer(IPredictor predictor, RoleMappedData data, IHostEnvironment env, RoleMappedSchema trainSchema) 253IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> customColumns, 255RoleMappedSchema trainSchema, 267var schema = new RoleMappedSchema(input.Schema, label: null, feature: featureColName, group: groupColName, custom: customColumns, opt: true); 278RoleMappedSchema schema, 321Func<IHostEnvironment, IDataView, ISchemaBoundMapper, RoleMappedSchema, IDataScorerTransform> factoryFunc;
Commands\TestCommand.cs (2)
48public IComponentFactory<IDataView, ISchemaBoundMapper, RoleMappedSchema, IDataScorerTransform> Scorer; 93RoleMappedSchema trainSchema;
Commands\TrainCommand.cs (1)
25using ColumnRole = RoleMappedSchema.ColumnRole;
Commands\TrainTestCommand.cs (1)
32public IComponentFactory<IDataView, ISchemaBoundMapper, RoleMappedSchema, IDataScorerTransform> Scorer;
DataLoadSave\TransformerChain.cs (7)
302roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Feature.Value).First().Value); 306roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Feature.Value).First().Value, 307roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Label.Value).First().Value); 310roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Feature.Value).First().Value); 313roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Feature.Value).First().Value); 316roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Feature.Value).First().Value); 319roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Feature.Value).First().Value);
Deprecated\Instances\HeaderSchema.cs (9)
40schemaBuilder.AddColumn(RoleMappedSchema.ColumnRole.Feature.Value, _colType, metadataBuilder.ToAnnotations()); 74public abstract RoleMappedSchema Schema { get; } 294public override RoleMappedSchema Schema { get; } 309roles: RoleMappedSchema.ColumnRole.Feature.Bind(RoleMappedSchema.ColumnRole.Feature.Value)); 367private readonly RoleMappedSchema _schema; 369public override RoleMappedSchema Schema => _schema; 401roles: RoleMappedSchema.ColumnRole.Feature.Bind(RoleMappedSchema.ColumnRole.Feature.Value));
Dirty\PredictorInterfaces.cs (8)
81void SaveAsText(TextWriter writer, RoleMappedSchema schema); 90void SaveAsIni(TextWriter writer, RoleMappedSchema schema, ICalibrator calibrator = null); 99void SaveSummary(TextWriter writer, RoleMappedSchema schema); 113IList<KeyValuePair<string, object>> GetSummaryInKeyValuePairs(RoleMappedSchema schema); 119DataViewRow GetSummaryIRowOrNull(RoleMappedSchema schema); 121DataViewRow GetStatsIRowOrNull(RoleMappedSchema schema); 127IDataView GetSummaryDataView(RoleMappedSchema schema); 136void SaveAsCode(TextWriter writer, RoleMappedSchema schema);
Dirty\PredictorUtils.cs (4)
18public static void SaveSummary(IChannel ch, IPredictor predictor, RoleMappedSchema schema, TextWriter writer) 38public static void SaveText(IChannel ch, IPredictor predictor, RoleMappedSchema schema, TextWriter writer) 85public static void SaveIni(IChannel ch, IPredictor predictor, RoleMappedSchema schema, TextWriter writer) 117public static void SaveCode(IChannel ch, IPredictor predictor, RoleMappedSchema schema, TextWriter writer)
EntryPoints\InputBase.cs (1)
64Func<IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>>> getCustom = null,
EntryPoints\PredictorModelImpl.cs (5)
23private readonly KeyValuePair<RoleMappedSchema.ColumnRole, string>[] _roleMappings; 60private PredictorModelImpl(TransformModel transformModel, IPredictor predictor, KeyValuePair<RoleMappedSchema.ColumnRole, string>[] roleMappings) 123var trainRms = GetTrainingSchema(env); 138internal override RoleMappedSchema GetTrainingSchema(IHostEnvironment env) 142var trainRms = new RoleMappedSchema(predInput.Schema, _roleMappings, opt: true);
EntryPoints\SummarizePredictor.cs (1)
49internal static IDataView GetSummaryAndStats(IHostEnvironment env, IPredictor predictor, RoleMappedSchema schema, out IDataView stats)
Evaluators\AnomalyDetectionEvaluator.cs (7)
95private protected override void CheckScoreAndLabelTypes(RoleMappedSchema schema) 107private protected override Aggregator GetAggregatorCore(RoleMappedSchema schema, string stratName) 502internal override void InitializeNextPass(DataViewRow row, RoleMappedSchema schema) 597RoleMappedSchema.ColumnRole.Label.Bind(label), 598RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Score, score), 599RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.PredictedLabel, predictedLabel)); 789private protected override IEnumerable<string> GetPerInstanceColumnsToSave(RoleMappedSchema schema)
Evaluators\BinaryClassifierEvaluator.cs (26)
126private protected override void CheckScoreAndLabelTypes(RoleMappedSchema schema) 139private protected override void CheckCustomColumnTypesCore(RoleMappedSchema schema) 158private protected override Func<int, bool> GetActiveColsCore(RoleMappedSchema schema) 166private protected override Aggregator GetAggregatorCore(RoleMappedSchema schema, string stratName) 172private ReadOnlyMemory<char>[] GetClassNames(RoleMappedSchema schema) 191private protected override IRowMapper CreatePerInstanceRowMapper(RoleMappedSchema schema) 620internal override void InitializeNextPass(DataViewRow row, RoleMappedSchema schema) 632var prob = schema.GetColumns(new RoleMappedSchema.ColumnRole(AnnotationUtils.Const.ScoreValueKind.Probability)); 819RoleMappedSchema.ColumnRole.Label.Bind(label), 820RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Score, score), 821RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Probability, probability), 822RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.PredictedLabel, predictedLabel)); 867RoleMappedSchema.ColumnRole.Label.Bind(label), 868RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Score, score), 869RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Probability, probability), 870RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.PredictedLabel, predictedLabel)); 947RoleMappedSchema.ColumnRole.Label.Bind(label), 948RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Score, score), 949RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.PredictedLabel, predictedLabel)); 993RoleMappedSchema.ColumnRole.Label.Bind(label), 994RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Score, score), 995RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.PredictedLabel, predictedLabel)); 1340private protected override IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRolesCore(RoleMappedSchema schema) 1351cols = AnnotationUtils.Prepend(cols, RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Probability, probCol.Value.Name)); 1472private protected override IEnumerable<string> GetPerInstanceColumnsToSave(RoleMappedSchema schema)
Evaluators\ClusteringEvaluator.cs (16)
70var roles = new List<KeyValuePair<RoleMappedSchema.ColumnRole, string>>(); 71roles.Add(RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Score, score)); 74roles.Add(RoleMappedSchema.ColumnRole.Label.Bind(label)); 77roles.Add(RoleMappedSchema.ColumnRole.Feature.Bind(features)); 97private protected override void CheckScoreAndLabelTypes(RoleMappedSchema schema) 112private protected override void CheckCustomColumnTypesCore(RoleMappedSchema schema) 126private protected override Func<int, bool> GetActiveColsCore(RoleMappedSchema schema) 134private protected override Aggregator GetAggregatorCore(RoleMappedSchema schema, string stratName) 145private protected override IRowMapper CreatePerInstanceRowMapper(RoleMappedSchema schema) 487internal override void InitializeNextPass(DataViewRow row, RoleMappedSchema schema) 801private protected override IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRolesCore(RoleMappedSchema schema) 805if (!col.Key.Equals(RoleMappedSchema.ColumnRole.Label)) 816yield return RoleMappedSchema.ColumnRole.Feature.Bind(feat); 821private protected override IEnumerable<string> GetPerInstanceColumnsToSave(RoleMappedSchema schema) 835private protected override IDataView GetPerInstanceMetricsCore(IDataView perInst, RoleMappedSchema schema)
Evaluators\EvaluatorBase.cs (21)
48private protected void CheckColumnTypes(RoleMappedSchema schema) 59/// Check that the types of the score and label columns are as expected by the evaluator. The <see cref="RoleMappedSchema"/> 61/// Access the label column with the <see cref="RoleMappedSchema.Label"/> property, and the score column with the 62/// <see cref="RoleMappedSchema.GetUniqueColumn"/> or <see cref="RoleMappedSchema.GetColumns"/> methods. 65private protected abstract void CheckScoreAndLabelTypes(RoleMappedSchema schema); 72private protected virtual void CheckCustomColumnTypesCore(RoleMappedSchema schema) 76private Func<int, bool> GetActiveCols(RoleMappedSchema schema) 91private protected virtual Func<int, bool> GetActiveColsCore(RoleMappedSchema schema) 102private TAgg GetAggregator(RoleMappedSchema schema) 110private AggregatorDictionaryBase[] GetAggregatorDictionaries(RoleMappedSchema schema) 124private protected abstract TAgg GetAggregatorCore(RoleMappedSchema schema, string stratName); 130private Dictionary<string, IDataView> ProcessData(IDataView data, RoleMappedSchema schema, 231/// information is stored in the given <see cref="RoleMappedSchema"/>. 269internal abstract void InitializeNextPass(DataViewRow row, RoleMappedSchema schema); 342private protected readonly RoleMappedSchema Schema; 348private protected AggregatorDictionaryBase(RoleMappedSchema schema, string stratCol, Func<string, TAgg> createAgg) 364internal static AggregatorDictionaryBase Create(RoleMappedSchema schema, string stratCol, DataViewType stratType, 378private static AggregatorDictionaryBase CreateDictionary<TStrat>(RoleMappedSchema schema, string stratCol, 406public GenericAggregatorDictionary(RoleMappedSchema schema, string stratCol, DataViewType stratType, Func<string, TAgg> createAgg) 464private protected abstract IRowMapper CreatePerInstanceRowMapper(RoleMappedSchema schema);
Evaluators\MamlEvaluator.cs (14)
77internal static RoleMappedSchema.ColumnRole Strat = "Strat"; 114private protected IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRoles(RoleMappedSchema schema, bool needStrat = false, bool needName = false) 119? Enumerable.Empty<KeyValuePair<RoleMappedSchema.ColumnRole, string>>() 120: StratCols.Select(col => RoleMappedSchema.CreatePair(Strat, col)); 123roles = AnnotationUtils.Prepend(roles, RoleMappedSchema.ColumnRole.Name.Bind(schema.Name.Value.Name)); 134private protected virtual IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRolesCore(RoleMappedSchema schema) 139yield return RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Score, scoreCol.Name); 143yield return RoleMappedSchema.ColumnRole.Label.Bind(label); 147yield return RoleMappedSchema.ColumnRole.Weight.Bind(weight); 222var schema = scoredData.Schema; 276private protected virtual IDataView GetPerInstanceMetricsCore(IDataView perInst, RoleMappedSchema schema) 294private protected abstract IEnumerable<string> GetPerInstanceColumnsToSave(RoleMappedSchema schema);
Evaluators\MulticlassClassificationEvaluator.cs (10)
75private protected override void CheckScoreAndLabelTypes(RoleMappedSchema schema) 87private protected override Aggregator GetAggregatorCore(RoleMappedSchema schema, string stratName) 96private ReadOnlyMemory<char>[] GetClassNames(RoleMappedSchema schema) 120private protected override IRowMapper CreatePerInstanceRowMapper(RoleMappedSchema schema) 412internal override void InitializeNextPass(DataViewRow row, RoleMappedSchema schema) 558RoleMappedSchema.ColumnRole.Label.Bind(label), 559RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Score, score), 560RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.PredictedLabel, predictedLabel)); 1036private protected override IEnumerable<string> GetPerInstanceColumnsToSave(RoleMappedSchema schema) 1052private protected override IDataView GetPerInstanceMetricsCore(IDataView perInst, RoleMappedSchema schema)
Evaluators\MultiOutputRegressionEvaluator.cs (5)
50private protected override IRowMapper CreatePerInstanceRowMapper(RoleMappedSchema schema) 58private protected override void CheckScoreAndLabelTypes(RoleMappedSchema schema) 70private protected override Aggregator GetAggregatorCore(RoleMappedSchema schema, string stratName) 302internal override void InitializeNextPass(DataViewRow row, RoleMappedSchema schema) 640private protected override IEnumerable<string> GetPerInstanceColumnsToSave(RoleMappedSchema schema)
Evaluators\QuantileRegressionEvaluator.cs (4)
42private protected override IRowMapper CreatePerInstanceRowMapper(RoleMappedSchema schema) 56private protected override void CheckScoreAndLabelTypes(RoleMappedSchema schema) 68private protected override Aggregator GetAggregatorCore(RoleMappedSchema schema, string stratName) 539private protected override IEnumerable<string> GetPerInstanceColumnsToSave(RoleMappedSchema schema)
Evaluators\RankingEvaluator.cs (12)
96private protected override void CheckScoreAndLabelTypes(RoleMappedSchema schema) 112private protected override void CheckCustomColumnTypesCore(RoleMappedSchema schema) 123private protected override Func<int, bool> GetActiveColsCore(RoleMappedSchema schema) 129private protected override Aggregator GetAggregatorCore(RoleMappedSchema schema, string stratName) 260RoleMappedSchema.ColumnRole.Label.Bind(label), 261RoleMappedSchema.ColumnRole.Group.Bind(groupId), 262RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Score, score)); 452internal override void InitializeNextPass(DataViewRow row, RoleMappedSchema schema) 893private protected override IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRolesCore(RoleMappedSchema schema) 897return cols.Prepend(RoleMappedSchema.ColumnRole.Group.Bind(groupIdCol)); 940private protected override IEnumerable<string> GetPerInstanceColumnsToSave(RoleMappedSchema schema)
Evaluators\RegressionEvaluator.cs (6)
55private protected override void CheckScoreAndLabelTypes(RoleMappedSchema schema) 67private protected override Aggregator GetAggregatorCore(RoleMappedSchema schema, string stratName) 72private protected override IRowMapper CreatePerInstanceRowMapper(RoleMappedSchema schema) 180RoleMappedSchema.ColumnRole.Label.Bind(label), 181RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Score, score)); 361private protected override IEnumerable<string> GetPerInstanceColumnsToSave(RoleMappedSchema schema)
Evaluators\RegressionEvaluatorBase.cs (1)
200internal override void InitializeNextPass(DataViewRow row, RoleMappedSchema schema)
Model\Onnx\ICanSaveOnnx.cs (1)
67bool SaveAsOnnx(OnnxContext ctx, RoleMappedSchema schema, string[] outputNames);
Model\Pfa\ICanSavePfa.cs (1)
71void SaveAsPfa(BoundPfaContext ctx, RoleMappedSchema schema, string[] outputNames);
Model\Pfa\SavePfaCommand.cs (1)
125RoleMappedSchema trainSchema;
Prediction\Calibrator.cs (12)
225void ICanSaveInIniFormat.SaveAsIni(TextWriter writer, RoleMappedSchema schema, ICalibrator calibrator) 232void ICanSaveInTextFormat.SaveAsText(TextWriter writer, RoleMappedSchema schema) 240void ICanSaveInSourceCode.SaveAsCode(TextWriter writer, RoleMappedSchema schema) 248void ICanSaveSummary.SaveSummary(TextWriter writer, RoleMappedSchema schema) 257IList<KeyValuePair<string, object>> ICanGetSummaryInKeyValuePairs.GetSummaryInKeyValuePairs(RoleMappedSchema schema) 655public RoleMappedSchema InputRoleMappedSchema => _predictor.InputRoleMappedSchema; 659public Bound(IHostEnvironment env, SchemaBindableCalibratedModelParameters<TSubModel, TCalibrator> parent, RoleMappedSchema schema) 684public IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRoles() 781void IBindableCanSavePfa.SaveAsPfa(BoundPfaContext ctx, RoleMappedSchema schema, string[] outputs) 791bool IBindableCanSaveOnnx.SaveAsOnnx(OnnxContext ctx, RoleMappedSchema schema, string[] outputs) 800public ISchemaBoundMapper Bind(IHostEnvironment env, RoleMappedSchema schema) 845ITrainer trainer, IPredictor predictor, RoleMappedSchema schema)
Scorers\BinaryClassifierScorer.cs (3)
55private static ISchemaBoundMapper WrapIfNeeded(IHostEnvironment env, ISchemaBoundMapper mapper, RoleMappedSchema trainSchema) 105private static ISchemaBoundMapper WrapCore<T>(IHostEnvironment env, ISchemaBoundMapper mapper, RoleMappedSchema trainSchema) 126internal BinaryClassifierScorer(IHostEnvironment env, Arguments args, IDataView data, ISchemaBoundMapper mapper, RoleMappedSchema trainSchema)
Scorers\ClusteringScorer.cs (1)
45internal ClusteringScorer(IHostEnvironment env, Arguments args, IDataView data, ISchemaBoundMapper mapper, RoleMappedSchema trainSchema)
Scorers\FeatureContributionCalculation.cs (7)
56private static IDataScorerTransform Create(IHostEnvironment env, Arguments args, IDataView data, ISchemaBoundMapper mapper, RoleMappedSchema trainSchema) 162public ISchemaBoundMapper Bind(IHostEnvironment env, RoleMappedSchema schema) 281private static void CheckSchemaValid(IExceptionContext ectx, RoleMappedSchema schema, 304public RoleMappedSchema InputRoleMappedSchema { get; } 313public RowMapper(IHostEnvironment env, BindableMapper parent, RoleMappedSchema schema) 388public IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRoles() 390yield return RoleMappedSchema.ColumnRole.Feature.Bind(FeatureColumn.Name);
Scorers\GenericScorer.cs (4)
66IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> roles, string suffix, bool user = true) 154ISchemaBoundMapper mapper, RoleMappedSchema trainSchema) 216var schema = _bindings.RowMapper.InputRoleMappedSchema; 231var schema = _bindings.RowMapper.InputRoleMappedSchema;
Scorers\MulticlassClassificationScorer.cs (8)
211void IBindableCanSavePfa.SaveAsPfa(BoundPfaContext ctx, RoleMappedSchema schema, string[] outputNames) 220bool IBindableCanSaveOnnx.SaveAsOnnx(OnnxContext ctx, RoleMappedSchema schema, string[] outputNames) 229ISchemaBoundMapper ISchemaBindableMapper.Bind(IHostEnvironment env, RoleMappedSchema schema) 264public RoleMappedSchema InputRoleMappedSchema => _mapper.InputRoleMappedSchema; 344public IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRoles() => _mapper.GetInputColumnRoles(); 405private static ISchemaBoundMapper WrapIfNeeded(IHostEnvironment env, ISchemaBoundMapper mapper, RoleMappedSchema trainSchema) 485internal static ISchemaBoundMapper WrapCore<T>(IHostEnvironment env, ISchemaBoundMapper mapper, RoleMappedSchema trainSchema) 512internal MulticlassClassificationScorer(IHostEnvironment env, Arguments args, IDataView data, ISchemaBoundMapper mapper, RoleMappedSchema trainSchema)
Scorers\PredictedLabelScorerBase.cs (4)
112var schema = new RoleMappedSchema(input, RowMapper.GetInputColumnRoles()); 283ISchemaBoundMapper mapper, RoleMappedSchema trainSchema, string registrationName, string scoreColKind, string scoreColName, 342var schema = Bindings.RowMapper.InputRoleMappedSchema; 375var schema = Bindings.RowMapper.InputRoleMappedSchema;
Scorers\PredictionTransformer.cs (6)
306var schema = new RoleMappedSchema(TrainSchema, null, FeatureColumnName); 348var schema = new RoleMappedSchema(TrainSchema, null, FeatureColumnName); 440var schema = new RoleMappedSchema(TrainSchema, LabelColumnName, FeatureColumnName); 532var schema = new RoleMappedSchema(TrainSchema, _trainLabelColumn, FeatureColumnName); 674var schema = new RoleMappedSchema(inputSchema, null, featureColumn); 686var schema = new RoleMappedSchema(TrainSchema, null, FeatureColumnName);
Scorers\QuantileRegressionScorer.cs (1)
32private static IDataScorerTransform Create(IHostEnvironment env, Arguments args, IDataView data, ISchemaBoundMapper mapper, RoleMappedSchema trainSchema)
Scorers\RowToRowScorerBase.cs (3)
380protected static KeyValuePair<RoleMappedSchema.ColumnRole, string>[] LoadBaseInfo( 394var columns = new KeyValuePair<RoleMappedSchema.ColumnRole, string>[count]; 399columns[i] = RoleMappedSchema.CreatePair(role, name);
Scorers\SchemaBindablePredictorWrapper.cs (23)
94void IBindableCanSavePfa.SaveAsPfa(BoundPfaContext ctx, RoleMappedSchema schema, string[] outputNames) 103private protected virtual void SaveAsPfaCore(BoundPfaContext ctx, RoleMappedSchema schema, string[] outputNames) 108bool IBindableCanSaveOnnx.SaveAsOnnx(OnnxContext ctx, RoleMappedSchema schema, string[] outputNames) 118private protected virtual bool SaveAsOnnxCore(OnnxContext ctx, RoleMappedSchema schema, string[] outputNames) => false; 120ISchemaBoundMapper ISchemaBindableMapper.Bind(IHostEnvironment env, RoleMappedSchema schema) 155private protected abstract ISchemaBoundMapper BindCore(IChannel ch, RoleMappedSchema schema); 182void ICanSaveSummary.SaveSummary(TextWriter writer, RoleMappedSchema schema) 201public RoleMappedSchema InputRoleMappedSchema { get; } 205public SingleValueRowMapper(RoleMappedSchema schema, SchemaBindablePredictorWrapperBase parent, DataViewSchema outputSchema) 228public IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRoles() 230yield return RoleMappedSchema.ColumnRole.Feature.Bind(InputRoleMappedSchema.Feature.Value.Name); 324private protected override void SaveAsPfaCore(BoundPfaContext ctx, RoleMappedSchema schema, string[] outputNames) 340private protected override bool SaveAsOnnxCore(OnnxContext ctx, RoleMappedSchema schema, string[] outputNames) 355private protected override ISchemaBoundMapper BindCore(IChannel ch, RoleMappedSchema schema) => 431private protected override void SaveAsPfaCore(BoundPfaContext ctx, RoleMappedSchema schema, string[] outputNames) 451private protected override bool SaveAsOnnxCore(OnnxContext ctx, RoleMappedSchema schema, string[] outputNames) 492private protected override ISchemaBoundMapper BindCore(IChannel ch, RoleMappedSchema schema) 510public RoleMappedSchema InputRoleMappedSchema { get; } 517public CalibratedRowMapper(RoleMappedSchema schema, SchemaBindableBinaryPredictorWrapper parent) 548public IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRoles() 550yield return (InputRoleMappedSchema.Feature.HasValue) ? RoleMappedSchema.ColumnRole.Feature.Bind(InputRoleMappedSchema.Feature?.Name) : RoleMappedSchema.ColumnRole.Label.Bind(InputRoleMappedSchema.Label?.Name); 695private protected override ISchemaBoundMapper BindCore(IChannel ch, RoleMappedSchema schema) =>
Training\TrainerUtils.cs (5)
262public static ValueGetter<VBuffer<float>> GetFeatureFloatVectorGetter(this DataViewRow row, RoleMappedSchema schema) 285public static ValueGetter<float> GetLabelFloatGetter(this DataViewRow row, RoleMappedSchema schema) 308public static ValueGetter<float> GetOptWeightFloatGetter(this DataViewRow row, RoleMappedSchema schema) 329public static ValueGetter<ulong> GetOptGroupGetter(this DataViewRow row, RoleMappedSchema schema) 427var tschema = context.TrainingSet.Schema;
Transforms\TrainAndScoreTransformer.cs (3)
42public IComponentFactory<IDataView, ISchemaBoundMapper, RoleMappedSchema, IDataScorerTransform> Scorer; 84RoleMappedSchema trainSchema = null; 159public IComponentFactory<IDataView, ISchemaBoundMapper, RoleMappedSchema, IDataScorerTransform> Scorer;
Utilities\ComponentCreation.cs (4)
48string group = null, string weight = null, IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> custom = null) 156RoleMappedData data, IPredictor predictor, RoleMappedSchema trainSchema = null) 163Type factoryType = typeof(IComponentFactory<IDataView, ISchemaBoundMapper, RoleMappedSchema, IDataScorerTransform>); 187IPredictor predictor, RoleMappedSchema trainSchema = null)
Utilities\ModelFileUtils.cs (6)
17using ColumnRole = RoleMappedSchema.ColumnRole; 231internal static void SaveRoleMappings(IHostEnvironment env, IChannel ch, RoleMappedSchema schema, RepositoryWriter rep) 325/// Returns the <see cref="RoleMappedSchema"/> from a model stream, or <c>null</c> if there were no 328public static RoleMappedSchema LoadRoleMappedSchemaOrNull(IHostEnvironment env, Stream modelStream) 339/// Returns the <see cref="RoleMappedSchema"/> from a repository, or <c>null</c> if there were no 342public static RoleMappedSchema LoadRoleMappedSchemaOrNull(IHostEnvironment env, RepositoryReader rep)
Microsoft.ML.Ensemble (23)
PipelineEnsemble.cs (9)
42public RoleMappedSchema InputRoleMappedSchema { get; } 46public BoundBase(SchemaBindablePipelineEnsembleBase parent, RoleMappedSchema schema) 103public IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRoles() 124public Bound(SchemaBindablePipelineEnsemble<T> parent, RoleMappedSchema schema) 225private protected override ISchemaBoundMapper BindCore(IHostEnvironment env, RoleMappedSchema schema) 565ISchemaBoundMapper ISchemaBindableMapper.Bind(IHostEnvironment env, RoleMappedSchema schema) => BindCore(env, schema); 567private protected abstract ISchemaBoundMapper BindCore(IHostEnvironment env, RoleMappedSchema schema); 569void ICanSaveSummary.SaveSummary(TextWriter writer, RoleMappedSchema schema) 701IList<KeyValuePair<string, object>> ICanGetSummaryInKeyValuePairs.GetSummaryInKeyValuePairs(RoleMappedSchema schema)
Selector\SubModelSelector\BaseSubModelSelector.cs (12)
102private IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetColumnRoles( 103RoleMappedSchema testSchema, DataViewSchema scoredSchema) 108yield return RoleMappedSchema.CreatePair(RoleMappedSchema.ColumnRole.Label, testSchema.Label.Value.Name); 111yield return RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Score, scoreCol.Name); 116yield return RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Probability, probCol.Value.Name); 119yield return RoleMappedSchema.CreatePair(RoleMappedSchema.ColumnRole.Label, testSchema.Label.Value.Name); 122yield return RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Score, scoreCol.Name); 125yield return RoleMappedSchema.CreatePair(RoleMappedSchema.ColumnRole.Label, testSchema.Label.Value.Name); 128yield return RoleMappedSchema.CreatePair(AnnotationUtils.Const.ScoreValueKind.Score, scoreCol.Name);
Trainer\EnsembleModelParametersBase.cs (2)
130void ICanSaveInTextFormat.SaveAsText(TextWriter writer, RoleMappedSchema schema) 146void ICanSaveSummary.SaveSummary(TextWriter writer, RoleMappedSchema schema)
Microsoft.ML.EntryPoints (18)
CrossValidationMacro.cs (4)
366RoleMappedSchema.ColumnRole.Label.Bind(input.LabelColumn), 367RoleMappedSchema.ColumnRole.Weight.Bind(input.WeightColumn.Value), 368RoleMappedSchema.ColumnRole.Group.Bind(input.GroupColumn), 369RoleMappedSchema.ColumnRole.Name.Bind(input.NameColumn.Value))).ToArray(),
FeatureCombiner.cs (4)
28internal IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetRoles() 33yield return RoleMappedSchema.ColumnRole.Feature.Bind(col); 55var rms = new RoleMappedSchema(viewTrain.Schema, input.GetRoles()); 56var feats = rms.GetColumns(RoleMappedSchema.ColumnRole.Feature);
PermutationFeatureImportance.cs (10)
91var featureColumnName = roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Feature.Value).First().Value; 92var labelColumnName = roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Label.Value).First().Value; 148var featureColumnName = roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Feature.Value).First().Value; 149var labelColumnName = roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Label.Value).First().Value; 207var featureColumnName = roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Feature.Value).First().Value; 208var labelColumnName = roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Label.Value).First().Value; 259var featureColumnName = roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Feature.Value).First().Value; 260var labelColumnName = roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Label.Value).First().Value; 261var groupIdColumnName = roles.Where(x => x.Key.Value == RoleMappedSchema.ColumnRole.Group.Value).First().Value; 307private static string[] GetSlotNames(RoleMappedSchema schema)
Microsoft.ML.FastTree (36)
FastTree.cs (11)
2962void ICanSaveInSourceCode.SaveAsCode(TextWriter writer, RoleMappedSchema schema) 2971void ICanSaveInTextFormat.SaveAsText(TextWriter writer, RoleMappedSchema schema) 2981void ICanSaveInIniFormat.SaveAsIni(TextWriter writer, RoleMappedSchema schema, ICalibrator calibrator) 3134void ICanSaveSummary.SaveSummary(TextWriter writer, RoleMappedSchema schema) 3146private IEnumerable<KeyValuePair<string, double>> GetSortedFeatureGains(RoleMappedSchema schema) 3151AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, NumFeatures, ref names); 3165IList<KeyValuePair<string, object>> ICanGetSummaryInKeyValuePairs.GetSummaryInKeyValuePairs(RoleMappedSchema schema) 3178private void SaveEnsembleAsCode(TextWriter writer, RoleMappedSchema schema) 3183AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, NumFeatures, ref names); 3394IDataView ICanGetSummaryAsIDataView.GetSummaryDataView(RoleMappedSchema schema) 3440IDataView ICanGetSummaryAsIDataView.GetSummaryDataView(RoleMappedSchema schema)
GamModelParameters.cs (8)
356void ICanSaveInTextFormat.SaveAsText(TextWriter writer, RoleMappedSchema schema) 373AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, _numInputFeatures, ref names); 397void ICanSaveSummary.SaveSummary(TextWriter writer, RoleMappedSchema schema) 436void ICanSaveInIniFormat.SaveAsIni(TextWriter writer, RoleMappedSchema schema, ICalibrator calibrator) 633var schema = _data.Schema; 683RoleMappedSchema.ColumnRole.Label.Bind(DefaultColumnNames.Label), 684new RoleMappedSchema.ColumnRole(AnnotationUtils.Const.ScoreValueKind.Score).Bind(DefaultColumnNames.Score)); 873RoleMappedSchema schema;
TreeEnsemble\InternalTreeEnsemble.cs (2)
421/// A class that given either a <see cref="RoleMappedSchema"/> 437public FeaturesToContentMap(RoleMappedSchema schema)
TreeEnsembleFeaturizationTransformer.cs (7)
59/// Create <see cref="RoleMappedSchema"/> from <paramref name="schema"/> by using <see cref="_featureDetachedColumn"/> as the feature role. 62private RoleMappedSchema MakeFeatureRoleMappedSchema(DataViewSchema schema) 64var roles = new List<KeyValuePair<RoleMappedSchema.ColumnRole, string>>(); 65roles.Add(new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RoleMappedSchema.ColumnRole.Feature, _featureDetachedColumn.Name)); 100var roleMappedSchema = MakeFeatureRoleMappedSchema(inputSchema); 134var roleMappedSchema = MakeFeatureRoleMappedSchema(TrainSchema);
TreeEnsembleFeaturizer.cs (7)
69public RoleMappedSchema InputRoleMappedSchema { get; } 104public BoundMapper(IExceptionContext ectx, TreeEnsembleFeaturizerBindableMapper owner, RoleMappedSchema schema, 357public IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRoles() 359yield return RoleMappedSchema.ColumnRole.Feature.Bind(FeatureColumn.Name); 522ISchemaBoundMapper ISchemaBindableMapper.Bind(IHostEnvironment env, RoleMappedSchema schema) 589TreeEnsembleFeaturizerBindableMapper.Arguments args, IDataView data, ISchemaBoundMapper mapper, RoleMappedSchema trainSchema) 676trainScoreArgs.Scorer = ComponentFactoryUtils.CreateFromFunction<IDataView, ISchemaBoundMapper, RoleMappedSchema, IDataScorerTransform>(
Utils\FastTreeIniFileUtils.cs (1)
16IHost host, InternalTreeEnsemble ensemble, RoleMappedSchema schema, ICalibrator calibrator,
Microsoft.ML.KMeansClustering (1)
KMeansModelParameters.cs (1)
178void ICanSaveInTextFormat.SaveAsText(TextWriter writer, RoleMappedSchema schema)
Microsoft.ML.Mkl.Components (2)
OlsLinearRegression.cs (2)
899private protected override void SaveSummary(TextWriter writer, RoleMappedSchema schema) 902AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, Weight.Length, ref names);
Microsoft.ML.OnnxConverter (1)
SaveOnnxCommand.cs (1)
296RoleMappedSchema trainSchema = null;
Microsoft.ML.PCA (3)
PcaTrainer.cs (3)
555void ICanSaveSummary.SaveSummary(TextWriter writer, RoleMappedSchema schema) 560void ICanSaveInTextFormat.SaveAsText(TextWriter writer, RoleMappedSchema schema) 587IDataView ICanGetSummaryAsIDataView.GetSummaryDataView(RoleMappedSchema schema)
Microsoft.ML.Predictor.Tests (10)
TestIniModels.cs (10)
535var roleMappedSchema = new RoleMappedSchema(data.Schema, false, 536new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RoleMappedSchema.ColumnRole.Feature, "Features"), 537new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RoleMappedSchema.ColumnRole.Label, "Label")); 574var roleMappedSchema = new RoleMappedSchema(data.Schema, false, 575new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RoleMappedSchema.ColumnRole.Feature, "Features"), 576new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RoleMappedSchema.ColumnRole.Label, "Label"));
Microsoft.ML.Recommender (20)
MatrixFactorizationPredictor.cs (12)
193void ICanSaveInTextFormat.SaveAsText(TextWriter writer, RoleMappedSchema schema) 313ISchemaBoundMapper ISchemaBindableMapper.Bind(IHostEnvironment env, RoleMappedSchema schema) 333public RoleMappedSchema InputRoleMappedSchema { get; } 335public RowMapper(IHostEnvironment env, MatrixFactorizationModelParameters parent, RoleMappedSchema schema, DataViewSchema outputSchema) 373public IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRoles() 464var schema = GetSchema(); 469private RoleMappedSchema GetSchema() 471var roles = new List<KeyValuePair<RoleMappedSchema.ColumnRole, string>>(); 472roles.Add(new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RecommenderUtils.MatrixColumnIndexKind, MatrixColumnIndexColumnName)); 473roles.Add(new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RecommenderUtils.MatrixRowIndexKind, MatrixRowIndexColumnName)); 474var schema = new RoleMappedSchema(TrainSchema, roles); 503var schema = GetSchema();
MatrixFactorizationTrainer.cs (5)
529var roles = new List<KeyValuePair<RoleMappedSchema.ColumnRole, string>>(); 530roles.Add(new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RoleMappedSchema.ColumnRole.Label, LabelName)); 531roles.Add(new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RecommenderUtils.MatrixColumnIndexKind.Value, MatrixColumnIndexName)); 532roles.Add(new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RecommenderUtils.MatrixRowIndexKind.Value, MatrixRowIndexName));
RecommenderUtils.cs (3)
48private static KeyDataViewType CheckRowColumnType(RoleMappedData data, RoleMappedSchema.ColumnRole role, out DataViewSchema.Column col, bool isDecode) 79public static RoleMappedSchema.ColumnRole MatrixColumnIndexKind => "MatrixColumnIndex"; 84public static RoleMappedSchema.ColumnRole MatrixRowIndexKind => "MatrixRowIndex";
Microsoft.ML.StandardTrainers (74)
FactorizationMachine\FactorizationMachineTrainer.cs (10)
362var featureColumns = data.Schema.GetColumns(RoleMappedSchema.ColumnRole.Feature); 415var featureColumns = data.Schema.GetColumns(RoleMappedSchema.ColumnRole.Feature); 440var validFeatureColumns = data.Schema.GetColumns(RoleMappedSchema.ColumnRole.Feature); 593var roles = new List<KeyValuePair<RoleMappedSchema.ColumnRole, string>>(); 595roles.Add(new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RoleMappedSchema.ColumnRole.Feature, feat.Name)); 597roles.Add(new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RoleMappedSchema.ColumnRole.Label, LabelColumn.Name)); 600roles.Add(new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RoleMappedSchema.ColumnRole.Feature, WeightColumn.Name));
FactorizationMachine\FieldAwareFactorizationMachineModelParameters.cs (8)
239ISchemaBoundMapper ISchemaBindableMapper.Bind(IHostEnvironment env, RoleMappedSchema schema) 327var schema = GetSchema(); 362var schema = GetSchema(); 421private RoleMappedSchema GetSchema() 423var roles = new List<KeyValuePair<RoleMappedSchema.ColumnRole, string>>(); 425roles.Add(new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RoleMappedSchema.ColumnRole.Feature, feat)); 427var schema = new RoleMappedSchema(TrainSchema, roles);
FactorizationMachine\FieldAwareFactorizationMachineUtils.cs (7)
61public RoleMappedSchema InputRoleMappedSchema { get; } 73public FieldAwareFactorizationMachineScalarRowMapper(IHostEnvironment env, RoleMappedSchema schema, 84_columns = schema.GetColumns(RoleMappedSchema.ColumnRole.Feature).ToArray(); 87var inputFeatureColumns = _columns.Select(c => new KeyValuePair<RoleMappedSchema.ColumnRole, string>(RoleMappedSchema.ColumnRole.Feature, c.Name)).ToList(); 151public IEnumerable<KeyValuePair<RoleMappedSchema.ColumnRole, string>> GetInputColumnRoles() 153return InputRoleMappedSchema.GetColumnRoles().Select(kvp => new KeyValuePair<RoleMappedSchema.ColumnRole, string>(kvp.Key, kvp.Value.Name));
Standard\LinearModelParameters.cs (20)
352void ICanSaveInTextFormat.SaveAsText(TextWriter writer, RoleMappedSchema schema) 360void ICanSaveInSourceCode.SaveAsCode(TextWriter writer, RoleMappedSchema schema) 370private protected abstract void SaveSummary(TextWriter writer, RoleMappedSchema schema); 372void ICanSaveSummary.SaveSummary(TextWriter writer, RoleMappedSchema schema) => SaveSummary(writer, schema); 374private protected virtual DataViewRow GetSummaryIRowOrNull(RoleMappedSchema schema) 377AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, Weight.Length, ref names); 387DataViewRow ICanGetSummaryAsIRow.GetSummaryIRowOrNull(RoleMappedSchema schema) => GetSummaryIRowOrNull(schema); 389private protected virtual DataViewRow GetStatsIRowOrNull(RoleMappedSchema schema) => null; 391DataViewRow ICanGetSummaryAsIRow.GetStatsIRowOrNull(RoleMappedSchema schema) => GetStatsIRowOrNull(schema); 393private protected abstract void SaveAsIni(TextWriter writer, RoleMappedSchema schema, ICalibrator calibrator = null); 395void ICanSaveInIniFormat.SaveAsIni(TextWriter writer, RoleMappedSchema schema, ICalibrator calibrator) => SaveAsIni(writer, schema, calibrator); 523private protected override void SaveSummary(TextWriter writer, RoleMappedSchema schema) 536IList<KeyValuePair<string, object>> ICanGetSummaryInKeyValuePairs.GetSummaryInKeyValuePairs(RoleMappedSchema schema) 547private protected override DataViewRow GetStatsIRowOrNull(RoleMappedSchema schema) 552AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, Weight.Length, ref names); 557private protected override void SaveAsIni(TextWriter writer, RoleMappedSchema schema, ICalibrator calibrator = null) 591private protected override void SaveAsIni(TextWriter writer, RoleMappedSchema schema, ICalibrator calibrator) 658private protected override void SaveSummary(TextWriter writer, RoleMappedSchema schema) 681IList<KeyValuePair<string, object>> ICanGetSummaryInKeyValuePairs.GetSummaryInKeyValuePairs(RoleMappedSchema schema) 759private protected override void SaveSummary(TextWriter writer, RoleMappedSchema schema)
Standard\LinearPredictorUtils.cs (7)
32RoleMappedSchema schema, string codeVariable = "output") 38AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, weights.Length, ref featureNames); 97RoleMappedSchema schema = null, PlattCalibrator calibrator = null) 106AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, weights.Length, ref featureNames); 179RoleMappedSchema schema = null, PlattCalibrator calibrator = null) 229in VBuffer<float> weights, float bias, RoleMappedSchema schema, List<KeyValuePair<string, object>> results) 232AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, weights.Length, ref names);
Standard\LogisticRegression\MulticlassLogisticRegression.cs (16)
832IList<KeyValuePair<string, object>> ICanGetSummaryInKeyValuePairs.GetSummaryInKeyValuePairs(RoleMappedSchema schema) 839AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, NumberOfFeatures, ref names); 870/// Actual implementation of <see cref="ICanSaveInTextFormat.SaveAsText(TextWriter, RoleMappedSchema)"/> should happen in derived classes. 872private void SaveAsTextCore(TextWriter writer, RoleMappedSchema schema) 889/// Redirect <see cref="ICanSaveInTextFormat.SaveAsText(TextWriter, RoleMappedSchema)"/> call to the right function. 891void ICanSaveInTextFormat.SaveAsText(TextWriter writer, RoleMappedSchema schema) => SaveAsTextCore(writer, schema); 896void ICanSaveSummary.SaveSummary(TextWriter writer, RoleMappedSchema schema) 902/// Actual implementation of <see cref="ICanSaveInSourceCode.SaveAsCode(TextWriter, RoleMappedSchema)"/> should happen in derived classes. 904private void SaveAsCodeCore(TextWriter writer, RoleMappedSchema schema) 928/// Redirect <see cref="ICanSaveInSourceCode.SaveAsCode(TextWriter, RoleMappedSchema)"/> call to the right function. 930void ICanSaveInSourceCode.SaveAsCode(TextWriter writer, RoleMappedSchema schema) => SaveAsCodeCore(writer, schema); 1094IDataView ICanGetSummaryAsIDataView.GetSummaryDataView(RoleMappedSchema schema) 1100AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, NumberOfFeatures, ref dst); 1109DataViewRow ICanGetSummaryAsIRow.GetSummaryIRowOrNull(RoleMappedSchema schema) 1114DataViewRow ICanGetSummaryAsIRow.GetStatsIRowOrNull(RoleMappedSchema schema) 1120AnnotationUtils.GetSlotNames(schema, RoleMappedSchema.ColumnRole.Feature, Weights.Length, ref names);
Standard\ModelStatistics.cs (2)
181internal virtual DataViewSchema.Annotations MakeStatisticsMetadata(RoleMappedSchema schema, in VBuffer<ReadOnlyMemory<char>> names) 557internal override DataViewSchema.Annotations MakeStatisticsMetadata(RoleMappedSchema schema, in VBuffer<ReadOnlyMemory<char>> names)
Standard\MulticlassClassification\OneVersusAllTrainer.cs (3)
37using CR = RoleMappedSchema.ColumnRole; 456void ICanSaveInSourceCode.SaveAsCode(TextWriter writer, RoleMappedSchema schema) 476void ICanSaveInTextFormat.SaveAsText(TextWriter writer, RoleMappedSchema schema)
Standard\MulticlassClassification\PairwiseCouplingTrainer.cs (1)
26using CR = RoleMappedSchema.ColumnRole;
Microsoft.ML.Tests (1)
TrainerEstimators\TreeEnsembleFeaturizerTest.cs (1)
49var roleMappedSchema = new RoleMappedSchema(dataView.Schema,
Microsoft.ML.Transforms (2)
Dracula\CountTableTransformer.cs (2)
135CheckLabelType(new RoleMappedData(input, roles: RoleMappedSchema.CreatePair(RoleMappedSchema.ColumnRole.Label, _labelColumnName)), out var labelCardinality);