10 instantiations of NumberDataViewType
Microsoft.ML.DataView (10)
DataViewType.cs (10)
141Interlocked.CompareExchange(ref _instSByte, new NumberDataViewType(typeof(sbyte)), null) ??
155Interlocked.CompareExchange(ref _instByte, new NumberDataViewType(typeof(byte)), null) ??
169Interlocked.CompareExchange(ref _instInt16, new NumberDataViewType(typeof(short)), null) ??
183Interlocked.CompareExchange(ref _instUInt16, new NumberDataViewType(typeof(ushort)), null) ??
197Interlocked.CompareExchange(ref _instInt32, new NumberDataViewType(typeof(int)), null) ??
211Interlocked.CompareExchange(ref _instUInt32, new NumberDataViewType(typeof(uint)), null) ??
225Interlocked.CompareExchange(ref _instInt64, new NumberDataViewType(typeof(long)), null) ??
239Interlocked.CompareExchange(ref _instUInt64, new NumberDataViewType(typeof(ulong)), null) ??
253Interlocked.CompareExchange(ref _instSingle, new NumberDataViewType(typeof(float)), null) ??
267Interlocked.CompareExchange(ref _instDouble, new NumberDataViewType(typeof(double)), null) ??
1206 references to NumberDataViewType
Microsoft.Data.Analysis (34)
Microsoft.ML.AutoML (23)
Microsoft.ML.AutoML.Tests (96)
DatasetDimensionsTests.cs (4)
46dataBuilder.AddColumn("NoNan", NumberDataViewType.Single, new float[] { 0, 1, 0, 1, 0 });
47dataBuilder.AddColumn("Nan", NumberDataViewType.Single, new float[] { 0, 1, 0, 1, float.NaN });
72dataBuilder.AddColumn("NoNan", Util.GetKeyValueGetter(slotNames), NumberDataViewType.Single, colValues);
78dataBuilder.AddColumn("Nan", Util.GetKeyValueGetter(slotNames), NumberDataViewType.Single, colValues);
SplitUtilTests.cs (6)
31dataViewBuilder.AddColumn("Number", NumberDataViewType.Single, 0f);
32dataViewBuilder.AddColumn("Label", NumberDataViewType.Single, 0f);
47dataViewBuilder.AddColumn("Number", NumberDataViewType.Single, new float[9]);
48dataViewBuilder.AddColumn("Label", NumberDataViewType.Single, new float[9]);
66dataViewBuilder.AddColumn("Number", NumberDataViewType.Single, new float[10000]);
67dataViewBuilder.AddColumn("Label", NumberDataViewType.Single, new float[10000]);
TransformInferenceTests.cs (33)
26new DatasetColumnInfo("Numeric1", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
81new DatasetColumnInfo(DefaultColumnNames.Features, NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
82new DatasetColumnInfo("Numeric1", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
138new DatasetColumnInfo(DefaultColumnNames.Features, NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
185new DatasetColumnInfo("Numeric", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
207new DatasetColumnInfo("Numeric1", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
208new DatasetColumnInfo("Numeric2", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
230new DatasetColumnInfo(DefaultColumnNames.Features, NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
251new DatasetColumnInfo(DefaultColumnNames.Features, new VectorDataViewType(NumberDataViewType.Single), ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
260new DatasetColumnInfo(DefaultColumnNames.Features, NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
261new DatasetColumnInfo("Numeric", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
283new DatasetColumnInfo("Numeric", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
304new DatasetColumnInfo("Numeric", new VectorDataViewType(NumberDataViewType.Single), ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
357new DatasetColumnInfo(DefaultColumnNames.Features, NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
424new DatasetColumnInfo("Numeric", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
458new DatasetColumnInfo(DefaultColumnNames.Features, NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
492new DatasetColumnInfo("Missing", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, true)),
493new DatasetColumnInfo("Numeric", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, false)),
549new DatasetColumnInfo("Missing1", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, true)),
550new DatasetColumnInfo("Missing2", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, true)),
551new DatasetColumnInfo("Numeric", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, false)),
615new DatasetColumnInfo("Numeric1", NumberDataViewType.Single, ColumnPurpose.Ignore, new ColumnDimensions(null, null)),
616new DatasetColumnInfo("Numeric2", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
637new DatasetColumnInfo(DefaultColumnNames.Features, new VectorDataViewType(NumberDataViewType.Single), ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
638new DatasetColumnInfo(DefaultColumnNames.Label, NumberDataViewType.Single, ColumnPurpose.Label, new ColumnDimensions(null, null)),
647new DatasetColumnInfo(DefaultColumnNames.Features, new VectorDataViewType(NumberDataViewType.Single), ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
648new DatasetColumnInfo("CustomLabel", NumberDataViewType.Single, ColumnPurpose.Label, new ColumnDimensions(null, null)),
673new DatasetColumnInfo(DefaultColumnNames.Features, new VectorDataViewType(NumberDataViewType.Single), ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
684new DatasetColumnInfo(DefaultColumnNames.Features, new VectorDataViewType(NumberDataViewType.Single), ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
706new DatasetColumnInfo("Missing", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, true)),
707new DatasetColumnInfo("Missing_MissingIndicator", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, false)),
708new DatasetColumnInfo("Missing_MissingIndicator0", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, false)),
787Assert.Equal(NumberDataViewType.Single, featuresCol.Value.Type.GetItemType());
TransformPostTrainerInferenceTests.cs (5)
27new DatasetColumnInfo("Numeric1", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
28new DatasetColumnInfo("Label", NumberDataViewType.Single, ColumnPurpose.Label, new ColumnDimensions(null, null)),
50new DatasetColumnInfo("Numeric1", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
51new DatasetColumnInfo("Label", NumberDataViewType.Single, ColumnPurpose.Label, new ColumnDimensions(null, null)),
61new DatasetColumnInfo("Numeric1", NumberDataViewType.Single, ColumnPurpose.NumericFeature, new ColumnDimensions(null, null)),
UserInputValidationTests.cs (35)
108trainDataBuilder.AddColumn("0", NumberDataViewType.Single, new float[] { 1 });
113validDataBuilder.AddColumn("0", NumberDataViewType.Single, new float[] { 1 });
130trainDataBuilder.AddColumn("0", NumberDataViewType.Single, new float[] { 1 });
135validDataBuilder.AddColumn("0", NumberDataViewType.Single, new float[] { 1 });
153trainDataBuilder.AddColumn("0", NumberDataViewType.Single, new float[] { 1 });
158validDataBuilder.AddColumn("0", NumberDataViewType.Single, new float[] { 1 });
159validDataBuilder.AddColumn("1", NumberDataViewType.Single, new float[] { 1 });
203schemaBuilder.AddColumn(DefaultColumnNames.Features, NumberDataViewType.Double);
204schemaBuilder.AddColumn(DefaultColumnNames.Label, NumberDataViewType.Single);
217schemaBuilder.AddColumn(DefaultColumnNames.Features, NumberDataViewType.Single);
218schemaBuilder.AddColumn(DefaultColumnNames.Label, NumberDataViewType.Single);
219schemaBuilder.AddColumn(textPurposeColName, NumberDataViewType.Single);
236ValidateLabelTypeTestCore<float>(TaskKind.Regression, NumberDataViewType.Single, true);
238ValidateLabelTypeTestCore<double>(TaskKind.Regression, NumberDataViewType.Double, false);
245ValidateLabelTypeTestCore<float>(TaskKind.Recommendation, NumberDataViewType.Single, true);
247ValidateLabelTypeTestCore<double>(TaskKind.Recommendation, NumberDataViewType.Double, false);
254ValidateLabelTypeTestCore<float>(TaskKind.BinaryClassification, NumberDataViewType.Single, false);
261ValidateLabelTypeTestCore<float>(TaskKind.MulticlassClassification, NumberDataViewType.Single, true);
263ValidateLabelTypeTestCore<double>(TaskKind.MulticlassClassification, NumberDataViewType.Double, true);
270ValidateLabelTypeTestCore<float>(TaskKind.Ranking, NumberDataViewType.Single, true);
272ValidateLabelTypeTestCore<double>(TaskKind.Ranking, NumberDataViewType.Double, false);
281dataViewBuilder.AddColumn("Number", NumberDataViewType.Single, 0f);
283dataViewBuilder.AddColumn(DefaultColumnNames.Label, NumberDataViewType.Single, 0f);
297schemaBuilder.AddColumn("UInt64", NumberDataViewType.UInt64);
298schemaBuilder.AddColumn(DefaultColumnNames.Label, NumberDataViewType.Single);
311schemaBuilder.AddColumn("Number", NumberDataViewType.Single);
312schemaBuilder.AddColumn(DefaultColumnNames.Label, NumberDataViewType.Single);
325dataViewBuilder.AddColumn("Number", NumberDataViewType.Single, 0f);
326dataViewBuilder.AddColumn(DefaultColumnNames.Label, NumberDataViewType.Single, 0f);
331schemaBuilder.AddColumn("Number", NumberDataViewType.Single);
332schemaBuilder.AddColumn(DefaultColumnNames.Label, NumberDataViewType.Single);
352trainDataBuilder.AddColumn("Number", NumberDataViewType.Single, 0f);
353trainDataBuilder.AddColumn(DefaultColumnNames.Label, NumberDataViewType.Single, 0f);
364validationDataBuilder.AddColumn("Number", NumberDataViewType.Single, 0f);
375dataViewBuilder.AddColumn(DefaultColumnNames.Features, NumberDataViewType.Single, 0f);
Microsoft.ML.Core (15)
Microsoft.ML.Core.Tests (16)
Microsoft.ML.Data (404)
Evaluators\AnomalyDetectionEvaluator.cs (12)
99if (t != NumberDataViewType.Single)
103if (t != NumberDataViewType.Single && t.GetKeyCount() != 2)
185overallDvBldr.AddColumn(BinaryClassifierEvaluator.Auc, NumberDataViewType.Double, auc.ToArray());
186overallDvBldr.AddColumn(OverallMetrics.DrAtK, NumberDataViewType.Double, drAtK.ToArray());
187overallDvBldr.AddColumn(OverallMetrics.DrAtPFpr, NumberDataViewType.Double, drAtP.ToArray());
188overallDvBldr.AddColumn(OverallMetrics.DrAtNumPos, NumberDataViewType.Double, drAtNumAnomalies.ToArray());
189overallDvBldr.AddColumn(OverallMetrics.ThreshAtK, NumberDataViewType.Single, thresholdAtK.ToArray());
190overallDvBldr.AddColumn(OverallMetrics.ThreshAtP, NumberDataViewType.Single, thresholdAtP.ToArray());
191overallDvBldr.AddColumn(OverallMetrics.ThreshAtNumPos, NumberDataViewType.Single, thresholdAtNumAnomalies.ToArray());
192overallDvBldr.AddColumn(OverallMetrics.NumAnomalies, NumberDataViewType.Int64, numAnoms.ToArray());
201topKdvBldr.AddColumn(TopKResultsColumns.AnomalyScore, NumberDataViewType.Single, scores.ToArray());
202topKdvBldr.AddColumn(TopKResultsColumns.Label, NumberDataViewType.Single, labels.ToArray());
Evaluators\BinaryClassifierEvaluator.cs (34)
131if (t != NumberDataViewType.Single)
135if (t != NumberDataViewType.Single && t != NumberDataViewType.Double && t != BooleanDataViewType.Instance && t.GetKeyCount() != 2)
147if (probType != NumberDataViewType.Single)
342overallDvBldr.AddColumn(Auc, NumberDataViewType.Double, auc.ToArray());
343overallDvBldr.AddColumn(Accuracy, NumberDataViewType.Double, accuracy.ToArray());
344overallDvBldr.AddColumn(PosPrecName, NumberDataViewType.Double, posPrec.ToArray());
345overallDvBldr.AddColumn(PosRecallName, NumberDataViewType.Double, posRecall.ToArray());
346overallDvBldr.AddColumn(NegPrecName, NumberDataViewType.Double, negPrec.ToArray());
347overallDvBldr.AddColumn(NegRecallName, NumberDataViewType.Double, negRecall.ToArray());
348overallDvBldr.AddColumn(LogLoss, NumberDataViewType.Double, logLoss.ToArray());
349overallDvBldr.AddColumn(LogLossReduction, NumberDataViewType.Double, logLossRed.ToArray());
350overallDvBldr.AddColumn(Entropy, NumberDataViewType.Double, entropy.ToArray());
351overallDvBldr.AddColumn(F1, NumberDataViewType.Double, f1.ToArray());
353overallDvBldr.AddColumn(AuPrc, NumberDataViewType.Double, auprc.ToArray());
364confDvBldr.AddColumn(MetricKinds.ColumnNames.Count, getSlotNames, NumberDataViewType.Double, counts.ToArray());
367confDvBldr.AddColumn(MetricKinds.ColumnNames.Weight, getSlotNames, NumberDataViewType.Double, weights.ToArray());
381dvBldr.AddColumn(Threshold, NumberDataViewType.Single, scores.ToArray());
382dvBldr.AddColumn(Precision, NumberDataViewType.Double, precision.ToArray());
383dvBldr.AddColumn(Recall, NumberDataViewType.Double, recall.ToArray());
384dvBldr.AddColumn(FalsePositiveRate, NumberDataViewType.Double, fpr.ToArray());
387dvBldr.AddColumn("Weighted " + Precision, NumberDataViewType.Double, weightedPrecision.ToArray());
388dvBldr.AddColumn("Weighted " + Recall, NumberDataViewType.Double, weightedRecall.ToArray());
389dvBldr.AddColumn("Weighted " + FalsePositiveRate, NumberDataViewType.Double, weightedFpr.ToArray());
1076_types[LogLossCol] = NumberDataViewType.Double;
1102_types[LogLossCol] = NumberDataViewType.Double;
1265if (t != NumberDataViewType.Single && t != NumberDataViewType.Double && t != BooleanDataViewType.Instance && t.GetKeyCount() != 2)
1269if (t != NumberDataViewType.Single)
1276if (t != NumberDataViewType.Single)
1349scoreCol.Index, AnnotationUtils.Const.ScoreValueKind.Probability, NumberDataViewType.Single.Equals);
1483scoreCol.Index, AnnotationUtils.Const.ScoreValueKind.Probability, NumberDataViewType.Single.Equals);
1566schemaBuilder.AddColumn(mc.LoadName, NumberDataViewType.Double);
1580schemaBuilder.AddColumn(MetricKinds.ColumnNames.Count, NumberDataViewType.Double);
Evaluators\EvaluatorUtils.cs (16)
247if (type != NumberDataViewType.Single)
248throw ectx.ExceptUserArg(nameof(EvaluateCommand.Arguments.WeightColumn), "Incompatible Weight column. Weight column type must be {0}.", NumberDataViewType.Single);
307if (type == NumberDataViewType.Double || type == NumberDataViewType.Single)
308getters[i] = RowCursorUtils.GetGetterAs<double>(NumberDataViewType.Double, cursor, i);
311&& vectorType.ItemType == NumberDataViewType.Double
1011if (type is NumberDataViewType)
1013getters[i] = RowCursorUtils.GetGetterAs<double>(NumberDataViewType.Double, row, i);
1017else if (type is VectorDataViewType vectorType && vectorType.ItemType == NumberDataViewType.Double)
1274else if (type is NumberDataViewType)
1280else if (type is VectorDataViewType vectorType && vectorType.IsKnownSize && vectorType.ItemType == NumberDataViewType.Double)
1317dvBldr.AddColumn(columnName, getSlotNames, NumberDataViewType.Double, new[] { vectorMetrics, vectorStdevMetrics });
1320dvBldr.AddColumn(columnName, getSlotNames, NumberDataViewType.Double, new[] { vectorMetrics });
1329dvBldr.AddColumn(agg[iMetric].Name, NumberDataViewType.Double, avg, Math.Sqrt(agg[iMetric].SumSq / numFolds - avg * avg));
1331dvBldr.AddColumn(agg[iMetric].Name, NumberDataViewType.Double, avg);
1479Contracts.Check(type != null && type.IsKnownSize && type.ItemType == NumberDataViewType.Double);
Evaluators\MulticlassClassificationEvaluator.cs (19)
79if (scoreType == null || scoreType.Size < 2 || scoreType.ItemType != NumberDataViewType.Single)
83if (labelType != NumberDataViewType.Single && labelType.GetKeyCount() <= 0)
216overallDvBldr.AddColumn(AccuracyMicro, NumberDataViewType.Double, microAcc.ToArray());
217overallDvBldr.AddColumn(AccuracyMacro, NumberDataViewType.Double, macroAcc.ToArray());
218overallDvBldr.AddColumn(LogLoss, NumberDataViewType.Double, logLoss.ToArray());
219overallDvBldr.AddColumn(LogLossReduction, NumberDataViewType.Double, logLossRed.ToArray());
222overallDvBldr.AddColumn(TopKAccuracy, NumberDataViewType.Double, topKAcc.ToArray());
227overallDvBldr.AddColumn(AllTopKAccuracy, getKSlotNames, NumberDataViewType.Double, allTopK.ToArray());
230overallDvBldr.AddColumn(PerClassLogLoss, aggregator.GetSlotNames, NumberDataViewType.Double, perClassLogLoss.ToArray());
241confDvBldr.AddColumn(MetricKinds.ColumnNames.Count, getSlotNames, NumberDataViewType.Double, counts.ToArray());
244confDvBldr.AddColumn(MetricKinds.ColumnNames.Weight, getSlotNames, NumberDataViewType.Double, weights.ToArray());
634_types[LogLossCol] = NumberDataViewType.Double;
635_types[SortedScoresCol] = new VectorDataViewType(NumberDataViewType.Single, _numClasses);
663_types[LogLossCol] = NumberDataViewType.Double;
664_types[SortedScoresCol] = new VectorDataViewType(NumberDataViewType.Single, _numClasses);
861if (scoreType == null || scoreType.Size < 2 || scoreType.ItemType != NumberDataViewType.Single)
864if (labelType != NumberDataViewType.Single && labelType.GetKeyCount() <= 0)
976EvaluateUtils.ReconcileSlotNames<double>(Host, views, MulticlassClassificationEvaluator.PerClassLogLoss, NumberDataViewType.Double,
1064labelName, labelCol.Type, NumberDataViewType.Double,
Evaluators\MultiOutputRegressionEvaluator.cs (19)
62if (t == null || !t.IsKnownSize || t.ItemType != NumberDataViewType.Single)
66if (t == null || !t.IsKnownSize || (t.ItemType != NumberDataViewType.Single && t.ItemType != NumberDataViewType.Double))
153overallDvBldr.AddColumn(PerLabelL1, aggregator.GetSlotNames, NumberDataViewType.Double, perLabelL1.ToArray());
154overallDvBldr.AddColumn(PerLabelL2, aggregator.GetSlotNames, NumberDataViewType.Double, perLabelL2.ToArray());
155overallDvBldr.AddColumn(PerLabelRms, aggregator.GetSlotNames, NumberDataViewType.Double, perLabelRms.ToArray());
156overallDvBldr.AddColumn(PerLabelLoss, aggregator.GetSlotNames, NumberDataViewType.Double, perLabelLoss.ToArray());
157overallDvBldr.AddColumn(L1, NumberDataViewType.Double, l1.ToArray());
158overallDvBldr.AddColumn(L2, NumberDataViewType.Double, l2.ToArray());
159overallDvBldr.AddColumn(Dist, NumberDataViewType.Double, dist.ToArray());
309_labelGetter = RowCursorUtils.GetVecGetterAs<float>(NumberDataViewType.Single, row, schema.Label.Value.Index);
454infos[L1Output] = new DataViewSchema.DetachedColumn(L1, NumberDataViewType.Double, null);
455infos[L2Output] = new DataViewSchema.DetachedColumn(L2, NumberDataViewType.Double, null);
456infos[DistCol] = new DataViewSchema.DetachedColumn(Dist, NumberDataViewType.Double, null);
473? RowCursorUtils.GetVecGetterAs<float>(NumberDataViewType.Single, input, LabelIndex)
550if (t == null || !t.IsKnownSize || (t.ItemType != NumberDataViewType.Single && t.ItemType != NumberDataViewType.Double))
559if (t == null || !t.IsKnownSize || t.ItemType != NumberDataViewType.Single)
708if (type != null && type.IsKnownSize && type.ItemType == NumberDataViewType.Double)
Evaluators\QuantileRegressionEvaluator.cs (14)
60if (t == null || t.Size == 0 || (t.ItemType != NumberDataViewType.Single && t.ItemType != NumberDataViewType.Double))
64if (labelType != NumberDataViewType.Single)
72Host.Assert(scoreType != null && scoreType.Size > 0 && (scoreType.ItemType == NumberDataViewType.Single || scoreType.ItemType == NumberDataViewType.Double));
252dvBldr.AddColumn(metricName, getSlotNames, NumberDataViewType.Double, metric);
255dvBldr.AddColumn(metricName, NumberDataViewType.Double, metric);
295_outputType = new VectorDataViewType(NumberDataViewType.Double, _scoreSize);
314_outputType = new VectorDataViewType(NumberDataViewType.Double, _scoreSize);
448if (t != NumberDataViewType.Single)
452if (scoreType == null || scoreType.Size == 0 || (scoreType.ItemType != NumberDataViewType.Single && scoreType.ItemType != NumberDataViewType.Double))
517if (type is VectorDataViewType vectorType && vectorType.IsKnownSize && vectorType.ItemType == NumberDataViewType.Double)
521output = LambdaColumnMapper.Create(Host, "Quantile Regression", output, name, name, type, NumberDataViewType.Double,
Evaluators\RankingEvaluator.cs (8)
99if (t != NumberDataViewType.Single && !(t is KeyDataViewType))
105if (scoreCol.Type != NumberDataViewType.Single)
221overallDvBldr.AddColumn(Ndcg, aggregator.GetSlotNames, NumberDataViewType.Double, ndcg.ToArray());
222overallDvBldr.AddColumn(Dcg, aggregator.GetSlotNames, NumberDataViewType.Double, dcg.ToArray());
233groupDvBldr.AddColumn(Ndcg, aggregator.GetGroupSummarySlotNames("NDCG"), NumberDataViewType.Double, groupNdcg.ToArray());
234groupDvBldr.AddColumn(Dcg, aggregator.GetGroupSummarySlotNames("DCG"), NumberDataViewType.Double, groupDcg.ToArray());
235groupDvBldr.AddColumn(MaxDcg, aggregator.GetGroupSummarySlotNames("MaxDCG"), NumberDataViewType.Double, groupMaxDcg.ToArray());
642_outputType = new VectorDataViewType(NumberDataViewType.Double, _truncationLevel);
Prediction\Calibrator.cs (12)
300DataViewType IValueMapperDist.DistType => NumberDataViewType.Single;
314Host.Check(_mapper.OutputType == NumberDataViewType.Single, "The output type of the predictor is expected to be float");
669env.Check(scoreType is NumberDataViewType);
716var scoreGetter = RowCursorUtils.GetGetterAs<Single>(NumberDataViewType.Single, input, _scoreCol);
887if (type != NumberDataViewType.Single)
889ch.Info("Not training a calibrator because the predictor output is {0}, but expected to be {1}.", type, NumberDataViewType.Single);
969var scoreGetter = RowCursorUtils.GetGetterAs<Single>(NumberDataViewType.Single, cursor, scoreCol.Index);
971RowCursorUtils.GetGetterAs<Single>(NumberDataViewType.Single, cursor, weightCol.Value.Index);
1307var subNodeOutput = ctx.AddIntermediateVariable(NumberDataViewType.Single, "subNodeOutput");
1312var divNodeOutput = ctx.AddIntermediateVariable(NumberDataViewType.Single, "binIndexOutput");
1316var castOutput = ctx.AddIntermediateVariable(NumberDataViewType.Int64, "castOutput");
1324var binIndexOutput = ctx.AddIntermediateVariable(NumberDataViewType.Int64, "binIndexOutput");
Training\TrainerUtils.cs (17)
57if (!(col.Type is VectorDataViewType vecType && vecType.Size > 0 && vecType.ItemType == NumberDataViewType.Single))
75Contracts.Assert(colType.ItemType == NumberDataViewType.Single);
90if (col.Type != BooleanDataViewType.Instance && col.Type != NumberDataViewType.Single && col.Type != NumberDataViewType.Double && !(col.Type is KeyDataViewType keyType && keyType.Count == 2))
125if (col.Type != NumberDataViewType.Single && col.Type != NumberDataViewType.Double)
154if (col.Type != NumberDataViewType.Single && col.Type != NumberDataViewType.Double)
195&& vectorType.ItemType == NumberDataViewType.Single))
207if (col.Type != NumberDataViewType.Single && col.Type != NumberDataViewType.Double)
317return RowCursorUtils.GetGetterAs<float>(NumberDataViewType.Single, row, col.Value.Index);
338return RowCursorUtils.GetGetterAs<ulong>(NumberDataViewType.UInt64, row, col.Value.Index);
359=> new SchemaShape.Column(columnName, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false);
370return new SchemaShape.Column(columnName, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.UInt32, true);
378=> new SchemaShape.Column(featureColumn, SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false);
388return new SchemaShape.Column(weightColumn, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false);
Transforms\Hashing.cs (10)
1378castOutput = ctx.AddIntermediateVariable(NumberDataViewType.Int64, "CastOutput", true);
1380isZeroNode.AddAttribute("to", NumberDataViewType.Int64.RawType);
1387isGreaterThanZeroOutput = ctx.AddIntermediateVariable(NumberDataViewType.Int64, "isGreaterThanZeroOutput");
1390isZeroNode.AddAttribute("to", NumberDataViewType.Int64.RawType);
1398castOutput = ctx.AddIntermediateVariable(NumberDataViewType.UInt32, "CastOutput", true);
1400castNode.AddAttribute("to", NumberDataViewType.UInt32.RawType);
1430var vectorShape = new VectorDataViewType(NumberDataViewType.Int64, _srcTypes[iinfo].GetValueCount());
1434var t = NumberDataViewType.Int64.RawType;
1894return itemType is TextDataViewType || itemType is KeyDataViewType || itemType is NumberDataViewType ||
1969NumberDataViewType.UInt32, true, new SchemaShape(metadata));
Transforms\KeyToVector.cs (9)
260_types[i] = new VectorDataViewType(NumberDataViewType.Single, keyCount);
262_types[i] = new VectorDataViewType(NumberDataViewType.Single, valueCount, keyCount);
477var getSrc = RowCursorUtils.GetGetterAs<uint>(NumberDataViewType.UInt32, input, srcCol);
518var getSrc = RowCursorUtils.GetVecGetterAs<uint>(NumberDataViewType.UInt32, input, srcCol);
564var getSrc = RowCursorUtils.GetVecGetterAs<uint>(NumberDataViewType.UInt32, input, srcCol);
712var castOutput = ctx.AddIntermediateVariable(new VectorDataViewType(NumberDataViewType.Int64, dim), opType);
719var typeShape = new VectorDataViewType(NumberDataViewType.Single, dim, categoryRange);
834metadata.Add(new SchemaShape.Column(AnnotationUtils.Kinds.CategoricalSlotRanges, SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Int32, false));
840NumberDataViewType.Single, false, new SchemaShape(metadata));
Transforms\ValueMapping.cs (38)
109var columnType = (isKey) ? NumberDataViewType.UInt32 :
1094else if (itemType == NumberDataViewType.Single)
1096else if (itemType == NumberDataViewType.Int64)
1113var labelEncoderOutput = (typeValue == NumberDataViewType.Single || typeValue == TextDataViewType.Instance || typeValue == NumberDataViewType.Int64) ? dstVariableName :
1114(typeValue == NumberDataViewType.Double || typeValue == BooleanDataViewType.Instance) ? ctx.AddIntermediateVariable(new VectorDataViewType(NumberDataViewType.Single, (int)srcShape[1]), "LabelEncoderOutput") :
1115ctx.AddIntermediateVariable(new VectorDataViewType(NumberDataViewType.Int64, (int)srcShape[1]), "LabelEncoderOutput");
1121if (typeKey == NumberDataViewType.Int64)
1124if (typeValue is NumberDataViewType)
1134else if (typeKey == NumberDataViewType.Int32)
1138CastInputTo<Int32>(ctx, out node, srcVariableName, opType, labelEncoderOutput, NumberDataViewType.Int64);
1142else if (typeKey == NumberDataViewType.Int16)
1145CastInputTo<Int16>(ctx, out node, srcVariableName, opType, labelEncoderOutput, NumberDataViewType.Int64);
1149else if (typeKey == NumberDataViewType.UInt64)
1152CastInputTo<UInt64>(ctx, out node, srcVariableName, opType, labelEncoderOutput, NumberDataViewType.Int64);
1156else if (typeKey == NumberDataViewType.UInt32)
1159CastInputTo<UInt32>(ctx, out node, srcVariableName, opType, labelEncoderOutput, NumberDataViewType.Int64);
1163else if (typeKey == NumberDataViewType.UInt16)
1166CastInputTo<UInt16>(ctx, out node, srcVariableName, opType, labelEncoderOutput, NumberDataViewType.Int64);
1170else if (typeKey == NumberDataViewType.Single)
1172if (typeValue == NumberDataViewType.Single || typeValue == NumberDataViewType.Double || typeValue == BooleanDataViewType.Instance)
1182else if (typeKey == NumberDataViewType.Double)
1184if (typeValue == NumberDataViewType.Single || typeValue == NumberDataViewType.Double || typeValue == BooleanDataViewType.Instance)
1187CastInputTo<double>(ctx, out node, srcVariableName, opType, labelEncoderOutput, NumberDataViewType.Single);
1198if (typeValue == NumberDataViewType.Single || typeValue == NumberDataViewType.Double || typeValue == BooleanDataViewType.Instance)
1209CastInputTo<bool>(ctx, out node, srcVariableName, opType, labelEncoderOutput, NumberDataViewType.Single);
1214if (typeValue == NumberDataViewType.Int64)
1218else if (typeValue == NumberDataViewType.Int32)
1224else if (typeValue == NumberDataViewType.Int16)
1230else if (typeValue == NumberDataViewType.UInt64 || kind == InternalDataKind.U8)
1236else if (typeValue == NumberDataViewType.UInt32 || kind == InternalDataKind.U4)
1242else if (typeValue == NumberDataViewType.UInt16)
1248else if (typeValue == NumberDataViewType.Single)
1252else if (typeValue == NumberDataViewType.Double)
Microsoft.ML.DataView (36)
Microsoft.ML.Ensemble (20)
Microsoft.ML.EntryPoints (5)
Microsoft.ML.FastTree (47)
FastTreeClassification.cs (2)
316new SchemaShape.Column(DefaultColumnNames.Score, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation())),
317new SchemaShape.Column(DefaultColumnNames.Probability, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation(true))),
GamClassification.cs (2)
187new SchemaShape.Column(DefaultColumnNames.Score, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation())),
188new SchemaShape.Column(DefaultColumnNames.Probability, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation(true))),
TreeEnsembleFeaturizer.cs (4)
118var treeValueType = new VectorDataViewType(NumberDataViewType.Single, owner._ensemble.TrainedEnsemble.NumTrees);
121var leafIdType = new VectorDataViewType(NumberDataViewType.Single, owner._totalLeafCount);
129var pathIdType = new VectorDataViewType(NumberDataViewType.Single, owner._totalLeafCount - owner._ensemble.TrainedEnsemble.NumTrees);
789return LambdaColumnMapper.Create(env, "Key to Float Mapper", input, col, col, type, NumberDataViewType.Single, mapper);
Utils\RegressionTreeBaseUtils.cs (13)
99builder.AddColumn("Bias", NumberDataViewType.Double, Enumerable.Repeat(bias, numberOfRows).ToArray());
100builder.AddColumn("TreeWeights", NumberDataViewType.Double, treeWeightsList.ToArray());
101builder.AddColumn("TreeID", NumberDataViewType.Int32, treeId.ToArray());
103builder.AddColumn(nameof(RegressionTreeBase.LeftChild), NumberDataViewType.Int32, leftChild.ToArray());
104builder.AddColumn(nameof(RegressionTreeBase.RightChild), NumberDataViewType.Int32, rightChild.ToArray());
105builder.AddColumn(nameof(RegressionTreeBase.NumericalSplitFeatureIndexes), NumberDataViewType.Int32, numericalSplitFeatureIndexes.ToArray());
106builder.AddColumn(nameof(RegressionTreeBase.NumericalSplitThresholds), NumberDataViewType.Single, numericalSplitThresholds.ToArray());
108builder.AddColumn(nameof(RegressionTreeBase.LeafValues), NumberDataViewType.Double, leafValues.ToArray());
109builder.AddColumn(nameof(RegressionTreeBase.SplitGains), NumberDataViewType.Double, splitGains.ToArray());
110builder.AddColumn("CategoricalSplitFeatures", NumberDataViewType.Int32, categoricalSplitFeatures.ToArray());
111builder.AddColumn("CategoricalCategoricalSplitFeatureRange", NumberDataViewType.Int32, categoricalCategoricalSplitFeatureRange.ToArray());
138builder.AddColumn("LeafSamples", NumberDataViewType.Double, leafSamples.ToArray());
139builder.AddColumn("LeafSampleWeights", NumberDataViewType.Double, leafSampleWeights.ToArray());
Microsoft.ML.ImageAnalytics (17)
Microsoft.ML.IntegrationTests (2)
Microsoft.ML.KMeansClustering (10)
Microsoft.ML.LightGbm (12)
LightGbmBinaryTrainer.cs (3)
271if (!(labelType is BooleanDataViewType || labelType is KeyDataViewType || labelType == NumberDataViewType.Single))
286new SchemaShape.Column(DefaultColumnNames.Score, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation())),
287new SchemaShape.Column(DefaultColumnNames.Probability, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation(true))),
Microsoft.ML.Mkl.Components (11)
OlsLinearRegression.cs (6)
138new SchemaShape.Column(DefaultColumnNames.Score, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation()))
162if (typeLab != NumberDataViewType.Single)
163throw ch.Except("Incompatible labelColumn column type {0}, must be {1}", typeLab, NumberDataViewType.Single);
168throw ch.Except("Incompatible feature column type {0}, must be known sized vector of {1}", typeFeat, NumberDataViewType.Single);
169if (typeFeat.ItemType != NumberDataViewType.Single)
170throw ch.Except("Incompatible feature column type {0}, must be vector of {1}", typeFeat, NumberDataViewType.Single);
SymSgdClassificationTrainer.cs (3)
257Conversions.DefaultInstance.GetIsDefaultPredicate<float>(NumberDataViewType.Single));
276new SchemaShape.Column(DefaultColumnNames.Score, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation())),
277new SchemaShape.Column(DefaultColumnNames.Probability, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation(true))),
Microsoft.ML.OnnxConverter (2)
Microsoft.ML.OnnxTransformer (10)
Microsoft.ML.Parquet (13)
Microsoft.ML.PCA (14)
PcaTrainer.cs (7)
202return new SchemaShape.Column(weightColumn, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false);
207return new SchemaShape.Column(featureColumn, SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false);
378NumberDataViewType.Single,
472_inputType = new VectorDataViewType(NumberDataViewType.Single, _dimension);
516_inputType = new VectorDataViewType(NumberDataViewType.Single, _dimension);
602bldr.AddColumn("VectorData", NumberDataViewType.Single, cols);
614get { return NumberDataViewType.Single; }
Microsoft.ML.PerformanceTests (6)
Microsoft.ML.Predictor.Tests (12)
TestTransposer.cs (12)
161builder.AddColumn("A", NumberDataViewType.Int32, dataA);
163builder.AddColumn("B", NumberDataViewType.Double, GenerateHelper(rowCount, 0.8, rgen, rgen.NextDouble, 50, 0, 25, 49));
165builder.AddColumn("C", NumberDataViewType.Int16, GenerateHelper(rowCount, 0.1, rgen, () => (short)1, 30, 3, 10, 24));
167builder.AddColumn("D", NumberDataViewType.Double, GenerateHelper(rowCount, 0.1, rgen, rgen.NextDouble, 3, 1));
169builder.AddColumn("E", NumberDataViewType.UInt32, GenerateHelper(rowCount, 0.1, rgen, () => (uint)rgen.Next(int.MinValue, int.MaxValue)));
171builder.AddColumn("F", NumberDataViewType.Int32, GenerateHelper(rowCount, 0.8, rgen, () => rgen.Next()));
227builder.AddColumn("A", NumberDataViewType.Int32, dataA);
229builder.AddColumn("B", NumberDataViewType.Double, GenerateHelper(rowCount, 0.8, rgen, rgen.NextDouble, 50, 0, 25, 49));
231builder.AddColumn("C", NumberDataViewType.Int16, GenerateHelper(rowCount, 0.1, rgen, () => (short)1, 30, 3, 10, 24));
233builder.AddColumn("D", NumberDataViewType.Double, GenerateHelper(rowCount, 0.1, rgen, rgen.NextDouble, 3, 1));
235builder.AddColumn("E", NumberDataViewType.UInt32, GenerateHelper(rowCount, 0.1, rgen, () => (uint)rgen.Next(int.MinValue, int.MaxValue)));
237builder.AddColumn("F", NumberDataViewType.Int32, GenerateHelper(rowCount, 0.8, rgen, () => (int)rgen.Next()));
Microsoft.ML.Recommender (17)
MatrixFactorizationTrainer.cs (14)
444if (labelCol.Type != NumberDataViewType.Single && labelCol.Type != NumberDataViewType.Double)
453if (validLabelCol.Type != NumberDataViewType.Single && validLabelCol.Type != NumberDataViewType.Double)
477var labGetter = RowCursorUtils.GetGetterAs<float>(NumberDataViewType.Single, cursor, data.Schema.Label.Value.Index);
478var matrixColumnIndexGetter = RowCursorUtils.GetGetterAs<uint>(NumberDataViewType.UInt32, cursor, matrixColumnIndexColInfo.Index);
479var matrixRowIndexGetter = RowCursorUtils.GetGetterAs<uint>(NumberDataViewType.UInt32, cursor, matrixRowIndexColInfo.Index);
495ValueGetter<float> validLabelGetter = RowCursorUtils.GetGetterAs<float>(NumberDataViewType.Single, validCursor, validData.Schema.Label.Value.Index);
496var validMatrixColumnIndexGetter = RowCursorUtils.GetGetterAs<uint>(NumberDataViewType.UInt32, validCursor, validMatrixColumnIndexColInfo.Index);
497var validMatrixRowIndexGetter = RowCursorUtils.GetGetterAs<uint>(NumberDataViewType.UInt32, validCursor, validMatrixRowIndexColInfo.Index);
569var labelColumn = new SchemaShape.Column(LabelName, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false);
573var matrixColumnIndexColumn = new SchemaShape.Column(MatrixColumnIndexName, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.UInt32, true);
574var matrixRowIndexColumn = new SchemaShape.Column(MatrixRowIndexName, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.UInt32, true);
595new SchemaShape.Column(DefaultColumnNames.Score, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation())),
Microsoft.ML.StandardTrainers (127)
FactorizationMachine\FactorizationMachineTrainer.cs (9)
233FeatureColumns[0] = new SchemaShape.Column(options.FeatureColumnName, SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false);
237FeatureColumns[i + 1] = new SchemaShape.Column(options.ExtraFeatureColumns[i], SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false);
240WeightColumn = options.ExampleWeightColumnName != null ? new SchemaShape.Column(options.ExampleWeightColumnName, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false) : default;
266FeatureColumns[i] = new SchemaShape.Column(featureColumnNames[i], SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false);
269WeightColumn = exampleWeightColumnName != null ? new SchemaShape.Column(exampleWeightColumnName, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false) : default;
425vectorType.ItemType != NumberDataViewType.Single)
492var weightGetter = data.Schema.Weight?.Index is int weightIdx ? RowCursorUtils.GetGetterAs<float>(NumberDataViewType.Single, cursor, weightIdx) : null;
661new SchemaShape.Column(DefaultColumnNames.Score, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation())),
662new SchemaShape.Column(DefaultColumnNames.Probability, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation(true))),
Standard\LogisticRegression\LogisticRegression.cs (2)
173new SchemaShape.Column(DefaultColumnNames.Score, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation())),
174new SchemaShape.Column(DefaultColumnNames.Probability, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation(true))),
Standard\LogisticRegression\MulticlassLogisticRegression.cs (12)
378new SchemaShape.Column(DefaultColumnNames.Score, SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.AnnotationsForMulticlassScoreColumn(labelCol))),
379new SchemaShape.Column(DefaultColumnNames.PredictedLabel, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.UInt32, true, metadata)
478InputType = new VectorDataViewType(NumberDataViewType.Single, NumberOfFeatures);
479OutputType = new VectorDataViewType(NumberDataViewType.Single, NumberOfClasses);
523InputType = new VectorDataViewType(NumberDataViewType.Single, NumberOfFeatures);
524OutputType = new VectorDataViewType(NumberDataViewType.Single, NumberOfClasses);
605InputType = new VectorDataViewType(NumberDataViewType.Single, NumberOfFeatures);
606OutputType = new VectorDataViewType(NumberDataViewType.Single, NumberOfClasses);
988string classifierLabelOutput = ctx.AddIntermediateVariable(NumberDataViewType.Int64, "ClassifierLabelOutput", true);
999var unsqueezeOutput = ctx.AddIntermediateVariable(NumberDataViewType.Int64, "CastNodeOutput");
1103bldr.AddColumn("Bias", NumberDataViewType.Single, Biases);
1104bldr.AddColumn("Weights", getSlotNames, NumberDataViewType.Single, Weights);
Standard\ModelStatistics.cs (9)
185builder.AddPrimitiveValue("Count of training examples", NumberDataViewType.Int64, TrainingExampleCount);
186builder.AddPrimitiveValue("Residual Deviance", NumberDataViewType.Single, Deviance);
187builder.AddPrimitiveValue("Null Deviance", NumberDataViewType.Single, NullDeviance);
188builder.AddPrimitiveValue("AIC", NumberDataViewType.Single, 2 * ParametersCount + Deviance);
566builder.AddPrimitiveValue("BiasEstimate", NumberDataViewType.Single, biasStats.Estimate);
567builder.AddPrimitiveValue("BiasStandardError", NumberDataViewType.Single, biasStats.StandardError);
568builder.AddPrimitiveValue("BiasZScore", NumberDataViewType.Single, biasStats.ZScore);
569builder.AddPrimitiveValue("BiasPValue", NumberDataViewType.Single, biasStats.PValue);
581var colType = new VectorDataViewType(NumberDataViewType.Single, stdErr.Length);
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (15)
124new SchemaShape.Column(DefaultColumnNames.Score, SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.AnnotationsForMulticlassScoreColumn(labelCol))),
125new SchemaShape.Column(DefaultColumnNames.PredictedLabel, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.UInt32, true, predLabelMetadata)
138Host.Check(labelCol.Type == NumberDataViewType.Single || labelCol.Type is KeyDataViewType,
304_inputType = new VectorDataViewType(NumberDataViewType.Single, _featureCount);
305_outputType = new VectorDataViewType(NumberDataViewType.Single, _labelCount);
351_inputType = new VectorDataViewType(NumberDataViewType.Single, _featureCount);
352_outputType = new VectorDataViewType(NumberDataViewType.Single, _labelCount);
450var typeOne = new VectorDataViewType(NumberDataViewType.Single, 1);
451var typeFea = new VectorDataViewType(NumberDataViewType.Single, _featureHistogram[0].Length);
452var typeLabelByFea = new VectorDataViewType(NumberDataViewType.Single, _labelHistogram.Length, _featureHistogram[0].Length);
453var typeLabelByOne = new VectorDataViewType(NumberDataViewType.Single, _labelHistogram.Length, 1);
466var isFeaturePresent = ctx.AddIntermediateVariable(new VectorDataViewType(NumberDataViewType.Single, 1, _featureHistogram[0].Length), "isFeaturePresent");
531castOutput = ctx.AddIntermediateVariable(NumberDataViewType.Single, "CastOutput");
549var scoreIndex = ctx.AddIntermediateVariable(new VectorDataViewType(NumberDataViewType.Int64, 1), "ScoreIndex");
576var logOutput = ctx.AddIntermediateVariable(new VectorDataViewType(NumberDataViewType.Single, _featureHistogram[0].Length), "LogOutput");
Standard\MulticlassClassification\OneVersusAllTrainer.cs (24)
195Host.Assert(label.Type.GetKeyCount() > 0 || label.Type == NumberDataViewType.Single || label.Type == NumberDataViewType.Double);
201return MapLabelsCore(NumberDataViewType.UInt32, (in uint val) => key == val, data);
315ivmd.OutputType != NumberDataViewType.Single ||
316ivmd.DistType != NumberDataViewType.Single))
363DistType = new VectorDataViewType(NumberDataViewType.Single, _impl.Predictors.Length);
395DistType = new VectorDataViewType(NumberDataViewType.Single, _impl.Predictors.Length);
520if (mapper.OutputType != NumberDataViewType.Single)
522if (!(mapper.InputType is VectorDataViewType mapperVectorType) || mapperVectorType.ItemType != NumberDataViewType.Single)
546predictorOutputNames[0] = ctx.AddIntermediateVariable(NumberDataViewType.UInt32, $"{DefaultColumnNames.PredictedLabel}_{i}", true);
547predictorOutputNames[1] = ctx.AddIntermediateVariable(NumberDataViewType.Single, $"{DefaultColumnNames.Score}_{i}", true);
548predictorOutputNames[2] = ctx.AddIntermediateVariable(NumberDataViewType.Single, $"{DefaultColumnNames.Probability}_{i}", true);
558var clipOutput = ctx.AddIntermediateVariable(NumberDataViewType.Single, $"ClipOutput_{i}", true);
577var argMaxOutput = ctx.AddIntermediateVariable(NumberDataViewType.Int64, "ArgMaxOutput");
584var addOutput = ctx.AddIntermediateVariable(NumberDataViewType.Int64, "AddOutput");
668var type = new VectorDataViewType(NumberDataViewType.Single, probabilityOutputs.Length);
707return base.IsValid(mapper, ref inputType) && mapper.DistType == NumberDataViewType.Single;
802var sumOutput = ctx.AddIntermediateVariable(NumberDataViewType.Single, "SumOfScores");
816var castIsZeroSumToFloat = ctx.AddIntermediateVariable(NumberDataViewType.Single, "IsSumZeroAsFloat");
822var sumOutputNonZero = ctx.AddIntermediateVariable(NumberDataViewType.Single, "SumOfScoresNonZero");
830divOutputs[i] = ctx.AddIntermediateVariable(NumberDataViewType.Single, $"DivOutput_{i}");
835var type = new VectorDataViewType(NumberDataViewType.Single, divOutputs.Length);
924var type = new VectorDataViewType(NumberDataViewType.Single, probabilityOutputs.Length);
934var sumOutput = ctx.AddIntermediateVariable(NumberDataViewType.Single, "SumOutput");
Standard\SdcaBinary.cs (13)
1534Conversions.DefaultInstance.GetIsDefaultPredicate<float>(NumberDataViewType.Single));
1627NumberDataViewType.Single,
1633NumberDataViewType.Single,
1726NumberDataViewType.Single,
1784NumberDataViewType.Single,
1802NumberDataViewType.Single,
1822Conversions.DefaultInstance.GetIsDefaultPredicate<float>(NumberDataViewType.Single));
2223Conversions.DefaultInstance.GetIsDefaultPredicate<float>(NumberDataViewType.Single));
2303new SchemaShape.Column(DefaultColumnNames.Score, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation())),
2304new SchemaShape.Column(DefaultColumnNames.Probability, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation(true))),
2392new SchemaShape.Column(DefaultColumnNames.Score, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation())),
2446new SchemaShape.Column(DefaultColumnNames.Score, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation())),
2447new SchemaShape.Column(DefaultColumnNames.Probability, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation(true))),
Standard\Simple\SimpleTrainers.cs (13)
65DataViewType IValueMapper.OutputType => NumberDataViewType.Single;
66DataViewType IValueMapperDist.DistType => NumberDataViewType.Single;
81_inputType = new VectorDataViewType(NumberDataViewType.Single);
98_inputType = new VectorDataViewType(NumberDataViewType.Single);
263if (data.Schema.Weight?.Type == NumberDataViewType.Single)
301=> new SchemaShape.Column(featureColumn, SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false);
304=> new SchemaShape.Column(labelColumn, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false);
318new SchemaShape.Column(DefaultColumnNames.Score, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation())),
319new SchemaShape.Column(DefaultColumnNames.Probability, SchemaShape.Column.VectorKind.Scalar, NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.GetTrainerOutputAnnotation(true))),
366_inputType = new VectorDataViewType(NumberDataViewType.Single);
380_inputType = new VectorDataViewType(NumberDataViewType.Single);
442DataViewType IValueMapper.OutputType => NumberDataViewType.Single;
443DataViewType IValueMapperDist.DistType => NumberDataViewType.Single;
Microsoft.ML.Sweeper (2)
Microsoft.ML.TensorFlow (11)
Microsoft.ML.TensorFlow.Tests (2)
Microsoft.ML.TestFramework (25)
DataPipe\TestDataPipe.cs (15)
1070TestHashTransformHelper(_dataFloat, _resultsFloat, NumberDataViewType.Single);
1078TestHashTransformVectorHelper(data, results, NumberDataViewType.Single);
1085TestHashTransformVectorHelper(_dataFloatSparse, results, NumberDataViewType.Single);
1092TestHashTransformVectorHelper(_dataDoubleSparse, results, NumberDataViewType.Double);
1098TestHashTransformHelper(_dataDouble, _resultsDouble, NumberDataViewType.Double);
1106TestHashTransformVectorHelper(data, results, NumberDataViewType.Double);
1109private void TestHashTransformHelper<T>(T[] data, uint[] results, NumberDataViewType type)
1130private void TestHashTransformVectorHelper<T>(T[][] data, uint[][] results, NumberDataViewType type)
1137private void TestHashTransformVectorHelper<T>(VBuffer<T> data, uint[][] results, NumberDataViewType type)
1173builder.AddColumn("Foo", NumberDataViewType.Single, values);
1183builder.AddColumn("Bar", NumberDataViewType.Int32, barValues);
1260builder.AddColumn("Foo", NumberDataViewType.Int32, new int[0]);
1261builder.AddColumn("Bar", NumberDataViewType.UInt16, new ushort[0]);
1544builder.AddColumn("F1V", NumberDataViewType.Single, data);
1601builder.AddColumn(colName, NumberDataViewType.Single, data);
Microsoft.ML.Tests (70)
CalibratedModelParametersTests.cs (5)
126bldr.AddColumn("X1", NumberDataViewType.Single, x1Array);
127bldr.AddColumn("X2Important", NumberDataViewType.Single, x2Array);
128bldr.AddColumn("X3", NumberDataViewType.Single, x3Array);
129bldr.AddColumn("X4Rand", NumberDataViewType.Single, x4RandArray);
130bldr.AddColumn("Label", NumberDataViewType.Single, yArray);
FeatureContributionTests.cs (5)
306bldr.AddColumn("X1", NumberDataViewType.Single, x1Array);
307bldr.AddColumn("X2VBuffer", NumberDataViewType.Single, vbArray);
308bldr.AddColumn("X3Important", NumberDataViewType.Single, x3Array);
309bldr.AddColumn("Label", NumberDataViewType.Single, yArray);
311bldr.AddColumn("GroupId", NumberDataViewType.UInt32, CreateGroupIds(yArray.Length));
PermutationFeatureImportanceTests.cs (11)
849bldr.AddColumn("X1", NumberDataViewType.Single, x1Array);
850bldr.AddColumn("X2Important", NumberDataViewType.Single, x2Array);
851bldr.AddColumn("X3", NumberDataViewType.Single, x3Array);
852bldr.AddColumn("X4Rand", NumberDataViewType.Single, x4RandArray);
853bldr.AddColumn("Label", NumberDataViewType.Single, yArray);
855bldr.AddColumn("GroupId", NumberDataViewType.UInt32, CreateGroupIds(yArray.Length));
930bldr.AddColumn("X1", NumberDataViewType.Single, x1Array);
931bldr.AddColumn("X2VBuffer", NumberDataViewType.Single, vbArray);
932bldr.AddColumn("X3Important", NumberDataViewType.Single, x3Array);
933bldr.AddColumn("Label", NumberDataViewType.Single, yArray);
935bldr.AddColumn("GroupId", NumberDataViewType.UInt32, CreateGroupIds(yArray.Length));
Transformers\HashTests.cs (16)
232HashTestCore((byte)value, NumberDataViewType.Byte, expected, expectedOrdered, expectedOrdered3, expectedCombined, expectedCombinedSparse);
237HashTestCore((ushort)value, NumberDataViewType.UInt16, expected, expectedOrdered, expectedOrdered3, expectedCombined, expectedCombinedSparse);
242HashTestCore((uint)value, NumberDataViewType.UInt32, expected, expectedOrdered, expectedOrdered3, expectedCombined, expectedCombinedSparse);
248HashTestCore((sbyte)value, NumberDataViewType.SByte, expected, expectedOrdered, expectedOrdered3, expectedCombined, expectedCombinedSparse);
250HashTestCore((short)value, NumberDataViewType.Int16, expected, expectedOrdered, expectedOrdered3, expectedCombined, expectedCombinedSparse);
252HashTestCore((int)value, NumberDataViewType.Int32, expected, expectedOrdered, expectedOrdered3, expectedCombined, expectedCombinedSparse);
262HashTestCore(value, NumberDataViewType.UInt64, expected, expectedOrdered, expectedOrdered3, expectedCombined, expectedCombinedSparse);
266HashTestCore((long)value, NumberDataViewType.Int64, expected, expectedOrdered, expectedOrdered3, expectedCombined, expectedCombinedSparse);
302HashTestCore(1f, NumberDataViewType.Single, 463, 855, 732, 56, 557);
303HashTestCore(-1f, NumberDataViewType.Single, 252, 612, 780, 116, 515);
304HashTestCore(0f, NumberDataViewType.Single, 842, 358, 20, 429, 333);
305HashTestCore(float.NaN, NumberDataViewType.Single, 0, 0, 0, 0, 0);
307HashTestCore(1d, NumberDataViewType.Double, 188, 57, 690, 655, 896);
308HashTestCore(-1d, NumberDataViewType.Double, 885, 804, 22, 461, 309);
309HashTestCore(0d, NumberDataViewType.Double, 512, 851, 795, 333, 113);
310HashTestCore(double.NaN, NumberDataViewType.Double, 0, 0, 0, 0, 0);
Microsoft.ML.TimeSeries (35)
SequentialAnomalyDetectionTransformBase.cs (3)
171: base(Contracts.CheckRef(env, nameof(env)).Register(name), windowSize, initialWindowSize, outputColumnName, inputColumnName, new VectorDataViewType(NumberDataViewType.Double, GetOutputLength(alertingScore, env)))
320if (colType != NumberDataViewType.Single)
336info[0] = new DataViewSchema.DetachedColumn(_parent.OutputColumnName, new VectorDataViewType(NumberDataViewType.Double, _parent.OutputLength), meta.ToAnnotations());
SequentialForecastingTransformBase.cs (6)
64confidenceUpperBoundColumn, inputColumnName, new VectorDataViewType(NumberDataViewType.Single, outputLength))
117if (colType != NumberDataViewType.Single)
133info[0] = new DetachedColumn(_parent.OutputColumnName, new VectorDataViewType(NumberDataViewType.Single, _parent._outputLength));
134info[1] = new DetachedColumn(_parent.ConfidenceLowerBoundColumn, new VectorDataViewType(NumberDataViewType.Single, _parent._outputLength));
135info[2] = new DetachedColumn(_parent.ConfidenceUpperBoundColumn, new VectorDataViewType(NumberDataViewType.Single, _parent._outputLength));
140info[0] = new DetachedColumn(_parent.OutputColumnName, new VectorDataViewType(NumberDataViewType.Single, _parent._outputLength));
SrCnnTransformBase.cs (3)
71: base(Contracts.CheckRef(env, nameof(env)).Register(name), windowSize, initialWindowSize, outputColumnName, inputColumnName, new VectorDataViewType(NumberDataViewType.Double, 3))
163if (colType != NumberDataViewType.Single)
179info[0] = new DataViewSchema.DetachedColumn(_parent.OutputColumnName, new VectorDataViewType(NumberDataViewType.Double, _parent.OutputLength), meta.ToAnnotations());
Microsoft.ML.TorchSharp (36)
AutoFormerV2\ObjectDetectionTrainer.cs (14)
457NumberDataViewType.UInt32, true));
465NumberDataViewType.UInt32, true, new SchemaShape(metadata.ToArray()));
468NumberDataViewType.Single, false);
471NumberDataViewType.Single, false, new SchemaShape(scoreMetadata.ToArray()));
490new VectorDataViewType(NumberDataViewType.Single).ToString(), boundingBoxCol.GetTypeString());
528PredictedLabelColumnName = new SchemaShape.Column(Options.PredictedLabelColumnName, SchemaShape.Column.VectorKind.Vector, NumberDataViewType.UInt32, false);
529PredictedBoundingBoxColumn = new SchemaShape.Column(Options.PredictedBoundingBoxColumnName, SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false);
530ConfidenceColumn = new SchemaShape.Column(Options.ScoreColumnName, SchemaShape.Column.VectorKind.Vector, NumberDataViewType.Single, false);
558NumberDataViewType.UInt32, true));
563NumberDataViewType.UInt32, true, predLabelMetadata);
566NumberDataViewType.Single, false);
569NumberDataViewType.Single, false, new SchemaShape(scoreMetadata.ToArray()));
769info[1] = new DataViewSchema.DetachedColumn(_parent.Options.ScoreColumnName, new VectorDataViewType(NumberDataViewType.Single), meta.ToAnnotations());
771info[2] = new DataViewSchema.DetachedColumn(_parent.Options.PredictedBoundingBoxColumnName, new VectorDataViewType(NumberDataViewType.Single));
NasBert\NasBertTrainer.cs (15)
336NumberDataViewType.UInt32, true, new SchemaShape(metadata.ToArray()));
339NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.AnnotationsForMulticlassScoreColumn(labelCol)));
351NumberDataViewType.UInt32, true, new SchemaShape(metadata.ToArray()));
356NumberDataViewType.Single, false);
376if (labelCol.ItemType != NumberDataViewType.UInt32)
378NumberDataViewType.UInt32.ToString(), labelCol.GetTypeString());
392if (labelCol.ItemType != NumberDataViewType.UInt32)
394NumberDataViewType.UInt32.ToString(), labelCol.GetTypeString());
398if (labelCol.ItemType != NumberDataViewType.Single)
400NumberDataViewType.Single.ToString(), labelCol.GetTypeString());
441NumberDataViewType.UInt32, true, predLabelMetadata);
444NumberDataViewType.Single, false, new SchemaShape(AnnotationUtils.AnnotationsForMulticlassScoreColumn(labelAnnotationsColumn)));
449NumberDataViewType.Single, false);
536info[1] = new DataViewSchema.DetachedColumn(Parent.Options.ScoreColumnName, new VectorDataViewType(NumberDataViewType.Single, Parent.Options.NumberOfClasses), meta.ToAnnotations());
556info[0] = new DataViewSchema.DetachedColumn(Parent.Options.ScoreColumnName, NumberDataViewType.Single);
Microsoft.ML.TorchSharp.Tests (4)
Microsoft.ML.Transforms (65)
Microsoft.ML.Vision (7)