2 writes to Host
Microsoft.ML.Data (2)
Dirty\ModelParametersBase.cs (2)
28
Host
= env.Register(name);
36
Host
= env.Register(name);
351 references to Host
Microsoft.ML.Data (2)
Dirty\ModelParametersBase.cs (2)
44
Host
.CheckDecode(cbFloat == sizeof(float), "This file was saved by an incompatible version");
53
Host
.CheckValue(ctx, nameof(ctx));
Microsoft.ML.Ensemble (37)
Trainer\EnsembleDistributionModelParameters.cs (11)
84
Host
.AssertNonEmpty(Models);
92
throw
Host
.Except("Predictor does not implement expected interface");
98
throw
Host
.Except("Predictor input type mismatch");
142
Host
.Check(typeof(TIn) == typeof(VBuffer<Single>));
143
Host
.Check(typeof(TOut) == typeof(Single));
154
Host
.Check(src.Length == _inputType.Size);
178
Host
.Check(typeof(TIn) == typeof(VBuffer<Single>));
179
Host
.Check(typeof(TOut) == typeof(Single));
180
Host
.Check(typeof(TDist) == typeof(Single));
192
Host
.Check(src.Length == _inputType.Size);
216
Host
.AssertValue(_mappers);
Trainer\EnsembleModelParameters.cs (6)
74
Host
.AssertNonEmpty(Models);
82
throw
Host
.Except("Predictor does not implement expected interface");
88
throw
Host
.Except("Predictor input type mismatch");
132
Host
.Check(typeof(TIn) == typeof(VBuffer<Single>));
133
Host
.Check(typeof(TOut) == typeof(Single));
146
Host
.Check(src.Length == _inputType.Size);
Trainer\EnsembleModelParametersBase.cs (11)
32
Host
.Check(Utils.Size(models) > 0, "Ensemble was created with no models.");
33
Host
.Check(weights == null || weights.Length == models.Length);
58
Host
.CheckDecode(count > 0);
61
Host
.CheckDecode(weightCount == 0 || weightCount == count);
68
ctx.LoadModel<IPredictor, SignatureLoadModel>(
Host
, out IPredictor p, string.Format(SubPredictorFmt, i));
70
Host
.Check(predictor != null, "Inner predictor type not compatible with the ensemble type.");
73
Host
.CheckDecode(numMetrics >= 0);
85
ctx.LoadModel<IOutputCombiner<TOutput>, SignatureLoadModel>(
Host
, out Combiner, @"Combiner");
112
Host
.AssertValueOrNull(model.SelectedFeatures);
114
Host
.AssertValueOrNull(model.Metrics);
132
using (var ch =
Host
.Start("SaveAsText"))
Trainer\Multiclass\EnsembleMulticlassModelParameters.cs (9)
65
Host
.AssertNonEmpty(Models);
74
throw
Host
.Except("Predictor does not implement expected interface");
80
throw
Host
.Except("Predictor input type mismatch");
88
Host
.AssertValue(outputType);
112
Host
.Check(typeof(TIn) == typeof(VBuffer<Single>));
113
Host
.Check(typeof(TOut) == typeof(VBuffer<Single>));
123
Host
.Assert(_mappers[i].OutputType.GetVectorSize() > 0);
131
Host
.Check(src.Length == _inputType.Size);
146
Host
.Check(predictions[i].Length == _mappers[i].OutputType.GetVectorSize());
Microsoft.ML.FastTree (76)
FastTree.cs (28)
2839
Host
.CheckValue(trainedEnsemble, nameof(trainedEnsemble));
2840
Host
.CheckParam(numFeatures > 0, nameof(numFeatures), "must be positive");
2841
Host
.CheckValueOrNull(innerArgs);
2882
Host
.CheckDecode(NumFeatures >= 0);
2907
Host
.Assert(NumFeatures >= 0);
2913
Host
.Check(typeof(TIn) == typeof(VBuffer<float>));
2914
Host
.Check(typeof(TOut) == typeof(float));
2924
Host
.Check(src.Length == inputVectorSize);
2926
Host
.Check(src.Length > MaxSplitFeatIdx);
2933
Host
.Check(typeof(TSrc) == typeof(VBuffer<float>));
2934
Host
.Check(typeof(TDst) == typeof(VBuffer<float>));
2935
Host
.Check(top >= 0, "top must be non-negative");
2936
Host
.Check(bottom >= 0, "bottom must be non-negative");
2952
Host
.Check(src.Length == inputVectorSize);
2954
Host
.Check(src.Length > MaxSplitFeatIdx);
2964
Host
.CheckValueOrNull(schema);
2973
Host
.CheckValue(writer, nameof(writer));
2974
Host
.CheckValueOrNull(schema);
2983
Host
.CheckValue(writer, nameof(writer));
2984
var ensembleIni = FastTreeIniFileUtils.TreeEnsembleToIni(
Host
, TrainedEnsemble, schema, calibrator,
2991
Host
.CheckValue(ctx, nameof(ctx));
2992
Host
.CheckValue(input, nameof(input));
3040
Host
.CheckValue(ctx, nameof(ctx));
3041
Host
.Check(Utils.Size(outputNames) >= 1);
3141
Host
.Assert(pair.Value is double);
3180
Host
.AssertValueOrNull(schema);
3395
=> RegressionTreeBaseUtils.RegressionTreeEnsembleAsIDataView(
Host
, TrainedTreeEnsemble.Bias, TrainedTreeEnsemble.TreeWeights, TrainedTreeEnsemble.Trees);
3441
=> RegressionTreeBaseUtils.RegressionTreeEnsembleAsIDataView(
Host
, TrainedTreeEnsemble.Bias, TrainedTreeEnsemble.TreeWeights, TrainedTreeEnsemble.Trees);
GamClassification.cs (1)
250
Host
.CheckValue(ctx, nameof(ctx));
GamModelParameters.cs (43)
67
Host
.CheckValue(binEffects, nameof(binEffects), "May not be null.");
68
Host
.CheckValue(binUpperBounds, nameof(binUpperBounds), "May not be null.");
69
Host
.CheckParam(binUpperBounds.Length == binEffects.Length, nameof(binUpperBounds), "Must have same number of features as binEffects");
70
Host
.CheckParam(binEffects.Length > 0, nameof(binEffects), "Must have at least one entry");
71
Host
.CheckParam(numInputFeatures == -1 || numInputFeatures > 0, nameof(numInputFeatures), "Must be greater than zero");
72
Host
.CheckParam(shapeToInputMap == null || shapeToInputMap.Length == binEffects.Length, nameof(shapeToInputMap), "Must have same number of features as binEffects");
88
Host
.CheckValue(binEffects[i], nameof(binEffects), "Array contained null entries");
89
Host
.CheckParam(binUpperBounds[i].Length == binEffects[i].Length, nameof(binEffects), "Array contained wrong number of effect values");
90
Host
.CheckParam(Utils.IsMonotonicallyIncreasing(binUpperBounds[i]), nameof(binUpperBounds), "Array must be monotonically increasing");
107
Host
.CheckParam(0 <= _shapeToInputMap[i] && _shapeToInputMap[i] < _numInputFeatures, nameof(_shapeToInputMap), "Contains out of range feature value");
108
Host
.CheckParam(!_inputFeatureToShapeFunctionMap.ContainsValue(_shapeToInputMap[i]), nameof(_shapeToInputMap), "Contains duplicate mappings");
119
Host
.CheckValue(ctx, nameof(ctx));
124
Host
.CheckDecode(NumberOfShapeFunctions >= 0);
126
Host
.CheckDecode(_numInputFeatures >= 0);
138
Host
.CheckDecode(Utils.Size(_binEffects[i]) >= 1);
146
Host
.CheckDecode(len >= 0);
153
Host
.CheckDecode(0 <= key && key < _numInputFeatures);
155
Host
.CheckDecode(0 <= val && val < NumberOfShapeFunctions);
156
Host
.CheckDecode(!_inputFeatureToShapeFunctionMap.ContainsKey(key));
157
Host
.CheckDecode(_shapeToInputMap[val] == -1);
168
Host
.CheckValue(ctx, nameof(ctx));
171
Host
.Assert(NumberOfShapeFunctions >= 0);
173
Host
.Assert(_numInputFeatures >= 0);
183
Host
.Assert(_binUpperBounds[i].Length == _binEffects[i].Length);
195
Host
.Check(typeof(TIn) == typeof(VBuffer<float>), "Input type does not match.");
196
Host
.Check(typeof(TOut) == typeof(float), "Output type does not match.");
204
Host
.CheckParam(features.Length == _numInputFeatures, nameof(features), "Bad length of input");
235
Host
.CheckParam(features.Length == _numInputFeatures, nameof(features));
236
Host
.CheckParam(Utils.Size(bins) == NumberOfShapeFunctions, nameof(bins));
268
Host
.Assert(0 <= featureIndex && featureIndex < NumberOfShapeFunctions, "Index out of range.");
275
Host
.Check(0 <= featureIndex && featureIndex < NumberOfShapeFunctions, "Index out of range.");
287
Host
.Check(0 <= featureIndex && featureIndex < NumberOfShapeFunctions, "Index out of range.");
325
Host
.Check(0 <= featureIndex && featureIndex < NumberOfShapeFunctions, "Index out of range.");
358
Host
.CheckValue(writer, nameof(writer), "writer must not be null.");
359
Host
.CheckValueOrNull(schema);
405
Host
.Check(typeof(TSrc) == typeof(VBuffer<float>), "Source type does not match.");
406
Host
.Check(typeof(TDstContributions) == typeof(VBuffer<float>), "Destination type does not match.");
438
Host
.CheckValue(writer, nameof(writer), "writer must not be null");
446
Host
.Check(effects.Length == binThresholds.Length, "Effects array must be same length as binUpperBounds array.");
468
Host
, ensemble, schema, calibrator, string.Empty, false, false);
491
Host
.Assert(internalNodeId == 0);
506
Host
.Assert(lower == upper + 1);
679
var builder = new ArrayDataViewBuilder(pred.
Host
);
GamRegression.cs (1)
195
Host
.CheckValue(ctx, nameof(ctx));
RandomForestRegression.cs (3)
236
Host
.Check(src.Length == inputVectorSize);
238
Host
.Check(src.Length > MaxSplitFeatIdx);
262
Host
.CheckNonEmpty(quantiles, nameof(quantiles));
Microsoft.ML.KMeansClustering (15)
KMeansModelParameters.cs (15)
78
Host
.CheckParam(k > 0, nameof(k), "Need at least one cluster");
79
Host
.CheckParam(Utils.Size(centroids) >= k, nameof(centroids), "Not enough centroids for predictor initialization");
80
Host
.CheckParam(centroids[0].Length > 0, nameof(centroids), "Centroid vectors should have at least one length");
89
Host
.CheckParam(centroids[i].Length == _dimensionality,
91
Host
.CheckParam(FloatUtils.IsFinite(centroids[i].GetValues()),
122
Host
.CheckDecode(_k > 0);
124
Host
.CheckDecode(_dimensionality > 0);
133
Host
.CheckDecode(0 <= count && count <= _dimensionality);
136
Host
.CheckDecode(FloatUtils.IsFinite(values));
139
WarnOnOldNormalizer(ctx, GetType(),
Host
);
149
Host
.Check(typeof(TIn) == typeof(VBuffer<float>));
150
Host
.Check(typeof(TOut) == typeof(VBuffer<float>));
156
throw
Host
.Except($"Incorrect number of features: expected {_dimensionality}, got {src.Length}");
167
Host
.Assert(distances.Length >= _k);
185
Host
.Assert(_dimensionality == _centroids[i].Length);
Microsoft.ML.Mkl.Components (3)
OlsLinearRegression.cs (3)
818
Host
.CheckDecode(Weight.IsDense);
827
Host
.CheckDecode(!Double.IsNaN(RSquaredAdjusted) || !hasStats);
833
Host
.CheckDecode(FloatUtils.IsFinite(_standardErrors[i]) && _standardErrors[i] >= 0);
Microsoft.ML.PCA (11)
PcaTrainer.cs (11)
464
Host
.CheckParam(_eigenVectors[i].GetValues().All(FloatUtils.IsFinite),
486
Host
.CheckDecode(FloatUtils.IsFinite(_dimension));
489
Host
.CheckDecode(FloatUtils.IsFinite(_rank));
495
Host
.CheckDecode(meanArray.All(FloatUtils.IsFinite));
510
Host
.CheckDecode(vi.All(FloatUtils.IsFinite));
514
WarnOnOldNormalizer(ctx, GetType(),
Host
);
589
var bldr = new ArrayDataViewBuilder(
Host
);
619
Host
.Check(typeof(TIn) == typeof(VBuffer<float>));
620
Host
.Check(typeof(TOut) == typeof(float));
625
Host
.Check(src.Length == _dimension);
633
Host
.Assert(src.Length == _dimension);
Microsoft.ML.StandardTrainers (199)
FactorizationMachine\FieldAwareFactorizationMachineModelParameters.cs (27)
79
Host
.Assert(fieldCount > 0);
80
Host
.Assert(featureCount > 0);
81
Host
.Assert(latentDim > 0);
82
Host
.Assert(Utils.Size(linearWeights) == featureCount);
84
Host
.Assert(Utils.Size(latentWeights) == checked(featureCount * fieldCount * LatentDimAligned));
114
Host
.Assert(fieldCount > 0);
115
Host
.Assert(featureCount > 0);
116
Host
.Assert(latentDim > 0);
117
Host
.Assert(Utils.Size(linearWeights) == featureCount);
119
Host
.Assert(latentWeightsAligned.Size == checked(featureCount * fieldCount * LatentDimAligned));
131
Host
.AssertValue(ctx);
143
Host
.CheckDecode(fieldCount > 0);
145
Host
.CheckDecode(featureCount > 0);
147
Host
.CheckDecode(latentDim > 0);
149
Host
.Check(checked(featureCount * fieldCount * LatentDimAligned) <= Utils.ArrayMaxSize, "Latent dimension too large");
151
Host
.CheckDecode(Utils.Size(linearWeights) == featureCount);
153
Host
.CheckDecode(Utils.Size(latentWeights) == featureCount * fieldCount * latentDim);
188
Host
.AssertValue(ctx);
202
Host
.Assert(FieldCount > 0);
203
Host
.Assert(FeatureCount > 0);
204
Host
.Assert(LatentDimension > 0);
205
Host
.Assert(Utils.Size(_linearWeights) == FeatureCount);
206
Host
.Assert(_latentWeightsAligned.Size == FeatureCount * FieldCount * LatentDimAligned);
244
Host
.AssertValue(_linearWeights);
245
Host
.AssertValue(linearWeights);
251
Host
.AssertValue(_latentWeightsAligned);
252
Host
.AssertValue(latentWeights);
LdSvm\LdSvmModelParameters.cs (47)
58
Host
.Assert(treeDepth > 0 && treeDepth < 31);
61
Host
.Assert(w.Length == numLeaf * 2 - 1);
62
Host
.Assert(w.All(v => v.IsDense));
63
Host
.Assert(w.All(v => v.Length == w[0].Length));
64
Host
.Assert(thetaPrime.Length == numLeaf * 2 - 1);
65
Host
.Assert(thetaPrime.All(v => v.IsDense));
66
Host
.Assert(thetaPrime.All(v => v.Length == thetaPrime[0].Length));
67
Host
.Assert(theta.Length == numLeaf - 1);
68
Host
.Assert(theta.All(v => v.IsDense));
69
Host
.Assert(theta.All(v => v.Length == theta[0].Length));
70
Host
.Assert(biasW.Length == numLeaf * 2 - 1);
71
Host
.Assert(biasTheta.Length == numLeaf - 1);
72
Host
.Assert(biasThetaPrime.Length == numLeaf * 2 - 1);
73
Host
.Assert((w[0].Length > 0) && (w[0].Length == thetaPrime[0].Length) && (w[0].Length == theta[0].Length));
107
Host
.CheckDecode(_numLeaf > 1 && (_numLeaf & (_numLeaf - 1)) == 0);
109
Host
.CheckDecode(numFeatures > 0);
119
WarnOnOldNormalizer(ctx, GetType(),
Host
);
128
Host
.Assert(_numLeaf > 1 && (_numLeaf & (_numLeaf - 1)) == 0); // Check if _numLeaf is power of 2
129
Host
.Assert(_w.Length == _numLeaf * 2 - 1);
130
Host
.Assert(_w.All(v => v.IsDense));
131
Host
.Assert(_w.All(v => v.Length == _w[0].Length));
132
Host
.Assert(_thetaPrime.Length == _numLeaf * 2 - 1);
133
Host
.Assert(_thetaPrime.All(v => v.IsDense));
134
Host
.Assert(_thetaPrime.All(v => v.Length == _thetaPrime[0].Length));
135
Host
.Assert(_theta.Length == _numLeaf - 1);
136
Host
.Assert(_theta.All(v => v.IsDense));
137
Host
.Assert(_theta.All(v => v.Length == _theta[0].Length));
138
Host
.Assert(_biasW.Length == _numLeaf * 2 - 1);
139
Host
.Assert(_biasTheta.Length == _numLeaf - 1);
140
Host
.Assert(_biasThetaPrime.Length == _numLeaf * 2 - 1);
141
Host
.Assert((_w[0].Length > 0) && (_w[0].Length == _thetaPrime[0].Length) && (_w[0].Length == _theta[0].Length)); // numFeatures
142
Host
.Assert(InputType != null && InputType.GetVectorSize() == _w[0].Length);
186
Host
.Assert(_w.Length == _numLeaf * 2 - 1);
188
Host
.Assert(_thetaPrime.Length == _numLeaf * 2 - 1);
190
Host
.Assert(_theta.Length == _numLeaf - 1);
193
Host
.Assert(_biasW.Length == _numLeaf * 2 - 1);
195
Host
.Assert(_biasTheta.Length == _numLeaf - 1);
197
Host
.Assert(_biasThetaPrime.Length == _numLeaf * 2 - 1);
215
Host
.Assert(vector.IsDense);
216
Host
.Assert(vector.Length == vectorLength);
230
Host
.Assert(length >= 0);
231
Host
.Assert(vectorLength >= 0);
238
Host
.Assert(result[i].IsDense);
239
Host
.Assert(result[i].Length == vectorLength);
270
Host
.Check(typeof(TIn) == typeof(VBuffer<float>));
271
Host
.Check(typeof(TOut) == typeof(float));
276
Host
.Check(src.Length == InputType.GetVectorSize());
Standard\LinearModelParameters.cs (36)
123
Host
.CheckParam(FloatUtils.IsFinite(weights.GetValues()), nameof(weights), "Cannot initialize linear predictor with non-finite weights");
124
Host
.CheckParam(FloatUtils.IsFinite(bias), nameof(bias), "Cannot initialize linear predictor with non-finite bias");
138
Host
.CheckValue(ctx, nameof(ctx));
139
Host
.Check(Utils.Size(outputs) >= 1);
169
Host
.CheckDecode(FloatUtils.IsFinite(Bias));
172
Host
.Assert(len > 0);
175
Host
.CheckDecode(0 <= cind && cind < len);
182
Host
.CheckDecode(prev < indices[i]);
185
Host
.CheckDecode(prev < len);
192
Host
.CheckDecode(cwht == cind || (cind == 0 && cwht == len));
195
Host
.CheckDecode(Utils.Size(weights) == 0 || weights.All(x => FloatUtils.IsFinite(x)));
203
WarnOnOldNormalizer(ctx, GetType(),
Host
);
233
Host
.CheckValue(ctx, nameof(ctx));
234
Host
.CheckValue(input, nameof(input));
354
Host
.CheckValue(writer, nameof(writer));
355
Host
.CheckValue(schema, nameof(schema));
362
Host
.CheckValue(writer, nameof(writer));
363
Host
.CheckValue(schema, nameof(schema));
470
ctx.LoadModelOrNull<LinearModelParameterStatistics, SignatureLoadModel>(
Host
, out stats, ModelStatsSubModelFilename);
476
ctx.LoadModelOrNull<ModelStatisticsBase, SignatureLoadModel>(
Host
, out stats, ModelStatsSubModelFilename);
520
return new LinearBinaryModelParameters(
Host
, in weights, bias);
525
Host
.CheckValue(schema, nameof(schema));
538
Host
.CheckValue(schema, nameof(schema));
559
Host
.CheckValue(writer, nameof(writer));
560
Host
.CheckValue(schema, nameof(schema));
561
Host
.CheckValueOrNull(calibrator);
594
throw
Host
.ExceptNotImpl("Saving calibrators is not implemented yet.");
596
Host
.CheckValue(writer, nameof(writer));
597
Host
.CheckValue(schema, nameof(schema));
660
Host
.CheckValue(writer, nameof(writer));
661
Host
.CheckValue(schema, nameof(schema));
677
return new LinearRegressionModelParameters(
Host
, in weights, bias);
683
Host
.CheckValue(schema, nameof(schema));
761
Host
.CheckValue(writer, nameof(writer));
762
Host
.CheckValue(schema, nameof(schema));
778
return new PoissonRegressionModelParameters(
Host
, in weights, bias);
Standard\LogisticRegression\MulticlassLogisticRegression.cs (38)
552
Host
.CheckDecode(NumberOfFeatures >= 1);
555
Host
.CheckDecode(NumberOfClasses >= 1);
565
Host
.CheckDecode(numIndices == 0);
567
Host
.CheckDecode(numWeights == NumberOfClasses * NumberOfFeatures);
579
Host
.CheckDecode(numStarts == NumberOfClasses + 1);
581
Host
.CheckDecode(starts[0] == 0);
582
Host
.CheckDecode(Utils.IsMonotonicallyIncreasing(starts));
585
Host
.CheckDecode(numIndices == starts[starts.Length - 1]);
591
Host
.CheckDecode(Utils.IsIncreasing(0, indices[i], NumberOfFeatures));
595
Host
.CheckDecode(numValues == numIndices);
604
WarnOnOldNormalizer(ctx, GetType(),
Host
);
618
ctx.LoadModelOrNull<ModelStatisticsBase, SignatureLoadModel>(
Host
, out stats, ModelStatsSubModelFilename);
629
Host
.Assert(Biases.Length == NumberOfClasses);
630
Host
.Assert(Biases.Length == Weights.Length);
633
Host
.Assert(fw.Length == NumberOfFeatures);
664
Host
.Assert(fv.Length == NumberOfFeatures);
714
Host
.Assert(count == numIndices);
741
Host
.Assert(count == numIndices);
769
Host
.Check(typeof(TSrc) == typeof(VBuffer<float>), "Invalid source type in GetMapper");
770
Host
.Check(typeof(TDst) == typeof(VBuffer<float>), "Invalid destination type in GetMapper");
775
Host
.Check(src.Length == NumberOfFeatures);
784
Host
.Check(src.Length == NumberOfFeatures, "src length should equal the number of features");
819
Host
.AssertValue(_weightsDense);
834
Host
.CheckValueOrNull(schema);
878
Host
.Assert(namedValues.Value is float);
906
Host
.CheckValue(writer, nameof(writer));
907
Host
.CheckValueOrNull(schema);
937
Host
.CheckValue(ctx, nameof(ctx));
938
Host
.CheckValue(input, nameof(input));
980
Host
.CheckValue(ctx, nameof(ctx));
985
Host
.Assert(outputs[0] == DefaultColumnNames.PredictedLabel);
986
Host
.Assert(outputs[1] == DefaultColumnNames.Score);
1052
Host
.Assert(featuresCount == Weights[i].Length);
1073
Host
.CheckDecode(0 <= id && id < Utils.Size(ctx.Strings));
1075
Host
.CheckDecode(str.Length > 0);
1089
Host
.AssertValue(_labelNames[i]);
1096
var bldr = new ArrayDataViewBuilder(
Host
);
1241
Host
.Assert(dst.Length == NumberOfClasses);
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (11)
294
Host
.AssertValue(labelHistogram);
295
Host
.AssertValue(featureHistogram);
296
Host
.Assert(labelHistogram.Length == featureHistogram.Length);
297
Host
.Assert(featureHistogram.All(h => h == null || h.Length == featureCount));
331
Host
.CheckDecode(labelCount >= 0);
334
Host
.CheckDecode(_featureCount >= 0);
345
Host
.CheckDecode(_featureHistogram[iLabel][iFeature] >= 0);
412
Host
.Check(typeof(TIn) == typeof(VBuffer<float>));
413
Host
.Check(typeof(TOut) == typeof(VBuffer<float>));
591
Host
.Assert(featureCount >= 0);
598
Host
.Check(src.Length == _featureCount, "Invalid number of features passed.");
Standard\MulticlassClassification\OneVersusAllTrainer.cs (16)
359
Host
.AssertValue(impl, nameof(impl));
360
Host
.Assert(Utils.Size(impl.Predictors) > 0);
374
Host
.CheckDecode(len > 0);
379
LoadPredictors(
Host
, predictors, ctx);
385
LoadPredictors(
Host
, predictors, ctx);
391
LoadPredictors(
Host
, predictors, ctx);
434
Host
.CheckValue(ctx, nameof(ctx));
435
Host
.CheckValue(input, nameof(input));
450
Host
.Check(typeof(TIn) == typeof(VBuffer<float>));
451
Host
.Check(typeof(TOut) == typeof(VBuffer<float>));
458
Host
.CheckValue(writer, nameof(writer));
459
Host
.CheckValue(schema, nameof(schema));
467
Host
.Check(saveInSourceCode != null, "Saving in code is not supported.");
478
Host
.CheckValue(writer, nameof(writer));
479
Host
.CheckValue(schema, nameof(schema));
486
Host
.Check(saveInText != null, "Saving in text is not supported.");
Standard\MulticlassClassification\PairwiseCouplingTrainer.cs (20)
265
Host
.Assert(Utils.Size(predictors) > 0);
273
Host
.Assert(Utils.Size(predictors[i]) == i + 1);
276
Host
.Assert(index == GetIndex(i, j));
280
Host
.Assert(index == _predictors.Length);
292
Host
.CheckDecode(_numClasses > 0);
295
Host
.CheckDecode(count <= int.MaxValue);
304
Host
.Assert(index == GetIndex(i, j));
305
ctx.LoadModel<TDistPredictor, SignatureLoadModel>(
Host
, out _predictors[index++], string.Format(SubPredictorFmt2, i, j));
307
Host
.Assert(index == GetIndex(i, i));
308
ctx.LoadModel<TDistPredictor, SignatureLoadModel>(
Host
, out _predictors[index++], string.Format(SubPredictorFmt, i));
321
Host
.Check(IsValid(vmd, ref inputType), "Predictor doesn't implement the expected interface");
381
Host
.Assert(0 <= value && value <= 1);
414
Host
.Assert(index == GetIndex(j, i));
435
Host
.Assert(values[index + j] >= pii);
442
Host
.Assert(index == GetIndex(j, i));
443
Host
.Assert(values[index] >= pii);
454
Host
.Assert(0 <= j && j <= i && i < _numClasses);
460
Host
.Check(typeof(TIn) == typeof(VBuffer<float>));
461
Host
.Check(typeof(TOut) == typeof(VBuffer<float>));
472
Host
.Check(src.Length == _inputType.Size);
Standard\Simple\SimpleTrainers.cs (4)
361
Host
.Check(!float.IsNaN(prob));
376
Host
.CheckDecode(!float.IsNaN(_prob));
405
Host
.CheckValue(ctx, nameof(ctx));
406
Host
.Check(Utils.Size(outputs) >= 3);
Microsoft.ML.Vision (8)
ImageClassificationTrainer.cs (8)
1362
Host
.AssertValue(session);
1363
Host
.Assert(classCount > 1);
1364
Host
.AssertNonEmpty(imagePreprocessorTensorInput);
1365
Host
.AssertNonEmpty(imagePreprocessorTensorOutput);
1366
Host
.AssertNonEmpty(graphInputTensor);
1367
Host
.AssertNonEmpty(graphOutputTensor);
1475
Host
.Check(typeof(TSrc) == typeof(VBuffer<byte>));
1476
Host
.Check(typeof(TDst) == typeof(VBuffer<float>));