27 implementations of Schema
Microsoft.Data.Analysis (1)
DataFrame.IDataView.cs (1)
39DataViewSchema IDataView.Schema => DataViewSchema;
Microsoft.ML.Data (22)
Data\RowCursorUtils.cs (1)
512public DataViewSchema Schema => _row.Schema;
DataLoadSave\Binary\BinaryLoader.cs (1)
737public DataViewSchema Schema => _outputSchema;
DataLoadSave\Database\DatabaseLoader.cs (1)
718public DataViewSchema Schema => _loader._bindings.OutputSchema;
DataLoadSave\LegacyCompositeDataLoader.cs (1)
583public DataViewSchema Schema => View.Schema;
DataLoadSave\Text\TextLoader.cs (1)
1660public DataViewSchema Schema => _loader._bindings.OutputSchema;
DataLoadSave\Transpose\TransposeLoader.cs (1)
380public DataViewSchema Schema => _schemaEntry.GetView().Schema;
DataView\AppendRowsDataView.cs (1)
41public DataViewSchema Schema { get; }
DataView\ArrayDataViewBuilder.cs (1)
202public DataViewSchema Schema { get { return _schema; } }
DataView\BatchDataViewMapperBase.cs (1)
16public DataViewSchema Schema => SchemaBindings.AsSchema;
DataView\CacheDataView.cs (1)
193public DataViewSchema Schema => _subsetInput.Schema;
DataView\DataViewConstructionUtils.cs (1)
460public DataViewSchema Schema => _schema;
DataView\EmptyDataView.cs (1)
21public DataViewSchema Schema { get; }
DataView\OpaqueDataView.cs (1)
19public DataViewSchema Schema => _source.Schema;
DataView\Transposer.cs (3)
283public DataViewSchema Schema => _view.Schema; 737public DataViewSchema Schema { get; } 1420public DataViewSchema Schema { get; }
DataView\ZipDataView.cs (1)
57public DataViewSchema Schema => _zipBinding.OutputSchema;
Evaluators\RankingEvaluator.cs (1)
582DataViewSchema IDataView.Schema => OutputSchema;
Transforms\ColumnSelecting.cs (1)
673DataViewSchema IDataView.Schema => OutputSchema;
Transforms\NopTransform.cs (1)
108DataViewSchema IDataView.Schema => OutputSchema;
Transforms\PerGroupTransformBase.cs (1)
94DataViewSchema IDataView.Schema => OutputSchema;
Transforms\TransformBase.cs (1)
61DataViewSchema IDataView.Schema => OutputSchema;
Microsoft.ML.Samples (1)
Dynamic\SimpleDataViewImplementation.cs (1)
156public DataViewSchema Schema { get; }
Microsoft.ML.Transforms (3)
CustomMappingFilter.cs (1)
23public DataViewSchema Schema => Input.Schema;
StatefulFilterTransform.cs (1)
93DataViewSchema IDataView.Schema => OutputSchema;
SvmLight\SvmLightLoader.cs (1)
399public DataViewSchema Schema { get; }
1511 references to Schema
Microsoft.Data.Analysis (1)
IDataView.Extension.cs (1)
47DataViewSchema schema = dataView.Schema;
Microsoft.Data.Analysis.Tests (15)
DataFrameIDataViewTests.cs (6)
109DataViewSchema schema = dataView.Schema; 113schema = dataView.Schema; 118schema = dataView.Schema; 125schema = dataView.Schema; 264Assert.Equal(dfAsIDataView.Schema.Count, newDf.Columns.Count); 314Assert.Equal(dfAsIDataView.Schema.Count, newDf.Columns.Count);
DataFrameTests.cs (9)
604IEnumerable<DataViewSchema.Column> dfColumns = ((IDataView)df).Schema; 609IEnumerable<DataViewSchema.Column> clampedColumns = ((IDataView)clampedColumn).Schema; 662IEnumerable<DataViewSchema.Column> columnNames = ((IDataView)df).Schema; 665IEnumerable<DataViewSchema.Column> prefixNames = ((IDataView)prefix).Schema; 666foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in columnNames.Zip(((IDataView)df).Schema, (e1, e2) => (e1, e2))) 677prefixNames = ((IDataView)df).Schema; 684IEnumerable<DataViewSchema.Column> suffixNames = ((IDataView)suffix).Schema; 685foreach ((DataViewSchema.Column First, DataViewSchema.Column Second) in ((IDataView)df).Schema.Zip(columnNames, (e1, e2) => (e1, e2))) 696suffixNames = ((IDataView)df).Schema;
Microsoft.ML.AutoML (37)
API\AutoCatalog.cs (7)
823&& data.Schema[c.ColumnIndex].Type != BooleanDataViewType.Instance 824&& !(data.Schema[c.ColumnIndex].Type is VectorDataViewType vt && vt.ItemType == BooleanDataViewType.Instance)).ToArray(); 828var textFeatureColumnNames = textFeatures.Select(c => data.Schema[c.ColumnIndex].Name).ToArray(); 829var numericFeatureColumnNames = numericFeatures.Select(c => data.Schema[c.ColumnIndex].Name).ToArray(); 830var catalogFeatureColumnNames = catalogFeatures.Select(c => data.Schema[c.ColumnIndex].Name).ToArray(); 831var imagePathColumnNames = imagePathFeatures.Select(c => data.Schema[c.ColumnIndex].Name).ToArray(); 832var booleanFeatureColumnNames = booleanFeatures.Select(c => data.Schema[c.ColumnIndex].Name).ToArray();
ColumnInference\ColumnInferenceApi.cs (1)
86purposeResults = purposeInferenceResult.Select(p => (dataView.Schema[p.ColumnIndex].Name, p.Purpose));
ColumnInference\ColumnInferenceValidationUtil.cs (1)
20if (dataView.Schema.GetColumnOrNull(columnName) == null)
ColumnInference\ColumnTypeInference.cs (1)
275using (var cursor = idv.GetRowCursor(idv.Schema))
ColumnInference\PurposeInference.cs (5)
73_type = new Lazy<DataViewType>(() => _data.Schema[_columnId].Type); 74_columnName = new Lazy<string>(() => _data.Schema[_columnId].Name); 89var column = _data.Schema[_columnId]; 248for (var i = 0; i < data.Schema.Count; i++) 250var column = data.Schema[i];
ColumnInference\TextFileContents.cs (1)
96var column = idv.Schema["C"];
DatasetDimensions\DatasetDimensionsApi.cs (3)
17var colDimensions = new ColumnDimensions[data.Schema.Count]; 19for (var i = 0; i < data.Schema.Count; i++) 21var column = data.Schema[i];
DatasetDimensions\DatasetDimensionsUtil.cs (1)
69using (var cursor = data.GetRowCursor(new[] { data.Schema[0] }))
Experiment\Runners\CrossValRunner.cs (1)
45_modelInputSchema = trainDatasets[0].Schema;
Experiment\Runners\CrossValSummaryRunner.cs (1)
50_modelInputSchema = trainDatasets[0].Schema;
Experiment\Runners\TrainValidateRunner.cs (1)
43_modelInputSchema = trainData.Schema;
Utils\DatasetColumnInfo.cs (2)
31var cols = new DatasetColumnInfo[data.Schema.Count]; 34var schemaCol = data.Schema[i];
Utils\SplitUtil.cs (3)
16var originalColumnNames = trainData.Schema.Select(c => c.Name); 52var originalColumnNames = trainData.Schema.Select(c => c.Name); 61var allColumns = data.Schema.Select(c => c.Name);
Utils\UserInputValidationUtil.cs (9)
81foreach (var column in trainData.Schema) 198if (trainData.Schema.Count(c => !c.IsHidden) != validationData.Schema.Count(c => !c.IsHidden)) 200throw new ArgumentException($"{schemaMismatchError} Train data has '{trainData.Schema.Count}' columns," + 201$"and validation data has '{validationData.Schema.Count}' columns.", nameof(validationData)); 207foreach (var trainCol in trainData.Schema) 214var validCol = validationData.Schema.GetColumnOrNull(trainCol.Name); 249var nullableColumn = trainData.Schema.GetColumnOrNull(columnName); 288foreach (var column in trainData.Schema)
Microsoft.ML.AutoML.Samples (5)
AutoFit\BinaryClassificationExperiment.cs (1)
45mlContext.Model.Save(bestRun.Model, trainDataView.Schema, fs);
AutoFit\MulticlassClassificationExperiment.cs (1)
46mlContext.Model.Save(bestRun.Model, trainDataView.Schema, fs);
AutoFit\RankingExperiment.cs (1)
53mlContext.Model.Save(bestRun.Model, trainDataView.Schema, ModelPath);
AutoFit\RecommendationExperiment.cs (1)
57mlContext.Model.Save(bestRun.Model, trainDataView.Schema, ModelPath);
AutoFit\RegressionExperiment.cs (1)
46mlContext.Model.Save(bestRun.Model, trainDataView.Schema, fs);
Microsoft.ML.AutoML.Tests (21)
AutoFitTests.cs (17)
290Assert.Equal(NumberDataViewType.Single, scoredData.Schema[DefaultColumnNames.PredictedLabel].Type); 322Assert.Equal(NumberDataViewType.Single, scoredData.Schema[DefaultColumnNames.PredictedLabel].Type); 337var originalColumnNames = trainData.Schema.Select(c => c.Name); 353Assert.Equal(TextDataViewType.Instance, scoredData.Schema[DefaultColumnNames.PredictedLabel].Type); 364var originalColumnNames = trainData.Schema.Select(c => c.Name); 376Assert.Equal(TextDataViewType.Instance, scoredData.Schema[DefaultColumnNames.PredictedLabel].Type); 404Assert.Equal(TextDataViewType.Instance, scoredData.Schema[DefaultColumnNames.PredictedLabel].Type); 461var outputSchema = bestRun.Model.GetOutputSchema(trainDataView.Schema); 545var outputSchema = bestRun.Model.GetOutputSchema(trainDataView.Schema); 552testDataView.Schema.TryGetColumnIndex(labelColumnName, out int labelColumnId); 554testDataViewWithBestScore.Schema.TryGetColumnIndex(scoreColumnName, out int scoreColumnId); 628Assert.Equal(31, resFull.Schema.Count); 629Assert.Equal(31, resTrainTest.Schema.Count); 630Assert.Equal(31, resCV.Schema.Count); 632foreach (var col in resFull.Schema) 634Assert.Equal(col.Name, resTrainTest.Schema[col.Index].Name); 635Assert.Equal(col.Name, resCV.Schema[col.Index].Name);
TransformInferenceTests.cs (1)
784var featuresCol = data.Schema.GetColumnOrNull(DefaultColumnNames.Features);
UserInputValidationTests.cs (3)
60var originalColumnName = _data.Schema.First().Name; 401var originalColumnName = _data.Schema.First().Name; 416var originalColumnName = _data.Schema.First().Name;
Microsoft.ML.CodeGenerator (1)
Utils.cs (1)
54var featureColumns = dataView.Schema.ToList().FindAll(
Microsoft.ML.Core (6)
Data\RoleMappedSchema.cs (6)
406/// guaranteed to equal the the <see cref="IDataView.Schema"/> of <see cref="Data"/>. 418/// guaranteed to be the same as <see cref="Data"/>'s <see cref="IDataView.Schema"/>. 426Contracts.Assert(schema.Schema == data.Schema); 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.Core.Tests (116)
UnitTests\CoreBaseTestClass.cs (14)
197Contracts.Assert(view1.Schema.Count == view2.Schema.Count); 205Check(curs1.Schema == view1.Schema, "Schema of view 1 and its cursor differed"); 206Check(curs2.Schema == view2.Schema, "Schema of view 2 and its cursor differed"); 212var view2EvenCols = view2.Schema.Where(col => (col.Index & 1) == 0); 216Check(curs1.Schema == view1.Schema, "Schema of view 1 and its cursor differed"); 217Check(curs2.Schema == view2.Schema, "Schema of view 2 and its cursor differed"); 223var view2OddCols = view2.Schema.Where(col => (col.Index & 1) == 0); 227Check(curs1.Schema == view1.Schema, "Schema of view 1 and its cursor differed"); 228Check(curs2.Schema == view2.Schema, "Schema of view 2 and its cursor differed"); 233using (var curs1 = view1.GetRowCursor(view1.Schema)) 235Check(curs1.Schema == view1.Schema, "Schema of view 1 and its cursor differed"); 326Contracts.Assert(curs1.Schema.Count == view2.Schema.Count); 337cursors[col] = view2.GetRowCursor(view2.Schema[col]);
UnitTests\TestCustomTypeRegister.cs (2)
112/// It usually shows up as <see cref="DataViewSchema.Column.Type"/> among <see cref="IDataView.Schema"/>. 193ML.Model.Save(model, tribeDataView.Schema, "customTransform.zip");
UnitTests\TestEntryPoints.cs (91)
146Assert.Equal(4, scored1.Schema.Count); 746Assert.NotNull(loadedData.Schema.GetColumnOrNull("FeatureName")); 747Assert.NotNull(loadedData.Schema.GetColumnOrNull("AreaUnderRocCurve")); 748Assert.NotNull(loadedData.Schema.GetColumnOrNull("Accuracy")); 749Assert.NotNull(loadedData.Schema.GetColumnOrNull("PositivePrecision")); 750Assert.NotNull(loadedData.Schema.GetColumnOrNull("PositiveRecall")); 751Assert.NotNull(loadedData.Schema.GetColumnOrNull("NegativePrecision")); 752Assert.NotNull(loadedData.Schema.GetColumnOrNull("NegativeRecall")); 753Assert.NotNull(loadedData.Schema.GetColumnOrNull("F1Score")); 754Assert.NotNull(loadedData.Schema.GetColumnOrNull("AreaUnderPrecisionRecallCurve")); 755Assert.NotNull(loadedData.Schema.GetColumnOrNull("AreaUnderRocCurveStdErr")); 756Assert.NotNull(loadedData.Schema.GetColumnOrNull("AccuracyStdErr")); 757Assert.NotNull(loadedData.Schema.GetColumnOrNull("PositivePrecisionStdErr")); 758Assert.NotNull(loadedData.Schema.GetColumnOrNull("PositiveRecallStdErr")); 759Assert.NotNull(loadedData.Schema.GetColumnOrNull("NegativePrecisionStdErr")); 760Assert.NotNull(loadedData.Schema.GetColumnOrNull("NegativeRecallStdErr")); 761Assert.NotNull(loadedData.Schema.GetColumnOrNull("F1ScoreStdErr")); 762Assert.NotNull(loadedData.Schema.GetColumnOrNull("AreaUnderPrecisionRecallCurveStdErr")); 894Assert.NotNull(loadedData.Schema.GetColumnOrNull("FeatureName")); 895Assert.NotNull(loadedData.Schema.GetColumnOrNull("MacroAccuracy")); 896Assert.NotNull(loadedData.Schema.GetColumnOrNull("MicroAccuracy")); 897Assert.NotNull(loadedData.Schema.GetColumnOrNull("LogLoss")); 898Assert.NotNull(loadedData.Schema.GetColumnOrNull("LogLossReduction")); 899Assert.NotNull(loadedData.Schema.GetColumnOrNull("TopKAccuracy")); 900Assert.NotNull(loadedData.Schema.GetColumnOrNull("PerClassLogLoss")); 901Assert.NotNull(loadedData.Schema.GetColumnOrNull("MacroAccuracyStdErr")); 902Assert.NotNull(loadedData.Schema.GetColumnOrNull("MicroAccuracyStdErr")); 903Assert.NotNull(loadedData.Schema.GetColumnOrNull("LogLossStdErr")); 904Assert.NotNull(loadedData.Schema.GetColumnOrNull("LogLossReductionStdErr")); 905Assert.NotNull(loadedData.Schema.GetColumnOrNull("TopKAccuracyStdErr")); 906Assert.NotNull(loadedData.Schema.GetColumnOrNull("PerClassLogLossStdErr")); 1055Assert.NotNull(loadedData.Schema.GetColumnOrNull("FeatureName")); 1056Assert.NotNull(loadedData.Schema.GetColumnOrNull("MacroAccuracy")); 1057Assert.NotNull(loadedData.Schema.GetColumnOrNull("MicroAccuracy")); 1058Assert.NotNull(loadedData.Schema.GetColumnOrNull("LogLoss")); 1059Assert.NotNull(loadedData.Schema.GetColumnOrNull("LogLossReduction")); 1060Assert.NotNull(loadedData.Schema.GetColumnOrNull("TopKAccuracy")); 1061Assert.NotNull(loadedData.Schema.GetColumnOrNull("PerClassLogLoss")); 1062Assert.NotNull(loadedData.Schema.GetColumnOrNull("MacroAccuracyStdErr")); 1063Assert.NotNull(loadedData.Schema.GetColumnOrNull("MicroAccuracyStdErr")); 1064Assert.NotNull(loadedData.Schema.GetColumnOrNull("LogLossStdErr")); 1065Assert.NotNull(loadedData.Schema.GetColumnOrNull("LogLossReductionStdErr")); 1066Assert.NotNull(loadedData.Schema.GetColumnOrNull("TopKAccuracyStdErr")); 1067Assert.NotNull(loadedData.Schema.GetColumnOrNull("PerClassLogLossStdErr")); 1198Assert.NotNull(loadedData.Schema.GetColumnOrNull("FeatureName")); 1199Assert.NotNull(loadedData.Schema.GetColumnOrNull("MeanAbsoluteError")); 1200Assert.NotNull(loadedData.Schema.GetColumnOrNull("MeanSquaredError")); 1201Assert.NotNull(loadedData.Schema.GetColumnOrNull("RootMeanSquaredError")); 1202Assert.NotNull(loadedData.Schema.GetColumnOrNull("LossFunction")); 1203Assert.NotNull(loadedData.Schema.GetColumnOrNull("RSquared")); 1204Assert.NotNull(loadedData.Schema.GetColumnOrNull("MeanAbsoluteErrorStdErr")); 1205Assert.NotNull(loadedData.Schema.GetColumnOrNull("MeanSquaredErrorStdErr")); 1206Assert.NotNull(loadedData.Schema.GetColumnOrNull("RootMeanSquaredErrorStdErr")); 1207Assert.NotNull(loadedData.Schema.GetColumnOrNull("LossFunctionStdErr")); 1208Assert.NotNull(loadedData.Schema.GetColumnOrNull("RSquaredStdErr")); 1345Assert.NotNull(loadedData.Schema.GetColumnOrNull("FeatureName")); 1346Assert.NotNull(loadedData.Schema.GetColumnOrNull("DiscountedCumulativeGains")); 1347Assert.NotNull(loadedData.Schema.GetColumnOrNull("NormalizedDiscountedCumulativeGains")); 1348Assert.NotNull(loadedData.Schema.GetColumnOrNull("DiscountedCumulativeGainsStdErr")); 1349Assert.NotNull(loadedData.Schema.GetColumnOrNull("NormalizedDiscountedCumulativeGainsStdErr")); 1379mlContext.Model.Save(model, data.Schema, modelPath); 1442Assert.NotNull(loadedData.Schema.GetColumnOrNull("PredictedLabel")); 1443Assert.NotNull(loadedData.Schema.GetColumnOrNull("Score")); 1520Assert.Equal(4, scored1.Schema.Count); 1631var scoreCol = binaryScored.Schema.GetColumnOrNull(AnnotationUtils.Const.ScoreValueKind.Score); 1633var type = binaryScored.Schema[scoreCol.Value.Index].Annotations.Schema.GetColumnOrNull(AnnotationUtils.Kinds.ScoreColumnKind)?.Type; 1636binaryScored.Schema[scoreCol.Value.Index].Annotations.GetValue(AnnotationUtils.Kinds.ScoreColumnKind, ref kind); 1640scoreCol = regressionScored.Schema.GetColumnOrNull(AnnotationUtils.Const.ScoreValueKind.Score); 1642type = regressionScored.Schema[scoreCol.Value.Index].Annotations.Schema[AnnotationUtils.Kinds.ScoreColumnKind].Type; 1644regressionScored.Schema[scoreCol.Value.Index].Annotations.GetValue(AnnotationUtils.Kinds.ScoreColumnKind, ref kind); 1648scoreCol = anomalyScored.Schema.GetColumnOrNull(AnnotationUtils.Const.ScoreValueKind.Score); 1650type = anomalyScored.Schema[scoreCol.Value.Index].Annotations.Schema[AnnotationUtils.Kinds.ScoreColumnKind].Type; 1652anomalyScored.Schema[scoreCol.Value.Index].Annotations.GetValue(AnnotationUtils.Kinds.ScoreColumnKind, ref kind); 4480var treesCol = view.Schema.GetColumnOrNull("Trees"); 4483var leavesCol = view.Schema.GetColumnOrNull("Leaves"); 4486var pathsCol = view.Schema.GetColumnOrNull("Paths"); 4726ML.Model.Save(transformer, data.Schema, countsModel); 4768ML.Model.Save(transformer, data.Schema, countsModel); 4845var schema = data.Schema; 4998var schema = data.Schema; 5172var schema = data.Schema; 5356var schema = data.Schema; 5401schema = confusion.Schema; 5584var schema = warnings.Schema; 5764var schema = data.Schema; 6064var schema = data.Schema; 6120var nameCol = data.Schema.GetColumnOrNull("Instance"); 6283var schema = data.Schema; 6455var schema = data.Schema; 6573var schema = data.Schema; 6881var ndcgGetter = cursor.GetGetter<VBuffer<Double>>(data.Schema["NDCG"]);
UnitTests\TestModelLoad.cs (9)
32Assert.Equal(2, result.Schema.Count); 33Assert.Equal("Image", result.Schema[0].Name); 34Assert.Equal("Class", result.Schema[1].Name); 50Assert.Equal(3, result.Schema.Count); 51Assert.Equal("Label", result.Schema[0].Name); 52Assert.Equal("Features", result.Schema[1].Name); 53Assert.Equal("Features", result.Schema[2].Name); 54Assert.Equal(9, (result.Schema[1].Type as VectorDataViewType)?.Size); 55Assert.Equal(18, (result.Schema[2].Type as VectorDataViewType)?.Size);
Microsoft.ML.Data (396)
Commands\CrossValidationCommand.cs (4)
160string name = TrainUtils.MatchNameOrDefaultOrNull(ch, loader.Schema, nameof(ImplOptions.NameColumn), ImplOptions.NameColumn, DefaultColumnNames.Name); 270var schema = data.Schema; 288var schema = input.Schema; 551EvaluateUtils.GetEvaluator(host, scorePipe.Schema);
Commands\DataCommand.cs (1)
308trainSchema = new RoleMappedSchema(trainPipe.Schema, trainRoleMappings);
Commands\EvaluateCommand.cs (4)
153var schema = input.Schema; 164EvaluateUtils.GetEvaluator(env, input.Schema); 229var schema = view.Schema; 242EvaluateUtils.GetEvaluator(Host, view.Schema);
Commands\SaveDataCommand.cs (8)
146for (int i = 0; i < data.Schema.Count; i++) 148if (!ImplOptions.KeepHidden && data.Schema[i].IsHidden) 150var type = data.Schema[i].Type; 154ch.Info(MessageSensitivity.Schema, "The column '{0}' will not be written as it has unsavable column type.", data.Schema[i].Name); 208for (int i = 0; i < view.Schema.Count; i++) 210if (!keepHidden && view.Schema[i].IsHidden) 212var type = view.Schema[i].Type; 216ch.Info(MessageSensitivity.Schema, "The column '{0}' will not be written as it has unsavable column type.", view.Schema[i].Name);
Commands\SavePredictorCommand.cs (1)
223schema = new RoleMappedSchema(emptyView.Schema, roles, opt: true);
Commands\ScoreCommand.cs (11)
116string feat = TrainUtils.MatchNameOrDefaultOrNull(ch, loader.Schema, 118string group = TrainUtils.MatchNameOrDefaultOrNull(ch, loader.Schema, 121var schema = new RoleMappedSchema(loader.Schema, label: null, feature: feat, group: group, custom: customCols, opt: true); 174if (!loader.Schema.TryGetColumnIndex(outCol, out int dummyColIndex)) 181maxScoreId = loader.Schema.GetMaxAnnotationKind(out int colMax, AnnotationUtils.Kinds.ScoreColumnSetId); 184for (int i = 0; i < loader.Schema.Count; i++) 186if (!ImplOptions.KeepHidden && loader.Schema[i].IsHidden) 188if (!(outputAllColumns || ShouldAddColumn(loader.Schema, i, maxScoreId, outputNamesAndLabels))) 190var type = loader.Schema[i].Type; 196loader.Schema[i].Name); 267var schema = new RoleMappedSchema(input.Schema, label: null, feature: featureColName, group: groupColName, custom: customColumns, opt: true);
Commands\ShowSchemaCommand.cs (2)
95PrintSchema(writer, args, view.Schema, view as ITransposeDataView); 99PrintSchema(writer, args, data.Schema, data as ITransposeDataView);
Commands\TestCommand.cs (2)
100var schema = loader.Schema; 120EvaluateUtils.GetEvaluator(Host, scorePipe.Schema);
Commands\TrainCommand.cs (3)
151var schema = view.Schema; 404saveAction = ctx => BinaryLoader.SaveInstance(env, ctx, pipeStart.Schema); 462var schema = view.Schema;
Commands\TrainTestCommand.cs (2)
134var schema = trainPipe.Schema; 209EvaluateUtils.GetEvaluator(Host, scorePipe.Schema);
Data\ITransposeDataView.cs (1)
36/// <see cref="IDataView"/>. For example, if <see cref="IDataView.Schema"/>[i] is a scalar float column, then
DataDebuggerPreview.cs (4)
35Schema = data.Schema; 37int n = data.Schema.Count; 48setters[i] = Utils.MarshalInvoke(_makeSetterMethodInfo, this, data.Schema[i].Type.RawType, cursor, i); 62ColumnView = Enumerable.Range(0, n).Select(c => new ColumnInfo(data.Schema[c], columns[c].ToArray())).ToImmutableArray();
DataLoadSave\Binary\BinarySaver.cs (4)
587using (DataViewRowCursor cursor = data.GetRowCursor(data.Schema.Where(c => activeSet.Contains(c.Index)))) 657var activeColumns = GetActiveColumns(data.Schema, colIndices); 679() => WriteWorker(stream, toWrite, activeColumns, data.Schema, rowsPerBlock, _host, exMarshaller)); 745using (DataViewRowCursor cursor = data.GetRowCursor(data.Schema.Where(x => active.Contains(x.Index)), rand))
DataLoadSave\DataOperationsCatalog.cs (6)
200if (!input.Schema.TryGetColumnIndex(columnsToPrefetch[i], out prefetch[i])) 230var type = input.Schema[columnName].Type; 264var type = input.Schema[columnName].Type; 528var splitColumnName = data.Schema.GetTempColumnName("SplitColumn"); 555if (!data.Schema.TryGetColumnIndex(samplingKeyColumn, out int samplingColIndex)) 558var type = data.Schema[samplingColIndex].Type;
DataLoadSave\EstimatorChain.cs (1)
61GetOutputSchema(SchemaShape.Create(input.Schema));
DataLoadSave\LegacyCompositeDataLoader.cs (1)
583public DataViewSchema Schema => View.Schema;
DataLoadSave\Text\TextSaver.cs (6)
401ch.Check(0 <= cols[i] && cols[i] < data.Schema.Count); 402DataViewType itemType = data.Schema[cols[i]].Type.GetItemType(); 404activeCols.Add(data.Schema[cols[i]]); 414var type = data.Schema[cols[i]].Type; 422var typeNames = data.Schema[cols[i]].Annotations.Schema.GetColumnOrNull(AnnotationUtils.Kinds.SlotNames)?.Type as VectorDataViewType; 435string header = CreateLoaderArguments(data.Schema, pipes, hasHeader, ch);
DataLoadSave\TransformerChain.cs (7)
154chain.GetOutputSchema(input.Schema); 301pred = new BinaryPredictionTransformer<IPredictorProducing<float>>(env, predictor as IPredictorProducing<float>, chain.Schema, 305predictor as IPredictorProducing<VBuffer<float>>, chain.Schema, 309pred = new ClusteringPredictionTransformer<IPredictorProducing<VBuffer<float>>>(env, predictor as IPredictorProducing<VBuffer<float>>, chain.Schema, 312pred = new RegressionPredictionTransformer<IPredictorProducing<float>>(env, predictor as IPredictorProducing<float>, chain.Schema, 315pred = new AnomalyPredictionTransformer<IPredictorProducing<float>>(env, predictor as IPredictorProducing<float>, chain.Schema, 318pred = new RankingPredictionTransformer<IPredictorProducing<float>>(env, predictor as IPredictorProducing<float>, chain.Schema,
DataLoadSave\TransformWrapper.cs (1)
40return output.Schema;
DataLoadSave\Transpose\TransposeLoader.cs (6)
253var schema = view.Schema; 295var schema = view.Schema; 380public DataViewSchema Schema => _schemaEntry.GetView().Schema; 473ColumnCount = schemaView.Schema.Count 614return view.Schema[0].Type as VectorDataViewType; 733_host.Assert(view.Schema.Count == 1);
DataLoadSave\Transpose\TransposeSaver.cs (2)
136_internalSaver.SaveData(substream, view, Utils.GetIdentityPermutation(view.Schema.Count)); 153viewAction(data.Schema[col].Name, new TransposerUtils.SlotDataView(_host, data, col));
DataLoadSave\TrivialEstimator.cs (1)
38Transformer.GetOutputSchema(input.Schema);
DataView\AppendRowsDataView.cs (4)
78Schema = schema ?? _sources[0].Schema; 109int startingSchemaIndex = Schema == _sources[0].Schema ? 1 : 0; 113_host.Check(_sources.All(source => source.Schema.Count == colCount), errMsg); 122var schema = _sources[i].Schema;
DataView\BatchDataViewMapperBase.cs (2)
44var inputCursor = _source.GetRowCursor(_source.Schema.Where(c => activeInput[c.Index]), null); 54var inputCols = _source.Schema.Where(c => predInput(c.Index));
DataView\CacheDataView.cs (6)
100_caches = new ColumnCache[_subsetInput.Schema.Count]; 115var schema = data.Schema; 184int inputIndexLim = _inputToSubsetColIndex == null ? _subsetInput.Schema.Count : _inputToSubsetColIndex.Length; 187_host.Assert(-1 <= result && result < _subsetInput.Schema.Count); 193public DataViewSchema Schema => _subsetInput.Schema; 350cursor = _subsetInput.GetRowCursor(_subsetInput.Schema.Where(c => taskColumns.Contains(c.Index)));
DataView\DataViewExtensions.cs (3)
26Contracts.Assert(dv.Schema[col.Index].Equals(col), $"The requested column named: {col.Name}, with index: {col.Index} and type: {col.Type}" + 41Contracts.Assert(dv.Schema[columnNeeded.Index].Equals(columnNeeded), $"The requested column named: {columnNeeded.Name}, with index: {columnNeeded.Index} and type: {columnNeeded.Type}" + 55public static DataViewRowCursor GetRowCursorForAllColumns(this IDataView dv) => dv.GetRowCursor(dv.Schema);
DataView\LambdaColumnMapper.cs (2)
46bool tmp = input.Schema.TryGetColumnIndex(src, out int colSrc); 49var typeOrig = input.Schema[colSrc].Type;
DataView\LambdaFilter.cs (7)
37bool tmp = input.Schema.TryGetColumnIndex(src, out colSrc); 40var typeOrig = input.Schema[colSrc].Type; 91Host.Assert(0 <= colSrc && colSrc < Source.Schema.Count); 119var inputCols = Source.Schema.Where(x => inputPred(x.Index)); 132var inputCols = Source.Schema.Where(x => inputPred(x.Index)); 146active = new bool[Source.Schema.Count]; 147bool[] activeInput = new bool[Source.Schema.Count];
DataView\OpaqueDataView.cs (1)
19public DataViewSchema Schema => _source.Schema;
DataView\RowToRowMapperTransform.cs (6)
102_bindings = new ColumnBindings(input.Schema, mapper.GetOutputColumns()); 117ctx.LoadModel<IRowMapper, SignatureLoadRowMapper>(host, out _mapper, "Mapper", input.Schema); 118_bindings = new ColumnBindings(input.Schema, _mapper.GetOutputColumns()); 247public DataViewSchema InputSchema => Source.Schema; 253Host.Check(input.Schema == Source.Schema, "Schema of input row must be the same as the schema the mapper is bound to"); 276var newMapper = _mapperFactory(newSource.Schema);
DataView\Transposer.cs (31)
106var schema = _view.Schema; 209var schema = view.Schema; 224var schema = view.Schema; 235_host.CheckParam(0 <= col && col < _view.Schema.Count, nameof(col)); 242throw _host.ExceptParam(nameof(col), "Bad call to GetSlotCursor on untransposable column '{0}'", _tview.Schema[col].Name); 255if (_view.Schema[col].Type is VectorDataViewType) 267var transposedColumn = _view.Schema[col]; 283public DataViewSchema Schema => _view.Schema; 361Ch.Assert(_view.Schema[_col].Type is PrimitiveDataViewType); 362Ch.Assert(_view.Schema[_col].Type.RawType == typeof(T)); 374var isDefault = Conversion.Conversions.DefaultInstance.GetIsDefaultPredicate<T>(_view.Schema[_col].Type); 383var currentColumn = _view.Schema[_col]; 517var type = _view.Schema[_colCurr].Type; 535var currentColumn = _view.Schema[_colCurr]; 690_slotLim = _view.Schema[_colCurr].Type.GetValueCount(); 766nameToCol[_input.Schema[toSlice[c]].Name] = outputColumnCount - 1; 838var inputCols = _input.Schema.Where(x => srcPred(x.Index)); 914Contracts.Assert(0 <= col && col < view.Schema.Count); 924var type = view.Schema[col].Type; 1011Contracts.Assert(_view.Schema[col].Type.RawType == typeof(T)); 1014var selectedColumn = _view.Schema[col]; 1025Contracts.Assert(row.Schema == _view.Schema); 1094var type = _view.Schema[SrcCol].Type as VectorDataViewType; 1109var selectedColumn = _view.Schema[col]; 1119Contracts.Assert(row.Schema == _view.Schema); 1343Contracts.CheckParam(0 <= col && col < view.Schema.Count, nameof(col)); 1348throw Contracts.Except("Could not get single value on column '{0}' because there are no slots", view.Schema[col].Name); 1351throw Contracts.Except("Could not get single value on column '{0}' because there is more than one slot", view.Schema[col].Name); 1429_host.CheckParam(0 <= col && col < data.Schema.Count, nameof(col)); 1437builder.AddColumn(_data.Schema[_col].Name, _type); 1443var type = _data.Schema[_col].Type;
DataView\TypedCursor.cs (8)
104if (!_data.Schema.TryGetColumnIndex(col.ColumnName, out colIndex)) 108throw _host.ExceptSchemaMismatch(nameof(_data.Schema), "", col.ColumnName); 110var realColType = _data.Schema[colIndex].Type; 128var schema = _data.Schema; 186var inputCols = _data.Schema.Where(x => deps(x.Index)); 208var inputs = _data.GetRowCursorSet(_data.Schema.Where(col => _columnIndices.Contains(col.Index) || additionalColumnsPredicate(col.Index)), n, rand); 251data.Schema.TryGetColumnIndex(singleName, out colIndex); 252DataViewType expectedType = data.Schema[colIndex].Type;
DataView\ZipDataView.cs (2)
52_zipBinding = new ZipBinding(_sources.Select(x => x.Schema).ToArray()); 88.Select((dv, i) => srcPredicates[i] == null ? GetMinimumCursor(dv) : dv.GetRowCursor(dv.Schema.Where(x => srcPredicates[i](x.Index)), null)).ToArray();
Dirty\ChooseColumnsByIndexTransform.cs (4)
202_bindings = new Bindings(options, Source.Schema); 212_bindings = new Bindings(ctx, Source.Schema); 253var inputCols = Source.Schema.Where(x => inputPred(x.Index)); 267var inputCols = Source.Schema.Where(x => inputPred(x.Index));
EntryPoints\InputBase.cs (1)
72var schema = input.TrainingData.Schema;
EntryPoints\TransformModelImpl.cs (5)
55internal override DataViewSchema OutputSchema => _chain.Schema; 66var root = new EmptyDataView(env, input.Schema); 91_schemaRoot = view.Schema; 125_schemaRoot = view.Schema; 199public DataViewSchema Schema => _chain.Schema;
Evaluators\AnomalyDetectionEvaluator.cs (11)
672DataViewSchema.Column? column = top.Schema.GetColumnOrNull(AnomalyDetectionEvaluator.TopKResultsColumns.Instance); 674throw Host.ExceptSchemaMismatch(nameof(top.Schema), "instance", AnomalyDetectionEvaluator.TopKResultsColumns.Instance); 677column = top.Schema.GetColumnOrNull(AnomalyDetectionEvaluator.TopKResultsColumns.AnomalyScore); 679throw Host.ExceptSchemaMismatch(nameof(top.Schema), "anomaly score", AnomalyDetectionEvaluator.TopKResultsColumns.AnomalyScore); 682column = top.Schema.GetColumnOrNull(AnomalyDetectionEvaluator.TopKResultsColumns.Label); 684throw Host.ExceptSchemaMismatch(nameof(top.Schema), "label", AnomalyDetectionEvaluator.TopKResultsColumns.Label); 716DataViewSchema.Column? numAnom = overall.Schema.GetColumnOrNull(AnomalyDetectionEvaluator.OverallMetrics.NumAnomalies); 718throw Host.ExceptSchemaMismatch(nameof(overall.Schema), "number of anomalies", AnomalyDetectionEvaluator.OverallMetrics.NumAnomalies); 721var hasStrat = overall.Schema.TryGetColumnIndex(MetricKinds.ColumnNames.StratCol, out stratCol); 723bool hasStratVals = overall.Schema.TryGetColumnIndex(MetricKinds.ColumnNames.StratVal, out stratVal); 726using (var cursor = overall.GetRowCursor(overall.Schema.Where(col => col.Name.Equals(AnomalyDetectionEvaluator.OverallMetrics.NumAnomalies) ||
Evaluators\BinaryClassifierEvaluator.cs (9)
915var thresholdColumn = prCurveView.Schema.GetColumnOrNull(BinaryClassifierEvaluator.Threshold); 916var precisionColumn = prCurveView.Schema.GetColumnOrNull(BinaryClassifierEvaluator.Precision); 917var recallColumn = prCurveView.Schema.GetColumnOrNull(BinaryClassifierEvaluator.Recall); 918var fprColumn = prCurveView.Schema.GetColumnOrNull(BinaryClassifierEvaluator.FalsePositiveRate); 1382if (fold.Schema.TryGetColumnIndex(MetricKinds.ColumnNames.IsWeighted, out index)) 1384if (fold.Schema.TryGetColumnIndex(MetricKinds.ColumnNames.StratCol, out index)) 1386if (fold.Schema.TryGetColumnIndex(MetricKinds.ColumnNames.StratVal, out index)) 1467pr = AppendRowsDataView.Create(Host, prList[0].Schema, prList.ToArray()); 1534var schema = input.Data.Schema;
Evaluators\ClusteringEvaluator.cs (5)
838if (perInst.Schema.TryGetColumnIndex(ClusteringPerInstanceEvaluator.SortedClusters, out int index)) 840var type = perInst.Schema[index].Type; 845if (perInst.Schema.TryGetColumnIndex(ClusteringPerInstanceEvaluator.SortedClusterScores, out index)) 847var type = perInst.Schema[index].Type; 866var schema = input.Data.Schema;
Evaluators\EvaluatorBase.cs (1)
144var activeCols = data.Schema.Where(x => activeColsIndices(x.Index));
Evaluators\EvaluatorUtils.cs (61)
257var schema = metricsView.Schema; 399while (inputCol < input.Schema.Count && input.Schema[inputCol].IsHidden) 401env.Assert(inputCol < input.Schema.Count); 403var inputColName = input.Schema[0].Name; 404var inputColType = input.Schema[0].Type; 441while (inputCol < input.Schema.Count && input.Schema[inputCol].IsHidden) 443env.Assert(inputCol < input.Schema.Count); 445var inputColName = input.Schema[inputCol].Name; 446var inputColType = input.Schema[inputCol].Type; 475if (!idv.Schema.TryGetColumnIndex(columnName, out col)) 478var type = typeSrc[i] = idv.Schema[col].Type; 479if (!idv.Schema[col].HasSlotNames(type.GetVectorSize())) 481idv.Schema[col].Annotations.GetValue(AnnotationUtils.Kinds.SlotNames, ref slotNamesCur); 613var keyValueMappers = Utils.MarshalInvoke(MapKeys<int>, keyValueType.RawType, views.Select(view => view.Schema).ToArray(), columnName, false, indices, keyNames); 633views[i].Schema[indices[i]].Type, keyType, mapper, keyValueGetter); 653if (!views[i].Schema.TryGetColumnIndex(columnName, out var index)) 664views[i].Schema[index].Type, keyType, mapper); 681var keyValueMappers = Utils.MarshalInvoke(MapKeys<int>, keyValueType.RawType, views.Select(view => view.Schema).ToArray(), columnName, true, columnIndices, keyNames); 725var type = views[i].Schema[columnIndices[i]].Type; 726if (views[i].Schema[columnIndices[i]].HasSlotNames(type.GetVectorSize())) 728var schema = views[i].Schema; 802return AppendRowsDataView.Create(env, overallList[0].Schema, overallList.ToArray()); 825for (int i = 0; i < dv.Schema.Count; i++) 827if (dv.Schema[i].IsHidden) 833var type = dv.Schema[i].Type; 834var name = dv.Schema[i].Name; 840if (dv.Schema[i].HasKeyValues()) 843if (dv.Schema[i].HasSlotNames(vectorType.Size)) 846dv.Schema[i].Annotations.GetValue(AnnotationUtils.Kinds.SlotNames, ref slotNames); 867labelColKeyValuesType = dv.Schema[i].Annotations.Schema.GetColumnOrNull(AnnotationUtils.Kinds.KeyValues)?.Type; 869else if (dvNumber == 0 && dv.Schema[i].HasKeyValues()) 871else if (type.GetKeyCount() > 0 && name != labelColName && !dv.Schema[i].HasKeyValues()) 912var hidden = FindHiddenColumns(idv.Schema, keyCol); 917var hidden = FindHiddenColumns(idv.Schema, keyCol.Key); 929idv.Schema.TryGetColumnIndex(variableSizeVectorColumnName, out index); 930var vectorType = idv.Schema[index].Type as VectorDataViewType; 961if (dv.Schema[col].HasSlotNames(type.Size)) 965dv.Schema[col].Annotations.GetValue(AnnotationUtils.Kinds.SlotNames, ref currSlotNames); 1057var avgMetrics = GetAverageToDataView(env, data.Schema, agg, weightedAgg, numFolds, stratCol, stratVal, 1072var overall = AppendRowsDataView.Create(env, avgMetrics.Schema, idvList.ToArray()); 1084var isWeightedColumn = data.Schema.GetColumnOrNull(MetricKinds.ColumnNames.IsWeighted); 1086var hasStrats = data.Schema.TryGetColumnIndex(MetricKinds.ColumnNames.StratCol, out int scol); 1087var hasStratVals = data.Schema.TryGetColumnIndex(MetricKinds.ColumnNames.StratVal, out int svalcol); 1089var hasFoldCol = data.Schema.TryGetColumnIndex(MetricKinds.ColumnNames.FoldIndex, out int fcol); 1097int colCount = data.Schema.Count; 1126metricNames = GetMetricNames(ch, data.Schema, cursor, 1291idv = AppendRowsDataView.Create(env, idv.Schema, idv, weightedDvBldr.GetDataView()); 1362var weightColumn = confusionDataView.Schema.GetColumnOrNull(MetricKinds.ColumnNames.Weight); 1386var weightColumn = confusionDataView.Schema.GetColumnOrNull(MetricKinds.ColumnNames.Weight); 1391var countColumn = confusionDataView.Schema[MetricKinds.ColumnNames.Count]; 1475var hasStrat = confusionDataView.Schema.TryGetColumnIndex(MetricKinds.ColumnNames.StratCol, out stratCol); 1476using (var cursor = confusionDataView.GetRowCursor(confusionDataView.Schema.Where(col => col.Index == countIndex || hasStrat && col.Index == stratCol))) 1736var warningTextColumn = warnings.Schema.GetColumnOrNull(MetricKinds.ColumnNames.WarningText); 1739using (var cursor = warnings.GetRowCursor(warnings.Schema[MetricKinds.ColumnNames.WarningText])) 1773if (!data.Schema.TryGetColumnIndex(MetricKinds.ColumnNames.StratCol, out stratCol)) 1775var type = data.Schema[stratCol].Type; 1783var found = data.Schema.TryGetColumnIndex(MetricKinds.ColumnNames.StratVal, out stratVal); 1786data = ColumnSelectingTransformer.CreateDrop(env, data, data.Schema[stratCol].Name, data.Schema[stratVal].Name);
Evaluators\MulticlassClassificationEvaluator.cs (9)
983for (int col = 0; col < idv.Schema.Count; col++) 985if (idv.Schema[col].IsHidden && 986idv.Schema[col].Name.Equals(MulticlassClassificationEvaluator.PerClassLogLoss)) 1013if (input.Schema.TryGetColumnIndex(columnToDrop, out int ColInd)) 1057if (!perInst.Schema.TryGetColumnIndex(labelName, out int labelColIndex)) 1059var labelCol = perInst.Schema[labelColIndex]; 1068var perInstSchema = perInst.Schema; 1078if (perInst.Schema.TryGetColumnIndex(MulticlassPerInstanceEvaluator.SortedScores, out int sortedScoresIndex)) 1080var type = perInst.Schema[sortedScoresIndex].Type;
Evaluators\MultiOutputRegressionEvaluator.cs (8)
668var isWeightedCol = fold.Schema.GetColumnOrNull(MetricKinds.ColumnNames.IsWeighted); 671bool hasStrats = fold.Schema.TryGetColumnIndex(MetricKinds.ColumnNames.StratCol, out stratCol); 673bool hasStratVals = fold.Schema.TryGetColumnIndex(MetricKinds.ColumnNames.StratVal, out stratVal); 676var colCount = fold.Schema.Count; 698for (int i = 0; i < fold.Schema.Count; i++) 700var currentColumn = fold.Schema[i]; 707var type = fold.Schema[i].Type as VectorDataViewType; 756sb.AppendFormat("{0}{1,12}:", isWeighted ? "Weighted " : "", fold.Schema[i].Name);
Evaluators\QuantileRegressionEvaluator.cs (3)
514for (int i = 0; i < data.Schema.Count; i++) 516var type = data.Schema[i].Type; 519var name = data.Schema[i].Name;
Evaluators\RankingEvaluator.cs (4)
712_bindings = new Bindings(Host, Source.Schema, true, LabelCol, ScoreCol, GroupCol, _truncationLevel); 727_bindings = new Bindings(Host, input.Schema, false, LabelCol, ScoreCol, GroupCol, _truncationLevel); 936gs = AppendRowsDataView.Create(Host, gsList[0].Schema, gsList.ToArray()); 1092var schema = input.Data.Schema;
Model\ModelOperationsCatalog.cs (1)
183inputSchema = loader.Schema;
Model\Pfa\SavePfaCommand.cs (5)
180var ctx = new BoundPfaContext(Host, source.Schema, _inputsToDrop, allowSet: _allowSet); 188for (int i = 0; i < end.Schema.Count; ++i) 190if (end.Schema[i].IsHidden) 192var name = end.Schema[i].Name; 198JObject pfaDoc = ctx.Finalize(end.Schema, toExport.ToArray());
Prediction\Calibrator.cs (4)
953var labelCol = scored.Schema[labelColumn]; 954var scoreCol = scored.Schema[scoreColumn]; 956var weightCol = weightColumn == null ? null : scored.Schema.GetColumnOrNull(weightColumn); 1023var scoreColumn = scored.Schema[DefaultColumnNames.Score];
Scorers\GenericScorer.cs (3)
163_bindings = Bindings.Create(data.Schema, rowMapper, args.Suffix); 173_bindings = transform._bindings.ApplyToSchema(env, data.Schema); 184_bindings = Bindings.Create(ctx, host, Bindable, input.Schema);
Scorers\PredictedLabelScorerBase.cs (3)
298Bindings = BindingsImpl.Create(data.Schema, rowMapper, args.Suffix, scoreColKind, scoreColIndex, predColType, predictedLabelColumnName); 306Bindings = transform.Bindings.ApplyToSchema(newSource.Schema, Bindable, env); 320Bindings = BindingsImpl.Create(ctx, input.Schema, host, Bindable, outputTypeMatches, getPredColType);
Scorers\PredictionTransformer.cs (1)
288return Transform(new EmptyDataView(Host, inputSchema)).Schema;
Training\TrainerEstimatorBase.cs (3)
147CheckInputSchema(SchemaShape.Create(trainSet.Schema)); 153CheckInputSchema(SchemaShape.Create(validationSet.Schema)); 158return MakeTransformer(pred, trainSet.Schema);
Transforms\ColumnSelecting.cs (5)
440return new SelectColumnsDataTransform(env, transform, new Mapper(transform, input.Schema), input); 512if (!IgnoreMissing && !IsSchemaValid(input.Schema.Select(x => x.Name), 518return new SelectColumnsDataTransform(_host, this, new Mapper(this, input.Schema), input); 671public DataViewSchema InputSchema => Source.Schema; 729=> new SelectColumnsDataTransform(env, _transform, new Mapper(_transform, newSource.Schema), newSource);
Transforms\ConversionsExtensionsCatalog.cs (10)
347lookupMap.Schema[ValueMappingTransformer.DefaultKeyColumnName], 348lookupMap.Schema[ValueMappingTransformer.DefaultValueColumnName], 379lookupMap.Schema[ValueMappingTransformer.DefaultKeyColumnName], 380lookupMap.Schema[ValueMappingTransformer.DefaultValueColumnName], 413lookupMap.Schema[ValueMappingTransformer.DefaultKeyColumnName], 414lookupMap.Schema[ValueMappingTransformer.DefaultValueColumnName], 452lookupMap.Schema[ValueMappingTransformer.DefaultKeyColumnName], 453lookupMap.Schema[ValueMappingTransformer.DefaultValueColumnName], 483lookupMap.Schema[ValueMappingTransformer.DefaultKeyColumnName], 484lookupMap.Schema[ValueMappingTransformer.DefaultValueColumnName],
Transforms\GenerateNumberTransform.cs (4)
284_bindings = Bindings.Create(options, Source.Schema); 297_bindings = Bindings.Create(ctx, Source.Schema); 345var inputCols = Source.Schema.Where(x => inputPred(x.Index)); 356var inputCols = Source.Schema.Where(x => inputPred(x.Index));
Transforms\Hashing.cs (3)
202DataViewSchema.Column? srcCol = input.Schema.GetColumnOrNull(ColumnPairs[i].inputColumnName); 205CheckInputColumn(input.Schema, i, srcCol.Value.Index); 207types[i] = GetOutputType(input.Schema, _columns[i]);
Transforms\LabelConvertTransform.cs (1)
148using (var bldr = md.BuildMetadata(iinfo, Source.Schema, Infos[iinfo].Source, PassThrough))
Transforms\NAFilter.cs (7)
104var schema = Source.Schema; 140var schema = Source.Schema; 183ctx.SaveNonEmptyString(Source.Schema[info.Index].Name); 214var inputCols = Source.Schema.Where(x => inputPred(x.Index)); 226var inputCols = Source.Schema.Where(x => inputPred(x.Index)); 240active = new bool[Source.Schema.Count]; 241bool[] activeInput = new bool[Source.Schema.Count];
Transforms\NopTransform.cs (3)
30DataViewSchema IRowToRowMapper.InputSchema => Source.Schema; 113public DataViewSchema OutputSchema => Source.Schema; 136Contracts.CheckParam(input.Schema == Source.Schema, nameof(input), "Schema of input row must be the same as the schema the mapper is bound to");
Transforms\Normalizer.cs (5)
544bool success = data.Schema.TryGetColumnIndex(info.InputColumnName, out srcCols[i]); 547srcTypes[i] = data.Schema[srcCols[i]].Type; 548activeCols.Add(data.Schema[srcCols[i]]); 552activeCols.Add(data.Schema[supervisedBinColumn.LabelColumnName]); 647var typeSrc = input.Schema[ColumnPairs[iinfo].inputColumnName].Type;
Transforms\NormalizeUtils.cs (1)
145var schema = input.Data.Schema;
Transforms\PerGroupTransformBase.cs (2)
176var activeCols = Source.Schema.Where(x => activeInput.Length > x.Index && activeInput[x.Index]); 191var cols = Source.Schema.Where(x => predInput(x.Index));
Transforms\RangeFilter.cs (7)
100var schema = Source.Schema; 150var schema = Source.Schema; 192ctx.SaveNonEmptyString(Source.Schema[_index].Name); 214var inputCols = Source.Schema.Where(x => inputPred(x.Index)); 228var inputCols = Source.Schema.Where(x => inputPred(x.Index)); 252active = new bool[Source.Schema.Count]; 253bool[] activeInput = new bool[Source.Schema.Count];
Transforms\RowShufflingTransformer.cs (2)
192var schema = data.Schema; 243public override DataViewSchema OutputSchema { get { return _subsetInput.Schema; } }
Transforms\RowToRowTransformerBase.cs (1)
53return new RowToRowMapperTransform(Host, input, MakeRowMapper(input.Schema), MakeRowMapper);
Transforms\TrainAndScoreTransformer.cs (3)
93string feat = TrainUtils.MatchNameOrDefaultOrNull(env, input.Schema, 95string group = TrainUtils.MatchNameOrDefaultOrNull(env, input.Schema, 260var schema = input.Schema;
Transforms\TransformBase.cs (12)
57/// Explicit interface implementation hides <see cref="IDataView.Schema"/> in all derived classes. The reason 59/// Thus, this field will be eventually removed while legacy code can still access <see cref="IDataView.Schema"/> for now. 143public override DataViewSchema OutputSchema => Source.Schema; 174public DataViewSchema InputSchema => Source.Schema; 180Host.Check(input.Schema == Source.Schema, "Schema of input row must be the same as the schema the mapper is bound to"); 506_bindings = Bindings.Create(this, column, Source.Schema, InputTranspose, testType); 520_bindings = Bindings.Create(this, column, Source.Schema, InputTranspose, testType); 534_bindings = Bindings.Create(this, ctx, Source.Schema, InputTranspose, testType); 554Source = transform.Source.Schema[x.Source].Name, 558_bindings = Bindings.Create(this, map, newInput.Schema, InputTranspose, checkType); 584var srcName = Source.Schema[info.Source].Name; 611string inputColumnName = Source.Schema[info.Source].Name;
Transforms\TypeConverting.cs (1)
330var srcType = input.Schema[item.Source ?? item.Name].Type;
Transforms\ValueMapping.cs (13)
446column = dataView.Schema.GetColumnOrNull(keyColumn.Name); 454column = dataView.Schema.GetColumnOrNull(valueColumn.Name); 463using (var cursor = dataView.GetRowCursor(dataView.Schema[keyColumn.Index], dataView.Schema[valueColumn.Index])) 560var keyColumn = idv.Schema[keyColumnName]; 561var valueColumn = idv.Schema[valueColumnName]; 599return new ValueMappingTransformer(env, lookupMap, lookupMap.Schema[keyColumnName], lookupMap.Schema[valueColumnName], columns); 684env.Assert(loader.Schema.TryGetColumnIndex(keyColumnName, out int keyColumnIndex)); 685env.Assert(loader.Schema.TryGetColumnIndex(valueColumnName, out int valueColumnIndex)); 689transformer = new ValueMappingTransformer(env, loader, loader.Schema[keyColumnName], loader.Schema[valueColumnName], columns); 990var schema = lookup.Schema;
Transforms\ValueToKeyMappingEstimator.cs (2)
158if (keyData != null && keyData.Schema.Count != 1) 161$"containing the terms to map, but this had {keyData.Schema.Count} columns.");
Transforms\ValueToKeyMappingTransformer.cs (10)
256var infos = CreateInfos(input.Schema); 455if (keyData.Schema.GetColumnOrNull(src) == null) 460ch.Assert(keyData.Schema.Count == 1); 473if (keyData.Schema.Count != 1) 476$"had {keyData.Schema.Count} instead. Consider using {nameof(ColumnSelectingEstimator)} on that data first."); 479var typeSrc = keyData.Schema[0].Type; 483using (var cursor = keyData.GetRowCursor(keyData.Schema[0])) 573Contracts.Check(trainingData.Schema.TryGetColumnIndex(infos[iinfo].InputColumnName, out int colIndex)); 587using (var cursor = trainingData.GetRowCursor(trainingData.Schema.Where(c => toTrain.Contains(c.Index)))) 601trainingData.Schema.TryGetColumnIndex(infos[iinfo].InputColumnName, out int colIndex);
Utilities\ColumnCursor.cs (11)
26=> GetColumn<T>(data, data.Schema[columnName]); 45if (data.Schema[colIndex].Name != colName || data.Schema[colIndex].Type != colType) 101Contracts.Assert(0 <= col && col < data.Schema.Count); 103var column = data.Schema[col]; 119Contracts.Assert(0 <= col && col < data.Schema.Count); 121var column = data.Schema[col]; 137Contracts.Assert(0 <= col && col < data.Schema.Count); 139var column = data.Schema[col]; 159Contracts.Assert(0 <= col && col < data.Schema.Count); 161var column = data.Schema[col];
Utilities\ModelFileUtils.cs (2)
262saver.SaveData(entry.Stream, view, Utils.GetIdentityPermutation(view.Schema.Count)); 351return new RoleMappedSchema(pipe.Schema, roleMappings);
Microsoft.ML.Ensemble (2)
PipelineEnsemble.cs (1)
330var bound = new Bound(this, new RoleMappedSchema(data.Schema));
Selector\SubModelSelector\BaseSubModelSelector.cs (1)
85GetColumnRoles(testData.Schema, scorePipe.Schema));
Microsoft.ML.EntryPoints (12)
CrossValidationMacro.cs (4)
396for (int col = 0; col < idv.Schema.Count; col++) 398if (idv.Schema[col].IsHidden && 399idv.Schema[col].Name.Equals(MetricKinds.ColumnNames.Count)) 411var warningsIdv = warnings.Count > 0 ? AppendRowsDataView.Create(env, warnings[0].Schema, warnings.ToArray()) : null;
FeatureCombiner.cs (2)
55var rms = new RoleMappedSchema(viewTrain.Schema, input.GetRoles()); 119var schema = data.Schema;
JsonUtils\ExecuteGraphCommand.cs (2)
244saver.SaveData(fs, idv, Utils.GetIdentityPermutation(idv.Schema.Count) 245.Where(x => saver.IsColumnSavable(idv.Schema[x].Type)).ToArray());
ScoreColumnSelector.cs (4)
30var maxScoreId = view.Schema.GetMaxAnnotationKind(out int colMax, AnnotationUtils.Kinds.ScoreColumnSetId); 32for (int i = 0; i < view.Schema.Count; i++) 34if (view.Schema[i].IsHidden) 36if (!ShouldAddColumn(view.Schema, i, input.ExtraColumns, maxScoreId))
Microsoft.ML.Fairlearn (4)
Metrics\FairlearnMetricCatalog.cs (4)
61var sensitiveCol = _eval.Schema[_sensitiveFeatureColumn]; 175var sensitiveCol = _eval.Schema[_sensitiveFeatureColumn]; 177DataViewSchema columns = _eval.Schema; 190var data = new DataFrame(_eval.Schema.AsEnumerable().Select<DataViewSchema.Column, DataFrameColumn>(column =>
Microsoft.ML.FastTree (4)
TreeEnsembleFeaturizationEstimator.cs (2)
115return new TreeEnsembleFeaturizationTransformer(Env, input.Schema, input.Schema[FeatureColumnName], model,
TreeEnsembleFeaturizationTransformer.cs (1)
146public override DataViewSchema GetOutputSchema(DataViewSchema inputSchema) => Transform(new EmptyDataView(Host, inputSchema)).Schema;
TreeEnsembleFeaturizer.cs (1)
799var col = input.Schema.GetColumnOrNull(labelName);
Microsoft.ML.ImageAnalytics (2)
ImagePixelExtractor.cs (1)
210return new RowToRowMapperTransform(env, input, transformer.MakeRowMapper(input.Schema), transformer.MakeRowMapper);
VectorToImageTransform.cs (1)
234return new RowToRowMapperTransform(env, input, transformer.MakeRowMapper(input.Schema), transformer.MakeRowMapper);
Microsoft.ML.IntegrationTests (24)
Common.cs (4)
26Assert.Equal(toyClassProperties.Length, testTypeDataset.Schema.Count); 47foreach (var column in testTypeDataset.Schema) 72Common.AssertEqual(data1.Schema, data2.Schema);
Debugging.cs (4)
71var tokensColumn = transformedData.GetColumn<string[]>(transformedData.Schema["FeaturizeTextTokens"]); 83var featuresColumn = transformedData.GetColumn<float[]>(transformedData.Schema["Features"]); 116var outputSchema = model.GetOutputSchema(data.Schema); 137foreach (var column in data.Schema)
Explainability.cs (1)
53mlContext.Model.Save(model, data.Schema, modelAndSchemaPath);
IntrospectiveTraining.cs (4)
207var numFeatures = (transformedData.Schema["Features"].Type as VectorDataViewType).Size; 244var numFeatures = (transformedData.Schema["Features"].Type as VectorDataViewType).Size; 306var currentSchema = data.Schema; 352transformedData.Schema["CategoricalFeatures"].GetSlotNames(ref categoricalSlotNames);
ModelFiles.cs (9)
57mlContext.Model.Save(model, data.Schema, modelPath); 104mlContext.Model.Save(model, data.Schema, modelPath); 111TestCommon.CheckSameSchemas(data.Schema, serializedSchema); 151mlContext.Model.Save(transformerModel, data.Schema, modelAndSchemaPath); 299Assert.False(data.Schema["Features"].HasSlotNames()); 305Assert.True(data.Schema["Features"].HasSlotNames()); 307data.Schema["Features"].GetSlotNames(ref slotNames); 346Assert.True(!data.Schema["Features"].HasSlotNames()); 349Assert.True(data.Schema["Features"].HasSlotNames());
SchemaDefinitionTests.cs (2)
45outputSchemaDefinition["Features"].ColumnType = model1.GetOutputSchema(data.Schema)["Features"].Type; 49outputSchemaDefinition["Features"].ColumnType = model2.GetOutputSchema(data.Schema)["Features"].Type;
Microsoft.ML.Mkl.Components (3)
VectorWhitening.cs (3)
282var inputSchema = inputData.Schema; 294throw env.ExceptParam(nameof(inputData.Schema), reason); 335using (var cursor = inputData.GetRowCursor(inputData.Schema.Where(c => cols.Any(col => c.Index == col))))
Microsoft.ML.OnnxConverter (14)
OnnxExportExtensions.cs (3)
29for (int i = 0; i < sink.Schema.Count; ++i) 31if (!outputColumnNamesToKeep.Contains(sink.Schema[i].Name)) 33outputColumnNamesToDrop.Add(sink.Schema[i].Name);
SaveOnnxCommand.cs (11)
171for (int i = 0; i < inputData.Schema.Count; i++) 173string colName = inputData.Schema[i].Name; 177ctx.AddInputVariable(inputData.Schema[i].Type, colName); 189for (int i = 0; i < outputData.Schema.Count; ++i) 191if (outputData.Schema[i].IsHidden) 194var column = outputData.Schema[i]; 209var trueVariableName = ctx.AddIntermediateVariable(outputData.Schema[i].Type, idataviewColumnName + ".output"); 211ctx.AddOutputVariable(outputData.Schema[i].Type, trueVariableName); 264foreach (var col in source.Schema) 270foreach (var col in end.Schema) 364var predictedLabelColumn = scorePipe.Schema.GetColumnOrNull(DefaultColumnNames.PredictedLabel);
Microsoft.ML.OnnxTransformerTest (24)
DnnImageFeaturizerTest.cs (6)
85pipe.GetOutputSchema(SchemaShape.Create(invalidDataWrongVectorSize.Schema)); 117using (var cursor = result.GetRowCursor(result.Schema["output_1"])) 120var getter = cursor.GetGetter<VBuffer<float>>(result.Schema["output_1"]); 163using (var cursor = loadedView.GetRowCursor(loadedView.Schema[outputNames])) 166var softMaxGetter = cursor.GetGetter<VBuffer<float>>(loadedView.Schema[outputNames]); 237ML.Model.Save(model, data.Schema, modelPath);
OnnxTransformTests.cs (18)
166pipe.GetOutputSchema(SchemaShape.Create(invalidDataWrongVectorSize.Schema)); 206var sofMaxOut1Col = loadedView.Schema[outputNames[0]]; 266ML.Model.Save(model, data.Schema, tempPath); 270var softmaxOutCol = result.Schema["softmaxout_1"]; 317ML.Model.Save(model, data.Schema, tempPath); 321var softmaxOutCol = result.Schema["softmaxout_1"]; 372var scoreCol = onnx.Schema["softmaxout_1"]; 440var outaCol = onnx.Schema["outa"]; 441var outbCol = onnx.Schema["outb"]; 442using (var curs = onnx.GetRowCursor(outaCol, onnx.Schema["outb"])) 480var outaCol = onnx.Schema["outa"]; 481var outbCol = onnx.Schema["outb"]; 482using (var curs = onnx.GetRowCursor(outaCol, onnx.Schema["outb"])) 506outbCol = onnx.Schema["outb"]; 699var outputColumn = transformedDataView.Schema["output"]; 700using (var curs = transformedDataView.GetRowCursor(outputColumn, transformedDataView.Schema["output"])) 752var outputColumn = transformedDataView.Schema["output"]; 753using (var curs = transformedDataView.GetRowCursor(outputColumn, transformedDataView.Schema["output"]))
Microsoft.ML.Parquet (1)
PartitionedFileLoader.cs (1)
324var subSchema = subLoader.Schema;
Microsoft.ML.PCA (3)
PcaTransformer.cs (3)
215var sInfo = _schemaInfos[i] = new Mapper.ColumnSchemaInfo(ColumnPairs[i], input.Schema, colInfo.WeightColumn); 408bool[] activeColumns = new bool[trainingData.Schema.Count]; 416var inputCols = trainingData.Schema.Where(x => activeColumns[x.Index]);
Microsoft.ML.PerformanceTests (4)
CacheDataViewBench.cs (2)
39var col = cacheDv.Schema.GetColumnOrNull("A").Value; 64_col = _cacheDataView.Schema["A"];
TextLoaderBench.cs (1)
63getters.Add(rowCursor.GetGetter<ReadOnlyMemory<char>>(_dataView.Schema[i]));
TextPredictionEngineCreation.cs (1)
38_context.Model.Save(model, data.Schema, modelPath);
Microsoft.ML.Predictor.Tests (25)
TestIniModels.cs (2)
535var roleMappedSchema = new RoleMappedSchema(data.Schema, false, 574var roleMappedSchema = new RoleMappedSchema(data.Schema, false,
TestPredictors.cs (14)
675var scoreColumn = scored.Schema.GetColumnOrNull("Score"); 677var probabilityColumn = scored.Schema.GetColumnOrNull("Probability"); 679var predictedLabelColumn = scored.Schema.GetColumnOrNull("PredictedLabel"); 691scoreColArray[i] = scoredArray[i].Schema.GetColumnOrNull("Score"); 693probColArray[i] = scoredArray[i].Schema.GetColumnOrNull("Probability"); 695predColArray[i] = scoredArray[i].Schema.GetColumnOrNull("PredictedLabel"); 700var cols = scored.Schema.Where(c => c.Name.Equals("Score") || c.Name.Equals("Probability") || c.Name.Equals("PredictedLabel")); 848var scoreCol = scored.Schema["Score"]; 854probCol = scored.Schema["Probability"]; 855predCol = scored.Schema["PredictedLabel"]; 866scoreColArray[i] = scoredArray[i].Schema["Score"]; 870probColArray[i] = scoredArray[i].Schema["Probability"]; 871predColArray[i] = scoredArray[i].Schema["PredictedLabel"]; 881var cols = scored.Schema.Where(c => c.Name.Equals("Score") || c.Name.Equals("Probability") || c.Name.Equals("PredictedLabel"));
TestTransposer.cs (9)
26var type = view.Schema[col].Type; 34using (var cursor = view.GetRowCursor(view.Schema[col])) 72DataViewType colType = trans.Schema[col].Type; 73Assert.Equal(view.Schema[viewCol].Name, trans.Schema[col].Name); 74DataViewType expectedType = view.Schema[viewCol].Type; 76string desc = string.Format("Column {0} named '{1}'", col, trans.Schema[col].Name); 186bool result = view.Schema.TryGetColumnIndex(names[i], out trueIndex); 245saver.SaveData(mem, view, Utils.GetIdentityPermutation(view.Schema.Count));
Microsoft.ML.Recommender (2)
MatrixFactorizationPredictor.cs (1)
519return Transform(new EmptyDataView(Host, inputSchema)).Schema;
MatrixFactorizationTrainer.cs (1)
541return new MatrixFactorizationPredictionTransformer(_host, model, trainData.Schema, MatrixColumnIndexName, MatrixRowIndexName);
Microsoft.ML.Samples (57)
Dynamic\DataOperations\LoadFromEnumerable.cs (2)
40var featureColumn = data.Schema["Features"].Type as VectorDataViewType; 84featureColumn = data2.Schema["Features"].Type as VectorDataViewType;
Dynamic\DataOperations\LoadingSvmLight.cs (5)
84foreach (var col in svmData.Schema) 90using (var cursor = svmData.GetRowCursor(svmData.Schema)) 92var labelGetter = cursor.GetGetter<float>(svmData.Schema["Label"]); 93var weightGetter = cursor.GetGetter<float>(svmData.Schema["Weight"]); 94var featuresGetter = cursor.GetGetter<VBuffer<float>>(svmData.Schema["Features"]);
Dynamic\DataOperations\LoadingText.cs (2)
102var featuresColumn = dataWithInferredLength.Schema.GetColumnOrNull("Features"); 189using (var cursor = idv.GetRowCursor(idv.Schema))
Dynamic\ModelOperations\SaveLoadModel.cs (1)
32mlContext.Model.Save(model, dataView.Schema, "model.zip");
Dynamic\ModelOperations\SaveLoadModelFile.cs (1)
32mlContext.Model.Save(model, dataView.Schema, "model.zip");
Dynamic\NgramExtraction.cs (4)
88transformedData_onechars.Schema["CharsUnigrams"] 93.Schema["CharsUnigrams"]); 104.Schema["CharsTwograms"]); 106transformedData_twochars.Schema["CharsTwograms"]
Dynamic\SimpleDataViewImplementation.cs (3)
39var textColumn = transformedDataView.Schema["Text"]; 40var tokensColumn = transformedDataView.Schema["TokenizedText"]; 194/// <see cref="IDataView.Schema"/> object that created this cursor, as
Dynamic\TensorFlow\TextClassification.cs (2)
106lookupMap.Schema["Words"], 107lookupMap.Schema["Ids"],
Dynamic\TextTransform.cs (2)
99.Schema[defaultColumnName]); 113.Schema[customizedColumnName]);
Dynamic\Trainers\BinaryClassification\PermutationFeatureImportanceLoadFromDisk.cs (1)
33mlContext.Model.Save(model0, data.Schema, modelPath);
Dynamic\Trainers\MulticlassClassification\ImageClassification\ImageClassificationDefault.cs (1)
91mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema,
Dynamic\Trainers\MulticlassClassification\ImageClassification\LearningRateSchedulingCifarResnetTransferLearning.cs (1)
126mlContext.Model.Save(trainedModel, testDataset.Schema,
Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (1)
116mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema,
Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningTrainTestSplit.cs (1)
108mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema,
Dynamic\Trainers\MulticlassClassification\LogLossPerClass.cs (1)
52transformedTestData.Schema["PredictedLabel"].GetKeyValues(ref keys);
Dynamic\Trainers\MulticlassClassification\PermutationFeatureImportanceLoadFromDisk.cs (1)
41mlContext.Model.Save(model0, data.Schema, modelPath);
Dynamic\Trainers\Ranking\PermutationFeatureImportanceLoadFromDisk.cs (1)
40mlContext.Model.Save(model0, data.Schema, modelPath);
Dynamic\Trainers\Regression\LightGbmAdvanced.cs (1)
35var featureNames = dataView.Schema
Dynamic\Trainers\Regression\LightGbmWithOptionsAdvanced.cs (1)
36var featureNames = dataView.Schema
Dynamic\Trainers\Regression\PermutationFeatureImportanceLoadFromDisk.cs (1)
39mlContext.Model.Save(model0, data.Schema, modelPath);
Dynamic\Transforms\Categorical\OneHotEncoding.cs (1)
78transformedData.Schema[columnName]);
Dynamic\Transforms\Categorical\OneHotHashEncoding.cs (1)
78transformedData.Schema[columnName]);
Dynamic\Transforms\Conversion\Hash.cs (1)
80transformedData.Schema["CategoryHashed"].Annotations.GetValue(
Dynamic\Transforms\Conversion\HashWithOptions.cs (1)
94transformedData.Schema["CategoryHashed"].Annotations.GetValue(
Dynamic\Transforms\Conversion\KeyToValueToKey.cs (1)
92ReadOnlyMemory<char>>>(transformedDataDefault.Schema[nameof(
Dynamic\Transforms\Conversion\MapValueIdvLookup.cs (2)
46lookupIdvMap, lookupIdvMap.Schema["Value"], lookupIdvMap.Schema[
Dynamic\Transforms\CustomMappingSaveAndLoad.cs (1)
54mlContext.Model.Save(transformer, data.Schema, "customTransform.zip");
Dynamic\Transforms\ImageAnalytics\ConvertToGrayScale.cs (1)
66.Schema))
Dynamic\Transforms\ImageAnalytics\ConvertToImage.cs (1)
54.Schema))
Dynamic\Transforms\ImageAnalytics\ExtractPixels.cs (1)
73.Schema))
Dynamic\Transforms\ImageAnalytics\LoadImages.cs (1)
65.Schema))
Dynamic\Transforms\ImageAnalytics\ResizeImages.cs (1)
68.Schema))
Dynamic\Transforms\Projection\VectorWhiten.cs (1)
58transformedData.Schema[nameof(SampleVectorOfNumbersData.Features)]);
Dynamic\Transforms\Projection\VectorWhitenWithOptions.cs (1)
58transformedData.Schema[nameof(SampleVectorOfNumbersData.Features)]);
Dynamic\Transforms\SelectColumns.cs (1)
50Console.WriteLine($"There are {transformedData.Schema.Count} columns" +
Dynamic\Transforms\Text\ProduceHashedNgrams.cs (2)
76transformedDataView.Schema["NgramFeatures"].GetSlotNames(ref slotNames); 78transformedDataView.Schema["NgramFeatures"]);
Dynamic\Transforms\Text\ProduceHashedWordBags.cs (2)
75transformedDataView.Schema["BagOfWordFeatures"].GetSlotNames(ref 79float>>(transformedDataView.Schema["BagOfWordFeatures"]);
Dynamic\Transforms\Text\ProduceNgrams.cs (2)
84transformedDataView.Schema["NgramFeatures"].GetSlotNames(ref slotNames); 86float>>(transformedDataView.Schema["NgramFeatures"]);
Dynamic\Transforms\Text\ProduceWordBags.cs (2)
81transformedDataView.Schema["BagOfWordFeatures"].GetSlotNames(ref 85float>>(transformedDataView.Schema["BagOfWordFeatures"]);
Microsoft.ML.Samples.GPU (6)
docs\samples\Microsoft.ML.Samples\Dynamic\TensorFlow\TextClassification.cs (2)
106lookupMap.Schema["Words"], 107lookupMap.Schema["Ids"],
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ImageClassificationDefault.cs (1)
91mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema,
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\LearningRateSchedulingCifarResnetTransferLearning.cs (1)
126mlContext.Model.Save(trainedModel, testDataset.Schema,
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningEarlyStopping.cs (1)
116mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema,
docs\samples\Microsoft.ML.Samples\Dynamic\Trainers\MulticlassClassification\ImageClassification\ResnetV2101TransferLearningTrainTestSplit.cs (1)
108mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema,
Microsoft.ML.Samples.OneDal (2)
Program.cs (2)
52var nColumns = data.Schema.Count; 53var columnsEnumerator = data.Schema.GetEnumerator();
Microsoft.ML.StandardTrainers (6)
FactorizationMachine\FactorizationMachineTrainer.cs (1)
611return new FieldAwareFactorizationMachinePredictionTransformer(_host, model, trainData.Schema, FeatureColumns.Select(x => x.Name).ToArray());
FactorizationMachine\FieldAwareFactorizationMachineModelParameters.cs (1)
384return Transform(new EmptyDataView(Host, inputSchema)).Schema;
Standard\MulticlassClassification\OneVersusAllTrainer.cs (2)
188return new BinaryPredictionTransformer<TScalarPredictor>(Host, transformer.Model, view.Schema, transformer.FeatureColumnName); 237return new MulticlassPredictionTransformer<OneVersusAllModelParameters>(Host, OneVersusAllModelParameters.Create(Host, _options.UseProbabilities, predictors), input.Schema, featureColumn, LabelColumn.Name);
Standard\MulticlassClassification\PairwiseCouplingTrainer.cs (1)
220return new MulticlassPredictionTransformer<PairwiseCouplingModelParameters>(Host, new PairwiseCouplingModelParameters(Host, predictors), input.Schema, featureColumn, LabelColumn.Name);
Standard\Simple\SimpleTrainers.cs (1)
247return new BinaryPredictionTransformer<PriorModelParameters>(_host, pred, input.Schema, featureColumn: null, labelColumn: _labelColumnName);
Microsoft.ML.TensorFlow (1)
TensorflowTransform.cs (1)
1065_transformer.GetOutputSchema(input.Schema);
Microsoft.ML.TensorFlow.Tests (41)
TensorFlowEstimatorTests.cs (12)
90pipe.GetOutputSchema(SchemaShape.Create(invalidDataWrongVectorSize.Schema)); 171result.Schema.TryGetColumnIndex("Output", out int output); 172using (var cursor = result.GetRowCursor(result.Schema["Output"])) 175var getter = cursor.GetGetter<VBuffer<float>>(result.Schema["Output"]); 211var schema = pipe.Fit(data).Transform(data).Schema; 225schema = pipe.Fit(data).Transform(data).Schema; 264result.Schema.TryGetColumnIndex("Output", out int output); 265using (var cursor = result.GetRowCursor(result.Schema["Output"])) 268var getter = cursor.GetGetter<VBuffer<float>>(result.Schema["Output"]); 303var aGetter = cursor.GetGetter<VBuffer<float>>(result.Schema["a"]); 304var bGetter = cursor.GetGetter<VBuffer<float>>(result.Schema["b"]); 305var cGetter = cursor.GetGetter<VBuffer<float>>(result.Schema["c"]);
TensorflowTests.cs (29)
513using (var curs = tf.GetRowCursor(tf.Schema["image_tensor"], tf.Schema["detection_boxes"], tf.Schema["detection_scores"], tf.Schema["detection_classes"], tf.Schema["num_detections"])) 515var getInput = curs.GetGetter<VBuffer<byte>>(tf.Schema["image_tensor"]); 516var getBoxes = curs.GetGetter<VBuffer<float>>(tf.Schema["detection_boxes"]); 517var getScores = curs.GetGetter<VBuffer<float>>(tf.Schema["detection_scores"]); 518var getNum = curs.GetGetter<VBuffer<float>>(tf.Schema["num_detections"]); 519var getClasses = curs.GetGetter<VBuffer<float>>(tf.Schema["detection_classes"]); 559tf.Schema.TryGetColumnIndex(inputName, out int input); 560tf.Schema.TryGetColumnIndex(outputName, out int b); 561using (var curs = tf.GetRowCursor(tf.Schema[inputName], tf.Schema[outputName])) 563var get = curs.GetGetter<VBuffer<float>>(tf.Schema["softmax2_pre_activation"]); 564var getInput = curs.GetGetter<VBuffer<float>>(tf.Schema["input"]); 1030idv.Schema.TryGetColumnIndex("Output", out int output); 1031using (var cursor = idv.GetRowCursor(idv.Schema["Output"])) 1032using (var cursor2 = idv.GetRowCursor(idv.Schema["Output"])) 1037cursor.GetGetter<VBuffer<float>>(idv.Schema["Output"]); 1039cursor2.GetGetter<VBuffer<float>>(idv.Schema["Output"]); 1085var getter = cursor.GetGetter<VBuffer<float>>(idv.Schema["Output"]); 1281.Append(_mlContext.Transforms.Conversion.MapValue(lookupMap, lookupMap.Schema["Words"], lookupMap.Schema["Ids"], 1424_mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 1527_mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 1686_mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 1817_mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema, 1888_mlContext.Model.Save(trainedModel, shuffledFullImagesDataset.Schema,
Microsoft.ML.TestFramework (65)
BaseTestBaseline.cs (3)
698var leftColumn = left.Schema[leftColumnName]; 729var leftColumn = left.Schema[leftColumnName]; 730var rightColumn = right.Schema[rightColumnName];
DataPipe\TestDataPipe.cs (11)
1191Assert.Equal(3, view.Schema.Count); 1193Assert.Equal("Foo", view.Schema[0].Name); 1194Assert.Equal("Bar", view.Schema[1].Name); 1195Assert.Equal("Biz", view.Schema[2].Name); 1197Assert.True(view.Schema.TryGetColumnIndex("Foo", out temp)); 1199Assert.True(view.Schema.TryGetColumnIndex("Bar", out temp)); 1201Assert.True(view.Schema.TryGetColumnIndex("Biz", out temp)); 1509using (var cursor = loader.GetRowCursor(loader.Schema["DT"], loader.Schema["DT1"])) 1511var getter = cursor.GetGetter<VBuffer<float>>(loader.Schema["DT"]); 1512var getter1 = cursor.GetGetter<VBuffer<float>>(loader.Schema["DT1"]);
DataPipe\TestDataPipeBase.cs (51)
61var outSchemaShape = estimator.GetOutputSchema(SchemaShape.Create(validFitInput.Schema)); 64mustFail(() => estimator.GetOutputSchema(SchemaShape.Create(validTransformInput.Schema))); 70mustFail(() => estimator.GetOutputSchema(SchemaShape.Create(invalidInput.Schema))); 76estimator.GetOutputSchema(SchemaShape.Create(validForFitNotValidForTransformInput.Schema)); 83ML.Model.Save(transformer, validFitInput.Schema, modelPath); 94var schema = transformer.GetOutputSchema(data.Schema); 99var mapper = transformer.GetRowToRowMapper(data.Schema); 100Check(mapper.InputSchema == data.Schema, "InputSchemas were not identical to actual input schema"); 105mustFail(() => transformer.GetRowToRowMapper(data.Schema)); 109TestCommon.CheckSameSchemas(schema, loadedTransformer.GetOutputSchema(data.Schema)); 111TestCommon.CheckSameSchemas(data.Schema, loadedInputSchema); 117TestCommon.CheckSameSchemas(schema, scoredTrain.Schema); 123TestCommon.CheckSameSchemas(scoredTrain.Schema, scoredTrain2.Schema); 134mustFail(() => transformer.GetOutputSchema(invalidInput.Schema)); 136mustFail(() => loadedTransformer.GetOutputSchema(invalidInput.Schema)); 141mustFail(() => transformer.GetOutputSchema(validForFitNotValidForTransformInput.Schema)); 143mustFail(() => loadedTransformer.GetOutputSchema(validForFitNotValidForTransformInput.Schema)); 148var scoredTrainSchemaShape = SchemaShape.Create(transformer.GetOutputSchema(validFitInput.Schema)); 202if (!CheckMetadataTypes(reappliedPipe.Schema)) 205if (!TestCommon.CheckSameSchemas(pipe1.Schema, reappliedPipe.Schema)) 235if (!CheckMetadataTypes(pipe2.Schema)) 238if (!TestCommon.CheckSameSchemas(pipe1.Schema, pipe2.Schema)) 243if (pipe1.Schema.Count > 0) 266using (var c1 = newPipe.GetRowCursor(newPipe.Schema, new Random(123))) 322if (!CheckMetadataTypes(pipe.Schema)) 382var schema = view.Schema; 407if (savable.Count < view.Schema.Count) 425if (!CheckMetadataTypes(loadedData.Schema)) 428if (!TestCommon.CheckSameSchemas(view.Schema, loadedData.Schema, exactTypes: false, keyNames: false)) 529var schema = view.Schema; 547if (savable.Count < view.Schema.Count) 561if (!TestCommon.CheckSameSchemas(view.Schema, loader.Schema)) 575var schema = view.Schema; 598if (savable.Count < view.Schema.Count) 612if (!TestCommon.CheckSameSchemas(view.Schema, loader.Schema)) 654Contracts.Assert(view1.Schema.Count == view2.Schema.Count); 662Check(curs1.Schema == view1.Schema, "Schema of view 1 and its cursor differed"); 663Check(curs2.Schema == view2.Schema, "Schema of view 2 and its cursor differed"); 669var view2EvenCols = view2.Schema.Where(col => (col.Index & 1) == 0); 673Check(curs1.Schema == view1.Schema, "Schema of view 1 and its cursor differed"); 674Check(curs2.Schema == view2.Schema, "Schema of view 2 and its cursor differed"); 680var view2OddCols = view2.Schema.Where(col => (col.Index & 1) != 0); 684Check(curs1.Schema == view1.Schema, "Schema of view 1 and its cursor differed"); 685Check(curs2.Schema == view2.Schema, "Schema of view 2 and its cursor differed"); 692Check(curs1.Schema == view1.Schema, "Schema of view 1 and its cursor differed"); 784Contracts.Assert(curs1.Schema.Count == view2.Schema.Count);
Microsoft.ML.Tests (433)
CachingTests.cs (4)
85data.GetColumn<float[]>(data.Schema["Features"]).ToArray(); 86data.GetColumn<float[]>(data.Schema["Features"]).ToArray(); 92data.GetColumn<float[]>(data.Schema["Features"]).ToArray(); 93data.GetColumn<float[]>(data.Schema["Features"]).ToArray();
CalibratedModelParametersTests.cs (3)
31ML.Model.Save(model, data.Schema, modelAndSchemaPath); 53ML.Model.Save(model, data.Schema, modelAndSchemaPath); 76ML.Model.Save(model, data.Schema, modelAndSchemaPath);
ImagesTests.cs (24)
154var pathGetter = cursor.GetGetter<ReadOnlyMemory<char>>(cropped.Schema["ImagePath"]); 156var imageCropGetter = cursor.GetGetter<MLImage>(cropped.Schema["ImageCropped"]); 200grey.Schema.TryGetColumnIndex("ImageGrey", out int greyColumn); 203var imageGetter = cursor.GetGetter<MLImage>(grey.Schema["ImageGrey"]); 363var imageGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageRestored"]); 366var imageCropGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageCropped"]); 438var imageGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageRestored"]); 441var imageCropGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageCropped"]); 514var imageGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageRestored"]); 517var imageCropGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageCropped"]); 589var imageGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageRestored"]); 592var imageCropGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageCropped"]); 664var imageGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageRestored"]); 667var imageCropGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageCropped"]); 740var imageGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageRestored"]); 743var imageCropGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageCropped"]); 815var imageGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageRestored"]); 818var imageCropGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageCropped"]); 891var imageGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageRestored"]); 894var imageCropGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageCropped"]); 965var imageGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageRestored"]); 968var imageCropGetter = cursor.GetGetter<MLImage>(backToImages.Schema["ImageCropped"]); 1140var pathGetter = cursor.GetGetter<ReadOnlyMemory<char>>(tsvFile.Schema["ImagePath"]); 1141var labelGetter = cursor.GetGetter<ReadOnlyMemory<char>>(tsvFile.Schema["Label"]);
OnnxConversionTest.cs (2)
1523transformedData.Schema[columnName].GetSlotNames(ref mlNetSlots); 1524onnxResult.Schema[columnName].GetSlotNames(ref onnxSlots);
PermutationFeatureImportanceTests.cs (10)
46ML.Model.Save(model, data.Schema, modelAndSchemaPath); 114ML.Model.Save(model, data.Schema, modelAndSchemaPath); 188ML.Model.Save(model, data.Schema, modelAndSchemaPath); 276ML.Model.Save(model, data.Schema, modelAndSchemaPath); 351ML.Model.Save(model, data.Schema, modelAndSchemaPath); 425ML.Model.Save(model, data.Schema, modelAndSchemaPath); 533ML.Model.Save(model, data.Schema, modelAndSchemaPath); 606ML.Model.Save(model, data.Schema, modelAndSchemaPath); 684ML.Model.Save(model, data.Schema, modelAndSchemaPath); 753ML.Model.Save(model, data.Schema, modelAndSchemaPath);
RangeFilterTests.cs (2)
28var cnt = data1.GetColumn<float>(data1.Schema["Floats"]).Count(); 33cnt = data2.GetColumn<float>(data.Schema["Floats"]).Count();
Scenarios\Api\CookbookSamples\CookbookSamplesDynamicApi.cs (9)
64var featureColumns = transformedData.GetColumn<string[]>(transformedData.Schema["AllFeatures"]) 198mlContext.Model.Save(model, trainData.Schema, modelPath); 516var messageTexts = data.GetColumn<string>(data.Schema["Message"]).Take(20).ToArray(); 550var embeddings = transformedData.GetColumn<float[]>(transformedData.Schema["Embeddings"]).Take(10).ToArray(); 551var unigrams = transformedData.GetColumn<float[]>(transformedData.Schema["BagOfWords"]).Take(10).ToArray(); 590var catColumns = data.GetColumn<string[]>(data.Schema["CategoricalFeatures"]).Take(10).ToArray(); 606var categoricalBags = transformedData.GetColumn<float[]>(transformedData.Schema["CategoricalBag"]).Take(10).ToArray(); 607var workclasses = transformedData.GetColumn<float[]>(transformedData.Schema["WorkclassOneHotTrimmed"]).Take(10).ToArray(); 752mlContext.Model.Save(model, cachedTrainData.Schema, modelPath);
Scenarios\Api\Estimators\PredictAndMetadata.cs (2)
92Assert.NotNull(scoredData.Schema["Score"].Annotations.Schema.GetColumnOrNull(AnnotationUtils.Kinds.SlotNames)); 126Assert.Null(scoredData2.Schema["Score"].Annotations.Schema.GetColumnOrNull(AnnotationUtils.Kinds.SlotNames));
Scenarios\Api\TestApi.cs (32)
165Assert.True(applied.Schema.TryGetColumnIndex("Label", out int label)); 231Assert.True(idv.Schema[0].Annotations.Schema.Count == 2); 232Assert.True(idv.Schema[0].Annotations.Schema[0].Name == kindFloat); 233Assert.True(idv.Schema[0].Annotations.Schema[0].Type == coltypeFloat); 234Assert.True(idv.Schema[0].Annotations.Schema[1].Name == kindString); 235Assert.True(idv.Schema[0].Annotations.Schema[1].Type == TextDataViewType.Instance); 237Assert.True(idv.Schema[1].Annotations.Schema.Count == 3); 238Assert.True(idv.Schema[1].Annotations.Schema[0].Name == kindStringArray); 239Assert.True(idv.Schema[1].Annotations.Schema[0].Type is VectorDataViewType vectorType && vectorType.ItemType is TextDataViewType); 240Assert.Throws<ArgumentOutOfRangeException>(() => idv.Schema[1].Annotations.Schema[kindFloat]); 243idv.Schema[0].Annotations.GetValue(kindFloat, ref retrievedFloat); 247idv.Schema[0].Annotations.GetValue(kindString, ref retrievedReadOnlyMemory); 251idv.Schema[1].Annotations.GetValue(kindStringArray, ref retrievedReadOnlyMemoryVBuffer); 255idv.Schema[1].Annotations.GetValue(kindFloatArray, ref retrievedFloatVBuffer); 260idv.Schema[1].Annotations.GetValue(kindVBuffer, ref retrievedVBuffer); 263Assert.Throws<InvalidOperationException>(() => idv.Schema[1].Annotations.GetValue(kindFloat, ref retrievedReadOnlyMemoryVBuffer)); 335Assert.Equal(fullInput.Schema.Count, split.Schema.Count); 336foreach (var col in fullInput.Schema) 338Assert.Equal(col.Name, split.Schema[col.Index].Name); 358return view.GetColumn<ReadOnlyMemory<char>>(view.Schema["Workclass"]).Select(x => x.ToString()).ToList(); 457var ids = split.TestSet.GetColumn<int>(split.TestSet.Schema[nameof(Input.Id)]); 461ids = split.TestSet.GetColumn<int>(split.TestSet.Schema[nameof(Input.Id)]); 465ids = split.TestSet.GetColumn<int>(split.TestSet.Schema[nameof(Input.Id)]); 469ids = split.TestSet.GetColumn<int>(split.TestSet.Schema[nameof(Input.Id)]); 473ids = split.TrainSet.GetColumn<int>(split.TrainSet.Schema[nameof(Input.Id)]); 477ids = split.TestSet.GetColumn<int>(split.TestSet.Schema[nameof(Input.Id)]); 483ids = split.TestSet.GetColumn<int>(split.TestSet.Schema[nameof(Input.Id)]); 486Assert.NotNull(split.TrainSet.Schema.GetColumnOrNull("KeyStrat")); // Check that the key column used as SamplingKeyColumn wasn't deleted by the split 501var idsTest1 = cvSplits[0].TestSet.GetColumn<int>(cvSplits[0].TestSet.Schema[nameof(Input.Id)]); 502var idsTest2 = cvSplits[1].TestSet.GetColumn<int>(cvSplits[1].TestSet.Schema[nameof(Input.Id)]); 508Assert.NotNull(split.TrainSet.Schema.GetColumnOrNull(colname));
Scenarios\GetColumnTests.cs (13)
36var enum1 = data.GetColumn<float>(data.Schema["floatScalar"]).ToArray(); 37var enum2 = data.GetColumn<float[]>(data.Schema["floatVector"]).ToArray(); 38var enum3 = data.GetColumn<VBuffer<float>>(data.Schema["floatVector"]).ToArray(); 40var enum4 = data.GetColumn<string>(data.Schema["stringScalar"]).ToArray(); 41var enum5 = data.GetColumn<string[]>(data.Schema["stringVector"]).ToArray(); 44mustFail(() => data.GetColumn<float[]>(data.Schema["floatScalar"])); 45mustFail(() => data.GetColumn<int[]>(data.Schema["floatVector"])); 46mustFail(() => data.GetColumn<int>(data.Schema["floatScalar"])); 47mustFail(() => data.GetColumn<int?>(data.Schema["floatScalar"])); 48mustFail(() => data.GetColumn<string>(data.Schema["floatScalar"])); 59mustFail(() => data.GetColumn<float>(data1.Schema["floatScalar"])); 61mustFail(() => data.GetColumn<float>(data1.Schema["anotherFloatVector"])); 63mustFail(() => data.GetColumn<string[]>(data1.Schema["stringVector"]).ToArray());
SvmLightTests.cs (22)
44Assert.True(data.Schema["Features"].Type.GetValueCount() == expectedInputSize); 157Assert.True(data.Schema["Features"].Type.GetValueCount() == 3); 170TestCommon.CheckSameSchemas(data.Schema, expectedData.Schema); 186Assert.True(data.Schema["Features"].Type.GetValueCount() == 3); 208Assert.True(data.Schema["Features"].Type.GetValueCount() == 1); 239using (var curs = view.GetRowCursor(view.Schema)) 241var featuresGetter = curs.GetGetter<VBuffer<float>>(view.Schema["Features"]); 259using (var curs = data.GetRowCursor(data.Schema["Label"])) 261var getter = curs.GetGetter<float>(data.Schema["Label"]); 278using (var curs = data.GetRowCursor(data.Schema["GroupId"])) 280var getter = curs.GetGetter<ulong>(data.Schema["GroupId"]); 326using (var curs = data.GetRowCursor(data.Schema["Features"])) 328var getter = curs.GetGetter<VBuffer<float>>(data.Schema["Features"]); 352using (var curs = data.GetRowCursor(data.Schema["Features"])) 354var getter = curs.GetGetter<VBuffer<float>>(data.Schema["Features"]); 371using (var curs = data.GetRowCursor(data.Schema["Features"])) 373var getter = curs.GetGetter<VBuffer<float>>(data.Schema["Features"]); 390using (var curs = data.GetRowCursor(data.Schema["Features"])) 392var getter = curs.GetGetter<VBuffer<float>>(data.Schema["Features"]); 421using (var curs = data.GetRowCursor(data.Schema["Features"])) 423var getter = curs.GetGetter<VBuffer<float>>(data.Schema["Features"]);
TermEstimatorTests.cs (6)
144result.Schema.TryGetColumnIndex("T", out int termIndex); 146var type1 = result.Schema[termIndex].Type; 148result.Schema[termIndex].GetKeyValues(ref names1); 166var aGetter = cursor.GetGetter<uint>(result.Schema["TermA"]); 167var bGetter = cursor.GetGetter<uint>(result.Schema["TermB"]); 168var cGetter = cursor.GetGetter<uint>(result.Schema["TermC"]);
TextLoaderTests.cs (50)
598Assert.NotNull(data.Schema.GetColumnOrNull("Label")); 599Assert.NotNull(data.Schema.GetColumnOrNull("Features")); 602Assert.NotNull(data2.Schema.GetColumnOrNull("String1")); 603Assert.NotNull(data2.Schema.GetColumnOrNull("Number1")); 613Assert.NotNull(data.Schema.GetColumnOrNull("Label")); 614Assert.NotNull(data.Schema.GetColumnOrNull("Workclass")); 615Assert.NotNull(data.Schema.GetColumnOrNull("Categories")); 616Assert.NotNull(data.Schema.GetColumnOrNull("NumericFeatures")); 821Assert.True(result.Schema.TryGetColumnIndex("key", out int featureIdx)); 822Assert.True(result.Schema[featureIdx].Type is KeyDataViewType keyType && keyType.Count == typeof(uint).ToMaxInt()); 906DataViewSchema columnsPeriod = textDataDecimalMarkerPeriod.Schema; 956DataViewSchema columnsComma = textDataDecimalMarkerComma.Schema; 1011DataViewSchema columns = textData.Schema; 1079using (var cursorPeriod = dataViewPeriod.GetRowCursor(dataViewPeriod.Schema)) 1080using (var cursorComma = dataViewComma.GetRowCursor(dataViewComma.Schema)) 1082var delegatePeriod = cursorPeriod.GetGetter<VBuffer<Single>>(dataViewPeriod.Schema["Features"]); 1083var delegateComma = cursorComma.GetGetter<VBuffer<Single>>(dataViewPeriod.Schema["Features"]); 1246Assert.Equal(expectedCount, data.Schema[1].Type.GetKeyCount()); 1258Assert.Equal(expectedCount, data.Schema[1].Type.GetKeyCount()); 1320var idGetter = curs.GetGetter<int>(data.Schema["id"]); 1321var descriptionGetter = curs.GetGetter<ReadOnlyMemory<char>>(data.Schema["description"]); 1322var animalGetter = curs.GetGetter<ReadOnlyMemory<char>>(data.Schema["animal"]); 1496using (var cursorBaseline = baselineDV.GetRowCursor(baselineDV.Schema)) 1497using (var cursorTest = testDV.GetRowCursor(testDV.Schema)) 1499var delegateBaselineId = cursorBaseline.GetGetter<Int32>(baselineDV.Schema["id"]); 1500var delegateBaselineDescription = cursorBaseline.GetGetter<ReadOnlyMemory<char>>(baselineDV.Schema["description"]); 1501var delegateBaselineDate = cursorBaseline.GetGetter<DateTime>(baselineDV.Schema["date"]); 1502var delegateBaselineSing1 = cursorBaseline.GetGetter<Single>(baselineDV.Schema["sing1"]); 1503var delegateBaselineSing2 = cursorBaseline.GetGetter<Single>(baselineDV.Schema["sing2"]); 1504var delegateBaselineSing3 = cursorBaseline.GetGetter<Single>(baselineDV.Schema["sing3"]); 1505var delegateBaselineSing4 = cursorBaseline.GetGetter<Single>(baselineDV.Schema["sing4"]); 1506var delegateBaselineDoub1 = cursorBaseline.GetGetter<Double>(baselineDV.Schema["doub1"]); 1507var delegateBaselineDoub2 = cursorBaseline.GetGetter<Double>(baselineDV.Schema["doub2"]); 1508var delegateBaselineDoub3 = cursorBaseline.GetGetter<Double>(baselineDV.Schema["doub3"]); 1509var delegateBaselineDoub4 = cursorBaseline.GetGetter<Double>(baselineDV.Schema["doub4"]); 1511var delegateTestId = cursorTest.GetGetter<Int32>(testDV.Schema["id"]); 1512var delegateTestDescription = cursorTest.GetGetter<ReadOnlyMemory<char>>(testDV.Schema["description"]); 1513var delegateTestDate = cursorTest.GetGetter<DateTime>(testDV.Schema["date"]); 1514var delegateTestSing1 = cursorTest.GetGetter<Single>(testDV.Schema["sing1"]); 1515var delegateTestSing2 = cursorTest.GetGetter<Single>(testDV.Schema["sing2"]); 1516var delegateTestSing3 = cursorTest.GetGetter<Single>(testDV.Schema["sing3"]); 1517var delegateTestSing4 = cursorTest.GetGetter<Single>(testDV.Schema["sing4"]); 1518var delegateTestSingFt1 = cursorTest.GetGetter<VBuffer<Single>>(testDV.Schema["singFt1"]); 1519var delegateTestSingFt2 = cursorTest.GetGetter<VBuffer<Single>>(testDV.Schema["singFt2"]); 1520var delegateTestDoub1 = cursorTest.GetGetter<Double>(testDV.Schema["doub1"]); 1521var delegateTestDoub2 = cursorTest.GetGetter<Double>(testDV.Schema["doub2"]); 1522var delegateTestDoub3 = cursorTest.GetGetter<Double>(testDV.Schema["doub3"]); 1523var delegateTestDoub4 = cursorTest.GetGetter<Double>(testDV.Schema["doub4"]); 1524var delegateTestDoubFt1 = cursorTest.GetGetter<VBuffer<Double>>(testDV.Schema["doubFt1"]); 1525var delegateTestDoubFt2 = cursorTest.GetGetter<VBuffer<Double>>(testDV.Schema["doubFt2"]);
TrainerEstimators\LbfgsTests.cs (2)
122ML.Model.Save(transformer, dataView.Schema, modelAndSchemaPath); 216ML.Model.Save(transformer, dataView.Schema, modelAndSchemaPath);
TrainerEstimators\MatrixFactorizationTests.cs (3)
113var outputSchema = model.GetOutputSchema(data.Schema); 119testData.Schema.TryGetColumnIndex(labelColumnName, out int labelColumnId); 122prediction.Schema.TryGetColumnIndex(scoreColumnName, out int scoreColumnId);
TrainerEstimators\SdcaTests.cs (4)
138var scores1 = prediction1.GetColumn<float>(prediction1.Schema["Score"]).ToArray(); 139var scores2 = prediction2.GetColumn<float>(prediction2.Schema["Score"]).ToArray(); 197var scores1 = prediction1.GetColumn<float[]>(prediction1.Schema["Score"]).ToArray(); 198var scores2 = prediction2.GetColumn<float[]>(prediction2.Schema["Score"]).ToArray();
TrainerEstimators\SymSgdClassificationTests.cs (3)
47var col1 = data.GetColumn<float>(data.Schema["Score"]).Take(numExamples).ToArray(); 48var col2 = outInitData.GetColumn<float>(outInitData.Schema["Score"]).Take(numExamples).ToArray(); 49var col3 = outNoInitData.GetColumn<float>(outNoInitData.Schema["Score"]).Take(numExamples).ToArray();
TrainerEstimators\TreeEnsembleFeaturizerTest.cs (5)
49var roleMappedSchema = new RoleMappedSchema(dataView.Schema, 149var treeFeaturizer = new TreeEnsembleFeaturizationTransformer(ML, dataView.Schema, dataView.Schema["Features"], model.Model.SubModel, 200var treeFeaturizer = new TreeEnsembleFeaturizationTransformer(ML, dataView.Schema, dataView.Schema["Features"], model.Model,
Transformers\CategoricalHashTests.cs (10)
142var column = result.Schema["CatA"]; 148column = result.Schema["CatB"]; 155column = result.Schema["CatC"]; 161column = result.Schema["CatD"]; 168column = result.Schema["CatE"]; 180column = result.Schema["CatF"]; 190column = result.Schema["CatG"]; 196column = result.Schema["CatH"]; 202column = result.Schema["CatI"]; 207column = result.Schema["CatJ"];
Transformers\CategoricalTests.cs (13)
143output.Schema["CatA"].GetSlotNames(ref slotNames); 220var column = result.Schema["CatA"]; 226column = result.Schema["CatB"]; 233column = result.Schema["CatC"]; 239column = result.Schema["CatD"]; 246column = result.Schema["CatE"]; 256column = result.Schema["CatF"]; 266column = result.Schema["CatG"]; 272column = result.Schema["CatH"]; 278column = result.Schema["CatI"]; 284column = result.Schema["CatJ"]; 291column = result.Schema["CatK"]; 297column = result.Schema["CatL"];
Transformers\ConcatTests.cs (6)
74t = GetType(data.Schema, "f1"); 76t = GetType(data.Schema, "f2"); 78t = GetType(data.Schema, "f3"); 80t = GetType(data.Schema, "f4"); 142t = GetType(data.Schema, "f2"); 144t = GetType(data.Schema, "f3");
Transformers\ConvertTests.cs (8)
296output.Schema["CatA"].Annotations.GetValue(AnnotationUtils.Kinds.KeyValues, ref slotNames); 352Assert.Equal(result.Schema["ConvA"].Annotations.Schema.Select(x => x.Name), new string[2] { AnnotationUtils.Kinds.SlotNames, AnnotationUtils.Kinds.IsNormalized }); 354result.Schema["ConvA"].GetSlotNames(ref slots); 357Assert.True(result.Schema["ConvA"].IsNormalized()); 359Assert.Equal(result.Schema["ConvB"].Annotations.Schema.Select(x => x.Name), new string[1] { AnnotationUtils.Kinds.KeyValues }); 360result.Schema["ConvB"].GetKeyValues(ref slots); 405Assert.True(outDataNew.Schema[1].Type.Equals(outDataNew.Schema[1].Type));
Transformers\CopyColumnEstimatorTests.cs (6)
143result.Schema.TryGetColumnIndex("T", out int termIndex); 144result.Schema.TryGetColumnIndex("T1", out int copyIndex); 147var type1 = result.Schema[termIndex].Type; 153var type2 = result.Schema[copyIndex].Type; 154result.Schema[termIndex].GetKeyValues(ref names1); 155result.Schema[copyIndex].GetKeyValues(ref names2);
Transformers\CountTargetEncodingTests.cs (4)
129using (var curs = transformedData.GetRowCursor(transformedData.Schema)) 130using (var curs1 = transformedData1.GetRowCursor(transformedData.Schema)) 136getters[i] = curs.GetGetter<VBuffer<float>>(transformedData.Schema[countCols[i]]); 137getters1[i] = curs1.GetGetter<VBuffer<float>>(transformedData1.Schema[countCols[i]]);
Transformers\CustomMappingTests.cs (7)
104est.GetOutputSchema(SchemaShape.Create(data.Schema)); 109est.GetOutputSchema(SchemaShape.Create(badData1.Schema)); 117est.GetOutputSchema(SchemaShape.Create(badData2.Schema)); 184var outputs = transformedData.GetColumn<bool>(transformedData.Schema[nameof(MyStatefulOutput.FirstAppearance)]); 202Assert.True(filteredData.GetColumn<float>(filteredData.Schema[nameof(MyInput.Float1)]).All(x => x % 2 == 1)); 241var values = filteredData.GetColumn<int>(filteredData.Schema[nameof(MyFilterInput.Value)]); 242var counter = filteredData.GetColumn<int>(filteredData.Schema[nameof(MyFilterInput.Counter)]);
Transformers\ExpressionTransformerTests.cs (9)
50Assert.True(transformed.Schema["Expr1"].Type == NumberDataViewType.Double); 51Assert.Equal(6, transformed.Schema["Expr2"].Type.GetValueCount()); 52Assert.True(transformed.Schema["Expr2"].Type.GetItemType() == NumberDataViewType.Single); 53Assert.True(transformed.Schema["Expr3"].Type == NumberDataViewType.Single); 54Assert.True(transformed.Schema["Expr4"].Type.GetItemType() == NumberDataViewType.Double); 55Assert.Equal(6, transformed.Schema["Expr4"].Type.GetValueCount()); 56Assert.True(transformed.Schema["Expr5"].Type == NumberDataViewType.Int32); 57Assert.True(transformed.Schema["Expr6"].Type.GetItemType() == TextDataViewType.Instance); 58Assert.Equal(7, transformed.Schema["Expr6"].Type.GetValueCount());
Transformers\FeatureSelectionTests.cs (3)
240var model = pipeline.GetOutputSchema(SchemaShape.Create(dataView.Schema)); 248var model = pipeline.GetOutputSchema(SchemaShape.Create(dataView.Schema)); 256var model = pipeline.GetOutputSchema(SchemaShape.Create(dataView.Schema));
Transformers\HashTests.cs (12)
86var column = result.Schema["HashA"]; 91column = result.Schema["HashAUnlim"]; 96column = result.Schema["HashAUnlimOrdered"]; 366var hashedCol = hashed.Schema["Features"]; 390Assert.True(transformed.Schema["D"].Type.IsKnownSizeVector()); 391Assert.True(transformed.Schema["DHashed"].Type.IsKnownSizeVector()); 392Assert.Equal(1, transformed.Schema["DHashed"].Type.GetValueCount()); 393Assert.False(transformed.Schema["DHashedCombined"].Type.IsKnownSizeVector()); 394Assert.Equal(1, transformed.Schema["DHashedCombined"].Type.GetValueCount()); 396var aHashed = transformed.GetColumn<uint>(transformed.Schema["AHashed"]); 397var dHashed = transformed.GetColumn<VBuffer<uint>>(transformed.Schema["DHashed"]).Select(buffer => 402var dHashedCombined = transformed.GetColumn<uint>(transformed.Schema["DHashedCombined"]);
Transformers\KeyToBinaryVectorEstimatorTest.cs (4)
116var column = result.Schema["CatA"]; 122column = result.Schema["CatB"]; 129column = result.Schema["CatC"]; 132column = result.Schema["CatD"];
Transformers\KeyToValueTests.cs (2)
88TestCommon.CheckSameSchemas(dataLeft.Schema, dataRight.Schema);
Transformers\KeyToVectorEstimatorTests.cs (8)
135var column = result.Schema["CatA"]; 141column = result.Schema["CatB"]; 151column = result.Schema["CatC"]; 161column = result.Schema["CatD"]; 168column = result.Schema["CatE"]; 175column = result.Schema["CatF"]; 179column = result.Schema["CatG"]; 185column = result.Schema["CatH"];
Transformers\NAIndicatorTests.cs (3)
141Assert.True(result.Schema.TryGetColumnIndex("NAA", out var col)); 143Assert.True(result.Schema[col].IsNormalized()); 146result.Schema[col].GetSlotNames(ref value);
Transformers\NormalizerTests.cs (42)
493TestCommon.CheckSameSchemas(data1.Schema, data2.Schema); 494TestCommon.CheckSameSchemas(data1.Schema, data3.Schema); 495TestCommon.CheckSameSchemas(data1.Schema, data4.Schema); 496TestCommon.CheckSameSchemas(data1.Schema, data5.Schema); 510TestCommon.CheckSameSchemas(data6.Schema, data7.Schema); 511TestCommon.CheckSameSchemas(data6.Schema, data8.Schema); 523TestCommon.CheckSameSchemas(data9.Schema, data10.Schema); 524TestCommon.CheckSameSchemas(data9.Schema, data11.Schema); 536TestCommon.CheckSameSchemas(data12.Schema, data13.Schema); 537TestCommon.CheckSameSchemas(data12.Schema, data14.Schema); 549TestCommon.CheckSameSchemas(data15.Schema, data16.Schema); 550TestCommon.CheckSameSchemas(data15.Schema, data17.Schema); 562TestCommon.CheckSameSchemas(data18.Schema, data19.Schema); 563TestCommon.CheckSameSchemas(data18.Schema, data20.Schema); 612TestCommon.CheckSameSchemas(data1.Schema, data6.Schema); 613TestCommon.CheckSameSchemas(data2.Schema, data7.Schema); 614TestCommon.CheckSameSchemas(data3.Schema, data8.Schema); 615TestCommon.CheckSameSchemas(data4.Schema, data9.Schema); 616TestCommon.CheckSameSchemas(data5.Schema, data10.Schema); 879Assert.Equal(3, result.Schema.Count); 1059ML.Model.Save(model, data.Schema, modelAndSchemaPath); 1063var dimensions1 = (transformedData.Schema["output"].Type as VectorDataViewType).Dimensions; 1064var dimensions2 = (transformedData2.Schema["output"].Type as VectorDataViewType).Dimensions;
Transformers\SelectColumnsTests.cs (44)
52var foundColumnA = result.Schema.TryGetColumnIndex("A", out int aIdx); 53var foundColumnB = result.Schema.TryGetColumnIndex("B", out int bIdx); 54var foundColumnC = result.Schema.TryGetColumnIndex("C", out int cIdx); 73var foundColumnA = result.Schema.TryGetColumnIndex("A", out int aIdx); 74var foundColumnB = result.Schema.TryGetColumnIndex("B", out int bIdx); 75var foundColumnC = result.Schema.TryGetColumnIndex("C", out int cIdx); 92var foundColumnA = result.Schema.TryGetColumnIndex("A", out int aIdx); 93var foundColumnB = result.Schema.TryGetColumnIndex("B", out int bIdx); 94var foundColumnC = result.Schema.TryGetColumnIndex("C", out int cIdx); 140Assert.Equal(2, result.Schema.Count); 141var foundColumnA = result.Schema.TryGetColumnIndex("A", out int aIdx); 142var foundColumnB = result.Schema.TryGetColumnIndex("B", out int bIdx); 143var foundColumnC = result.Schema.TryGetColumnIndex("C", out int cIdx); 163Assert.Equal(4, result.Schema.Count); 164var foundColumnA = result.Schema.TryGetColumnIndex("A", out int aIdx); 165var foundColumnB = result.Schema.TryGetColumnIndex("B", out int bIdx); 166var foundColumnC = result.Schema.TryGetColumnIndex("C", out int cIdx); 187Assert.Equal(2, result.Schema.Count); 188Assert.Equal("A", result.Schema[0].Name); 189Assert.Equal("B", result.Schema[1].Name); 207Assert.Equal(2, result.Schema.Count); 208Assert.Equal("A", result.Schema[0].Name); 209Assert.Equal("B", result.Schema[1].Name); 224var foundColumnFeature = result.Schema.TryGetColumnIndex("Features", out int featureIdx); 225var foundColumnLabel = result.Schema.TryGetColumnIndex("Label", out int labelIdx); 226var foundColumnA = result.Schema.TryGetColumnIndex("A", out int aIdx); 227var foundColumnB = result.Schema.TryGetColumnIndex("B", out int bIdx); 228var foundColumnC = result.Schema.TryGetColumnIndex("C", out int cIdx); 252var foundColumnFeature = result.Schema.TryGetColumnIndex("Features", out int featureIdx); 253var foundColumnLabel = result.Schema.TryGetColumnIndex("Label", out int labelIdx); 254var foundColumnA = result.Schema.TryGetColumnIndex("A", out int aIdx); 255var foundColumnB = result.Schema.TryGetColumnIndex("B", out int bIdx); 256var foundColumnC = result.Schema.TryGetColumnIndex("C", out int cIdx); 280var foundColumnFeature = result.Schema.TryGetColumnIndex("Features", out int featureIdx); 281var foundColumnLabel = result.Schema.TryGetColumnIndex("Label", out int labelIdx); 282var foundColumnA = result.Schema.TryGetColumnIndex("A", out int aIdx); 283var foundColumnB = result.Schema.TryGetColumnIndex("B", out int bIdx); 284var foundColumnC = result.Schema.TryGetColumnIndex("C", out int cIdx); 308Assert.Equal(6, result.Schema.Count); 309var foundColumnFeature = result.Schema.TryGetColumnIndex("Features", out int featureIdx); 310var foundColumnLabel = result.Schema.TryGetColumnIndex("Label", out int labelIdx); 311var foundColumnA = result.Schema.TryGetColumnIndex("A", out int aIdx); 312var foundColumnB = result.Schema.TryGetColumnIndex("B", out int bIdx); 313var foundColumnC = result.Schema.TryGetColumnIndex("C", out int cIdx);
Transformers\TextFeaturizerTests.cs (4)
117using (var cursor = dataView.GetRowCursor(dataView.Schema)) 159using (var cursor = dataView.GetRowCursor(dataView.Schema)) 663var featureColumn = result.Schema.GetColumnOrNull("Features"); 705Assert.Equal(10, (savedData.Schema[0].Type as VectorDataViewType)?.Size);
Transformers\ValueMappingTests.cs (52)
63lookupMap.Schema[ValueMappingTransformer.DefaultKeyColumnName], 64lookupMap.Schema[ValueMappingTransformer.DefaultValueColumnName], 71var getterD = cursor.GetGetter<int>(result.Schema["D"]); 72var getterE = cursor.GetGetter<int>(result.Schema["E"]); 73var getterF = cursor.GetGetter<int>(result.Schema["F"]); 101lookupMap.Schema[ValueMappingTransformer.DefaultKeyColumnName], 102lookupMap.Schema[ValueMappingTransformer.DefaultValueColumnName], 109var schema = estimator.GetOutputSchema(SchemaShape.Create(dataView.Schema)); 116var getterVecD = cursor.GetGetter<VBuffer<int>>(result.Schema["VecD"]); 117var getterE = cursor.GetGetter<int>(result.Schema["E"]); 118var getterF = cursor.GetGetter<int>(result.Schema["F"]); 185lookupMap.Schema[ValueMappingTransformer.DefaultKeyColumnName], 186lookupMap.Schema[ValueMappingTransformer.DefaultValueColumnName], 189var schema = estimator.GetOutputSchema(SchemaShape.Create(dataView.Schema)); 200var getterD = cursor.GetGetter<VBuffer<int>>(result.Schema["D"]); 201var getterE = cursor.GetGetter<VBuffer<int>>(result.Schema["E"]); 202var getterF = cursor.GetGetter<VBuffer<int>>(result.Schema["F"]); 236var estimator = new ValueMappingEstimator(Env, mapView, mapView.Schema["Key"], mapView.Schema["Value"], new[] { ("D", "A"), ("E", "B"), ("F", "C") }); 241var getterD = cursor.GetGetter<int>(result.Schema["D"]); 242var getterE = cursor.GetGetter<int>(result.Schema["E"]); 243var getterF = cursor.GetGetter<int>(result.Schema["F"]); 274lookupMap.Schema[ValueMappingTransformer.DefaultKeyColumnName], 275lookupMap.Schema[ValueMappingTransformer.DefaultValueColumnName], 283var getterD = cursor.GetGetter<VBuffer<ReadOnlyMemory<char>>>(result.Schema[3]); 284var getterE = cursor.GetGetter<VBuffer<ReadOnlyMemory<char>>>(result.Schema[4]); 285var getterF = cursor.GetGetter<VBuffer<ReadOnlyMemory<char>>>(result.Schema[5]); 315lookupMap.Schema[ValueMappingTransformer.DefaultKeyColumnName], 316lookupMap.Schema[ValueMappingTransformer.DefaultValueColumnName], 323var getterD = cursor.GetGetter<int>(result.Schema["D"]); 324var getterE = cursor.GetGetter<int>(result.Schema["E"]); 325var getterF = cursor.GetGetter<int>(result.Schema["F"]); 353lookupMap.Schema[ValueMappingTransformer.DefaultKeyColumnName], 354lookupMap.Schema[ValueMappingTransformer.DefaultValueColumnName], 373var outputSchema = est.GetOutputSchema(SchemaShape.Create(dataView.Schema)); 405var outputSchema = estimator.GetOutputSchema(SchemaShape.Create(dataView.Schema)); 565var getterD = cursor.GetGetter<ReadOnlyMemory<char>>(result.Schema["DOutput"]); 573var annotations = result.Schema["D"].Annotations; 702Assert.Equal(5, result.Schema.Count); 703Assert.True(result.Schema.TryGetColumnIndex("D", out int col)); 704Assert.True(result.Schema.TryGetColumnIndex("E", out col)); 720Assert.True(result.Schema.TryGetColumnIndex("Features", out int featureIdx)); 721Assert.True(result.Schema.TryGetColumnIndex("Label", out int labelIdx)); 722Assert.True(result.Schema.TryGetColumnIndex("GroupId", out int groupIdx)); 737Assert.True(result.Schema.TryGetColumnIndex("Features", out int featureIdx)); 738Assert.True(result.Schema.TryGetColumnIndex("Label", out int labelIdx)); 739Assert.True(result.Schema.TryGetColumnIndex("GroupId", out int groupIdx)); 741Assert.True(result.Schema[labelIdx].Type is KeyDataViewType); 742Assert.Equal((ulong)5, result.Schema[labelIdx].Type.GetItemType().GetKeyCount()); 744var t = result.GetColumn<uint>(result.Schema["Label"]); 778var pipeline = ML.Transforms.Conversion.MapValue("PriceCategory", lookupIdvMap, lookupIdvMap.Schema["Value"], lookupIdvMap.Schema["Category"], "Price");
Microsoft.ML.TimeSeries (15)
IidAnomalyDetectionBase.cs (1)
130return Transform(new EmptyDataView(Host, inputSchema)).Schema;
SeasonalityDetector.cs (1)
63var column = input.Schema.GetColumnOrNull(inputColumnName);
SequentialTransformBase.cs (4)
348if (!_transform.Schema.TryGetColumnIndex(OutputColumnName, out colIndex)) 349throw Host.ExceptSchemaMismatch(nameof(_transform.Schema), "output", OutputColumnName); 351bs.TryWriteTypeDescription(ctx.Writer.BaseStream, _transform.Schema[colIndex].Type, out byteWritten); 383public override DataViewSchema OutputSchema => _transform.Schema;
SequentialTransformerBase.cs (5)
447return new SequentialDataTransform(Host, this, input, MakeRowMapper(input.Schema)); 487_bindings = new ColumnBindings(input.Schema, _mapper.GetOutputColumns()); 763_bindings = new ColumnBindings(input.Schema, mapper.GetOutputColumns()); 779ctx.LoadModel<IStatefulRowMapper, SignatureLoadRowMapper>(host, out _mapper, "Mapper", input.Schema); 780_bindings = new ColumnBindings(input.Schema, _mapper.GetOutputColumns());
SrCnnAnomalyDetectionBase.cs (1)
121return Transform(new EmptyDataView(Host, inputSchema)).Schema;
SrCnnEntireAnomalyDetector.cs (1)
200_bindings = new Bindings(input.Schema, inputColumnName, outputColumnName, new VectorDataViewType(NumberDataViewType.Double, _outputLength));
SsaAnomalyDetectionBase.cs (1)
256return Transform(new EmptyDataView(Host, inputSchema)).Schema;
SsaForecastingBase.cs (1)
180return Transform(new EmptyDataView(Host, inputSchema)).Schema;
Microsoft.ML.TorchSharp (32)
AutoFormerV2\ObjectDetectionTrainer.cs (9)
157CheckInputSchema(SchemaShape.Create(input.Schema)); 181var labelCol = input.Schema.GetColumnOrNull(Option.LabelColumnName); 186transformer.GetOutputSchema(input.Schema); 288DataViewRowCursor cursor = input.GetRowCursor(input.Schema[Parent.Option.LabelColumnName], input.Schema[Parent.Option.BoundingBoxColumnName], input.Schema[Parent.Option.ImageColumnName]); 290var boundingBoxGetter = cursor.GetGetter<VBuffer<float>>(input.Schema[Parent.Option.BoundingBoxColumnName]); 291var imageGetter = cursor.GetGetter<MLImage>(input.Schema[Parent.Option.ImageColumnName]); 292var labelGetter = cursor.GetGetter<VBuffer<uint>>(input.Schema[Parent.Option.LabelColumnName]);
NasBert\NasBertTrainer.cs (7)
219return input.GetRowCursor(input.Schema[Parent.BertOptions.Sentence1ColumnName], input.Schema[Parent.BertOptions.Sentence2ColumnName], input.Schema[Parent.Option.LabelColumnName]); 221return input.GetRowCursor(input.Schema[Parent.BertOptions.Sentence1ColumnName], input.Schema[Parent.Option.LabelColumnName]); 226Sentence1Getter = cursor.GetGetter<ReadOnlyMemory<char>>(input.Schema[Parent.BertOptions.Sentence1ColumnName]); 227Sentence2Getter = Parent.BertOptions.Sentence2ColumnName != default ? cursor.GetGetter<ReadOnlyMemory<char>>(input.Schema[Parent.BertOptions.Sentence2ColumnName]) : default;
NasBert\NerTrainer.cs (1)
216input.Schema[Parent.Option.LabelColumnName].GetKeyValues(ref keys);
Roberta\QATrainer.cs (10)
146CheckInputSchema(SchemaShape.Create(input.Schema)); 174transformer.GetOutputSchema(input.Schema); 272DataViewRowCursor cursor = input.GetRowCursor(input.Schema[Parent.Option.ContextColumnName], input.Schema[Parent.Option.QuestionColumnName], input.Schema[Parent.Option.TrainingAnswerColumnName], input.Schema[Parent.Option.AnswerIndexStartColumnName]); 274var contextGetter = cursor.GetGetter<ReadOnlyMemory<char>>(input.Schema[Parent.Option.ContextColumnName]); 275var questionGetter = cursor.GetGetter<ReadOnlyMemory<char>>(input.Schema[Parent.Option.QuestionColumnName]); 276var answerGetter = cursor.GetGetter<ReadOnlyMemory<char>>(input.Schema[Parent.Option.TrainingAnswerColumnName]); 277var answerIndexGetter = cursor.GetGetter<int>(input.Schema[Parent.Option.AnswerIndexStartColumnName]);
TorchSharpBaseTrainer.cs (5)
99CheckInputSchema(SchemaShape.Create(input.Schema)); 118var labelCol = input.Schema.GetColumnOrNull(Option.LabelColumnName); 123transformer.GetOutputSchema(input.Schema); 203var labelGetter = cursor.GetGetter<TLabelCol>(validationSet.Schema[Parent.Option.LabelColumnName]); 275var labelGetter = cursor.GetGetter<TLabelCol>(input.Schema[Parent.Option.LabelColumnName]);
Microsoft.ML.TorchSharp.Tests (35)
NerTests.cs (10)
74var estimatorSchema = estimator.GetOutputSchema(SchemaShape.Create(dataView.Schema)); 80var transformerSchema = transformer.GetOutputSchema(dataView.Schema); 89var labelGetter = cursor.GetGetter<VBuffer<uint>>(output.Schema[2]); 90var predictedLabelGetter = cursor.GetGetter<VBuffer<uint>>(output.Schema[3]); 153var estimatorSchema = estimator.GetOutputSchema(SchemaShape.Create(dataView.Schema)); 159var transformerSchema = transformer.GetOutputSchema(dataView.Schema); 168var labelGetter = cursor.GetGetter<VBuffer<uint>>(output.Schema[2]); 169var predictedLabelGetter = cursor.GetGetter<VBuffer<uint>>(output.Schema[3]); 238var labelGetter = cursor.GetGetter<VBuffer<uint>>(output.Schema[2]); 239var predictedLabelGetter = cursor.GetGetter<VBuffer<uint>>(output.Schema[3]);
ObjectDetectionTests.cs (5)
84var metrics = ML.MulticlassClassification.EvaluateObjectDetection(idv, idv.Schema[2], idv.Schema["Box"], idv.Schema["PredictedLabel"], idv.Schema["PredictedBoundingBoxes"], idv.Schema["Score"]);
QATests.cs (12)
45var estimatorSchema = estimator.GetOutputSchema(SchemaShape.Create(dataView.Schema)); 53var transformerSchema = transformer.GetOutputSchema(dataView.Schema); 91using (var cursor = transformedData.GetRowCursor(transformedData.Schema["Answer"], transformedData.Schema["Score"], transformedData.Schema["TrainingAnswer"], transformedData.Schema["Context"], transformedData.Schema["Question"])) 93var answerGetter = cursor.GetGetter<VBuffer<ReadOnlyMemory<char>>>(transformedData.Schema["Answer"]); 94var contextGetter = cursor.GetGetter<ReadOnlyMemory<char>>(transformedData.Schema["Context"]); 95var questionGetter = cursor.GetGetter<ReadOnlyMemory<char>>(transformedData.Schema["Question"]); 96var trainingAnswerGetter = cursor.GetGetter<ReadOnlyMemory<char>>(transformedData.Schema["TrainingAnswer"]); 97var scoreGetter = cursor.GetGetter<VBuffer<float>>(transformedData.Schema["Score"]);
TextClassificationTests.cs (8)
102var estimatorSchema = estimator.GetOutputSchema(SchemaShape.Create(dataView.Schema)); 109var transformerSchema = transformer.GetOutputSchema(dataView.Schema); 240var estimatorSchema = estimator.GetOutputSchema(SchemaShape.Create(dataView.Schema)); 247var transformerSchema = transformer.GetOutputSchema(dataView.Schema); 324var estimatorSchema = estimator.GetOutputSchema(SchemaShape.Create(preppedData.Schema)); 331var transformerSchema = transformer.GetOutputSchema(preppedData.Schema); 390var estimatorSchema = estimator.GetOutputSchema(SchemaShape.Create(dataView.Schema)); 397var transformerSchema = transformer.GetOutputSchema(dataView.Schema);
Microsoft.ML.Transforms (88)
CountFeatureSelection.cs (1)
299var schema = input.Schema;
CustomMappingFilter.cs (5)
23public DataViewSchema Schema => Input.Schema; 44var inputCols = Input.Schema.Where(x => inputPred(x.Index)); 46return GetRowCursorCore(input, Utils.BuildArray(Input.Schema.Count, inputCols)); 80var inputCols = Input.Schema.Where(x => inputPred(x.Index)); 83var active = Utils.BuildArray(Input.Schema.Count, inputCols);
CustomMappingTransformer.cs (1)
93return new RowToRowMapperTransform(_host, input, MakeRowMapper(input.Schema), MakeRowMapper);
Dracula\CountTableTransformer.cs (4)
131var labelCol = input.Schema.GetColumnOrNull(_labelColumnName); 145var col = input.Schema.GetColumnOrNull(_columns[i].InputColumnName); 163var col = input.Schema.GetColumnOrNull(c.InputColumnName); 590return new RowToRowMapperTransform(Host, input, MakeRowMapperWithNoise(input.Schema), MakeRowMapperWithNoise);
ExpressionTransformer.cs (1)
162var ivec = FindVectorInputColumn(_host, _columns[i].InputColumnNames, input.Schema, inputTypes);
GroupTransform.cs (1)
136_groupBinding = new GroupBinding(input.Schema, host, ctx);
LearnerFeatureSelection.cs (1)
280var schema = view.Schema;
MissingValueHandlingTransformer.cs (4)
146var tmpIsMissingColNames = input.Schema.GetTempColumnNames(options.Columns.Length, "IsMissing"); 147var tmpReplaceColNames = input.Schema.GetTempColumnNames(options.Columns.Length, "Replace"); 162if (!input.Schema.TryGetColumnIndex(column.Source, out int inputCol)) 164var replaceType = input.Schema[inputCol].Type;
MissingValueReplacing.cs (5)
216if (!input.Schema.TryGetColumnIndex(ColumnPairs[i].inputColumnName, out int srcCol)) 218CheckInputColumn(input.Schema, i, srcCol); 291input.Schema.TryGetColumnIndex(columns[iinfo].InputColumnName, out int colSrc); 293var type = input.Schema[colSrc].Type; 315sourceColumns.Add(input.Schema[colSrc]);
MutualInformationFeatureSelection.cs (1)
439var schema = input.Schema;
PermutationFeatureImportance.cs (4)
51var featuresColumn = data.Schema[features]; 53data.Schema.TryGetColumnIndex(features, out int featuresColumnIndex); 56if (data.Schema[featuresColumnIndex].HasSlotNames(numSlots)) 57data.Schema[featuresColumnIndex].Annotations.GetValue(AnnotationUtils.Kinds.SlotNames, ref slotNames);
PermutationFeatureImportanceExtensions.cs (1)
705data.Schema[featureColumnName].Annotations.GetValue("SlotNames", ref nameBuffer);
ProduceIdTransform.cs (1)
106_bindings = new Bindings(input.Schema, true, args.Column);
RandomFourierFeaturizing.cs (6)
260input.Schema.TryGetColumnIndex(columns[i].InputColumnName, out int srcCol); 261var typeSrc = input.Schema[srcCol].Type; 287if (!input.Schema.TryGetColumnIndex(ColumnPairs[i].inputColumnName, out int srcCol)) 289var type = input.Schema[srcCol].Type; 294activeColumns.Add(input.Schema[srcCol]); 302var srcType = input.Schema[srcCols[i]].Type;
StatefulCustomMappingTransformer.cs (1)
124_bindings = new ColumnBindings(input.Schema, cols);
StatefulFilterTransform.cs (2)
73_bindings = new ColumnBindings(Source.Schema, DataViewConstructionUtils.GetSchemaColumns(outSchema)); 88_bindings = new ColumnBindings(newSource.Schema, DataViewConstructionUtils.GetSchemaColumns(_addedSchema));
SvmLight\SvmLightLoader.cs (5)
582var keyCol = _keyVectorsToIndexVectors.GetOutputSchema(data.Schema).GetColumnOrNull(nameof(Indices.FeatureKeys)); 647var schema = keyVectorsToIndexVectors.GetOutputSchema(data.Schema); 677var col = view.Schema.GetColumnOrNull(nameof(IntermediateInput.FeatureKeys)); 759return CreateOutputTransformer(_host, (int)_featureCount, _indicesKind == FeatureIndices.Names, data.Schema).Transform(data); 778public DataViewSchema Schema => _view.Schema;
SvmLight\SvmLightLoaderSaverCatalog.cs (1)
141saver.SaveData(stream, data, data.Schema.Select(col => col.Index).ToArray());
SvmLight\SvmLightSaver.cs (6)
98var labelCol = data.Schema.GetColumnOrNull(_labelCol); 102var featureCol = data.Schema.GetColumnOrNull(_featureCol); 106var groupCol = !string.IsNullOrWhiteSpace(_groupCol) ? data.Schema.GetColumnOrNull(_groupCol) : default; 110var weightCol = !string.IsNullOrWhiteSpace(_weightCol) ? data.Schema.GetColumnOrNull(_weightCol) : default; 116_host.Check(col < data.Schema.Count); 117var column = data.Schema[col];
Text\LdaTransform.cs (3)
835var inputSchema = inputData.Schema; 838if (!inputData.Schema.TryGetColumnIndex(columns[i].InputColumnName, out int srcCol)) 846activeColumns.Add(inputData.Schema[srcCol]);
Text\NgramHashingTransformer.cs (6)
214if (!input.Schema.TryGetColumnIndex(_columns[i].InputColumnNamesArray[j], out int srcCol)) 216var columnType = input.Schema[srcCol].Type; 217if (!NgramHashingEstimator.IsColumnTypeValid(input.Schema[srcCol].Type)) 219sourceColumnsForInvertHash.Add(input.Schema[srcCol]); 229var helper = new InvertHashHelper(this, input.Schema, friendlyNames, sourceColumnsForInvertHash, invertHashMaxCounts); 231var mapper = new Mapper(this, input.Schema, helper.Decorate);
Text\NgramTransform.cs (5)
213input.Schema.TryGetColumnIndex(columns[i].InputColumnName, out int srcCol); 214var typeSrc = input.Schema[srcCol].Type; 236trainingData.Schema.TryGetColumnIndex(columns[iinfo].InputColumnName, out srcCols[iinfo]); 237srcTypes[iinfo] = trainingData.Schema[srcCols[iinfo]].Type; 238activeCols.Add(trainingData.Schema[srcCols[iinfo]]);
Text\SentimentAnalyzingTransform.cs (3)
91var scoreTempName = input.Schema.GetTempColumnName("sa_out"); 125if (input.Schema.TryGetColumnIndex(name, out discard)) 133new KeyValuePair<string, string>(input.Schema.GetTempColumnName(colName), colName)).ToArray();
Text\StopWordsRemovingTransformer.cs (3)
868if (!loader.Schema.TryGetColumnIndex(srcCol, out int colSrcIndex)) 870var typeSrc = loader.Schema[colSrcIndex].Type; 874using (var cursor = loader.GetRowCursor(loader.Schema[srcCol]))
Text\TextFeaturizingEstimator.cs (9)
453textCols = new[] { GenerateColumnName(input.Schema, OutputColumn, "InitialConcat") }; 464dstCols[i] = GenerateColumnName(view.Schema, textCols[i], "TextNormalizer"); 481var col = new WordTokenizingEstimator.ColumnOptions(GenerateColumnName(view.Schema, textCols[i], "WordTokenizer"), textCols[i]); 499col.Name = GenerateColumnName(view.Schema, wordTokCols[i], "StopWordsRemoverTransform"); 512var dstCol = GenerateColumnName(view.Schema, OutputColumn, "WordExtractor"); 537xfCols[i] = (GenerateColumnName(view.Schema, srcCols[i], "CharTokenizer"), srcCols[i]); 543charFeatureCol = GenerateColumnName(view.Schema, OutputColumn, "CharExtractor"); 560var dstCol = GenerateColumnName(view.Schema, charFeatureCol, "LpCharNorm"); 568var dstCol = GenerateColumnName(view.Schema, wordFeatureCol, "LpWordNorm");
Text\WordBagTransform.cs (3)
174(IDataTransform)CreateEstimator(env, options, SchemaShape.Create(input.Schema)).Fit(input).Transform(input); 546return CreateEstimator(env, options, SchemaShape.Create(input.Schema), termLoaderArgs).Fit(input).Transform(input)/* Create(env, options, input, termLoaderArgs).Transform(input) */as IDataTransform; 650return NgramExtractorTransform.CreateEstimator(env, options, SchemaShape.Create(input.Schema), _termLoaderArgs).Fit(input);
Text\WordEmbeddingsExtractor.cs (1)
959transformer.GetOutputSchema(input.Schema);
Text\WordHashBagProducingTransform.cs (2)
102var uniqueSourceNames = NgramExtractionUtils.GenerateUniqueSourceNames(h, options.Columns, view.Schema); 353var tmpName = input.Schema.GetTempColumnName(column.Source[isrc]);
Text\WrappedTextTransformers.cs (1)
193var estimator = WordBagBuildingTransformer.CreateEstimator(_host, CreateOptions(), SchemaShape.Create(input.Schema));
UngroupTransform.cs (1)
137_ungroupBinding = UngroupBinding.Create(ctx, host, input.Schema);
Microsoft.ML.Vision (8)
DnnRetrainTransform.cs (3)
286var inputSchema = input.Schema; 330var cols = input.Schema.Where(c => inputColIndices.Contains(c.Index)); 1288_transformer.GetOutputSchema(input.Schema);
ImageClassificationTrainer.cs (5)
600var labelColumn = input.Schema.GetColumnOrNull(_options.LabelColumnName).Value; 605throw Host.ExceptSchemaMismatch(nameof(input.Schema), "label", (string)labelColumn.Name, "Key", 820var labelColumn = input.Schema[labelColumnName]; 829var imageColumn = input.Schema[imageColumnName]; 833input.Schema.Where(c => c.Index == labelColumn.Index || c.Index == imageColumn.Index)))