2 writes to Host
Microsoft.ML.Data (2)
Transforms\TransformBase.cs (2)
33
Host
= env.Register(name);
42
Host
= host;
255 references to Host
Microsoft.ML.Data (255)
DataView\LambdaColumnMapper.cs (11)
111
Host
.Assert(typeDst.RawType == typeof(T3));
112
Host
.AssertValue(map1);
113
Host
.Assert(map2 != null || typeof(T2) == typeof(T3));
127
bldr.AddGetter(AnnotationUtils.Kinds.KeyValues, new VectorDataViewType(TextDataViewType.Instance, _typeDst.GetItemType().GetKeyCountAsInt32(
Host
)), mdGetter);
132
Host
.Assert(vectorSize > 0);
144
Host
.Assert(false, "Shouldn't serialize this!");
145
throw
Host
.ExceptNotSupp("Shouldn't serialize this");
150
Host
.Assert(iinfo == 0);
156
Host
.AssertValueOrNull(ch);
157
Host
.AssertValue(input);
158
Host
.Assert(iinfo == 0);
DataView\LambdaFilter.cs (11)
89
Host
.AssertValue(pred);
90
Host
.Assert(conv != null || typeof(T1) == typeof(T2));
91
Host
.Assert(0 <= colSrc && colSrc < Source.Schema.Count);
100
Host
.Assert(false, "Shouldn't serialize this!");
101
throw
Host
.ExceptNotSupp("Shouldn't serialize this");
106
Host
.AssertValue(predicate);
113
Host
.AssertValueOrNull(rand);
127
Host
.CheckValueOrNull(rand);
134
Host
.AssertNonEmpty(inputs);
145
Host
.AssertValue(predicate);
162
: base(parent.
Host
, input, parent.OutputSchema, active)
DataView\RowToRowMapperTransform.cs (17)
133
Host
.CheckValue(ctx, nameof(ctx));
183
Host
.AssertValue(predicate, "predicate");
194
return new Cursor(
Host
, Source.GetRowCursor(inputCols, rand), this, active);
199
Host
.CheckValueOrNull(rand);
205
Host
.AssertNonEmpty(inputs);
208
inputs = DataViewUtils.CreateSplitCursors(
Host
, inputs[0], n);
209
Host
.AssertNonEmpty(inputs);
213
cursors[i] = new Cursor(
Host
, inputs[i], this, active);
219
Host
.CheckValue(ctx, nameof(ctx));
222
Host
.Check(onnx.CanSaveOnnx(ctx), "Cannot be saved as ONNX.");
229
Host
.CheckValue(ctx, nameof(ctx));
232
Host
.Check(pfa.CanSavePfa, "Cannot be saved as PFA.");
251
Host
.CheckValue(input, nameof(input));
252
Host
.CheckValue(activeColumns, nameof(activeColumns));
253
Host
.Check(input.Schema == Source.Schema, "Schema of input row must be the same as the schema the mapper is bound to");
255
using (var ch =
Host
.Start("GetEntireRow"))
260
Host
.Assert(column.Index < activeArr.Length, $"The columns {activeColumns.Select(c => c.Name)} are not suitable for the OutputSchema.");
Dirty\ChooseColumnsByIndexTransform.cs (9)
200
Host
.CheckValue(options, nameof(options));
208
Host
.AssertValue(ctx);
227
Host
.CheckValue(ctx, nameof(ctx));
240
Host
.AssertValue(predicate);
247
Host
.AssertValueOrNull(rand);
255
return new Cursor(
Host
, _bindings, input, active);
260
Host
.CheckValueOrNull(rand);
269
Host
.AssertNonEmpty(inputs);
274
cursors[i] = new Cursor(
Host
, _bindings, inputs[i], active);
Scorers\BinaryClassifierScorer.cs (8)
186
Host
.CheckValue(ctx, nameof(ctx));
187
Host
.Assert(Bindable is IBindableCanSaveOnnx);
188
Host
.Assert(Bindings.InfoCount >= 2);
193
Host
.Assert(delta == 1);
220
Host
.Assert(predictedLabelCol.HasValue);
234
Host
.AssertValue(output);
235
Host
.Assert(output.Schema == Bindings.RowMapper.OutputSchema);
236
Host
.Assert(output.IsColumnActive(output.Schema[Bindings.ScoreColumnIndex]));
Scorers\ClusteringScorer.cs (1)
103
int keyCount = Bindings.PredColType is KeyDataViewType key ? key.GetCountAsInt32(
Host
) : 0;
Scorers\GenericScorer.cs (17)
157
Host
.CheckValue(args, nameof(args));
158
Host
.AssertValue(data, "data");
159
Host
.AssertValue(mapper, "mapper");
162
Host
.CheckParam(rowMapper != null, nameof(mapper), "mapper should implement ISchemaBoundRowMapper");
212
Host
.CheckValue(ctx, nameof(ctx));
213
Host
.Assert(Bindable is IBindableCanSavePfa);
217
Host
.Assert(_bindings.DerivedColumnCount == 0);
227
Host
.CheckValue(ctx, nameof(ctx));
228
Host
.Assert(Bindable is IBindableCanSaveOnnx);
232
Host
.Assert(_bindings.DerivedColumnCount == 0);
251
Host
.AssertValue(predicate, "predicate");
259
Host
.CheckValue(env, nameof(env));
260
Host
.CheckValue(newSource, nameof(newSource));
267
Host
.Assert(_bindings.DerivedColumnCount == 0);
268
Host
.AssertValue(output);
269
Host
.AssertValue(predicate);
270
Host
.Assert(output.Schema == _bindings.RowMapper.OutputSchema);
Scorers\MulticlassClassificationScorer.cs (6)
564
Host
.AssertValue(output);
565
Host
.Assert(output.Schema == Bindings.RowMapper.OutputSchema);
566
Host
.Assert(output.IsColumnActive(output.Schema[Bindings.ScoreColumnIndex]));
572
int scoreLength = Bindings.PredColType.GetKeyCountAsInt32(
Host
);
578
Host
.Check(score.Length == scoreLength);
589
Host
.Check(score.Length == scoreLength);
Scorers\PredictedLabelScorerBase.cs (26)
281
Host
.CheckValue(args, nameof(args));
282
Host
.CheckNonEmpty(scoreColKind, nameof(scoreColKind));
283
Host
.CheckNonEmpty(scoreColName, nameof(scoreColName));
284
Host
.CheckValue(outputTypeMatches, nameof(outputTypeMatches));
285
Host
.CheckValue(getPredColType, nameof(getPredColType));
288
Host
.CheckParam(rowMapper != null, nameof(mapper), "mapper should implement " + nameof(ISchemaBoundRowMapper));
292
throw
Host
.ExceptParam(nameof(scoreColName), "mapper does not contain a column '{0}'", scoreColName);
295
Host
.Check(outputTypeMatches(scoreType), "Unexpected predictor output type");
315
Host
.AssertValue(ctx);
316
Host
.AssertValue(host);
317
Host
.AssertValue(outputTypeMatches);
318
Host
.AssertValue(getPredColType);
326
Host
.AssertValue(ctx);
332
Host
.CheckValue(ctx, nameof(ctx));
333
Host
.Assert(Bindable is IBindableCanSavePfa);
338
Host
.Assert(delta == 1);
365
Host
.CheckValue(ctx, nameof(ctx));
366
Host
.Assert(Bindable is IBindableCanSaveOnnx);
372
Host
.Assert(delta == 1);
392
Host
.AssertValue(predicate);
400
Host
.Assert(Bindings.DerivedColumnCount == 1);
401
Host
.AssertValue(output);
402
Host
.AssertValue(predicate);
403
Host
.Assert(output.Schema == Bindings.RowMapper.OutputSchema);
404
Host
.Assert(Bindings.InfoCount == output.Schema.Count + 1);
413
Host
.Assert(output.IsColumnActive(output.Schema[Bindings.ScoreColumnIndex]));
Scorers\RowToRowScorerBase.cs (5)
117
Host
.AssertValue(predicate);
139
return new Cursor(
Host
, this, input, active, activeMapperColumns);
144
Host
.CheckValueOrNull(rand);
156
inputs = DataViewUtils.CreateSplitCursors(
Host
, inputs[0], n);
161
cursors[i] = new Cursor(
Host
, this, inputs[i], active, activeMapperColumns);
Transforms\BootstrapSamplingTransformer.cs (8)
81
Host
.CheckValue(options, nameof(options));
82
Host
.CheckUserArg(options.PoolSize >= 0, nameof(options.PoolSize), "Cannot be negative");
85
_state = new TauswortheHybrid.State(options.Seed ?? (uint)
Host
.Rand.Next());
128
Host
.CheckDecode(_poolSize >= 0);
133
Host
.CheckValue(ctx, nameof(ctx));
149
Host
.Assert(_poolSize >= 0);
175
cursor = RowShufflingTransformer.GetShuffledCursor(
Host
, _poolSize, cursor, new TauswortheHybrid(rgen));
196
: base(parent.
Host
, input)
Transforms\GenerateNumberTransform.cs (12)
281
Host
.CheckValue(options, nameof(options));
282
Host
.CheckUserArg(Utils.Size(options.Columns) > 0, nameof(options.Columns));
290
Host
.AssertValue(ctx);
296
Host
.CheckDecode(cbFloat == sizeof(float));
312
Host
.CheckValue(ctx, nameof(ctx));
329
Host
.AssertValue(predicate, "predicate");
339
Host
.AssertValueOrNull(rand);
347
return new Cursor(
Host
, _bindings, input, active);
352
Host
.CheckValueOrNull(rand);
364
Host
.AssertNonEmpty(inputs);
370
cursors[i] = new Cursor(
Host
, _bindings, inputs[i], active);
378
return new DataViewRowCursor[] { new Cursor(
Host
, _bindings, input, active) };
Transforms\LabelConvertTransform.cs (6)
125
Host
.CheckValue(ctx, nameof(ctx));
132
Host
.AssertNonEmpty(Infos);
185
Host
.Assert(0 <= iinfo && iinfo < Infos.Length);
198
Host
.Assert(0 <= iinfo && iinfo < Infos.Length);
199
Host
.AssertValue(Infos[iinfo].SlotTypeSrc);
202
return new SlotCursorImpl(
Host
, cursor, GetSlotTypeCore(iinfo));
Transforms\LabelIndicatorTransform.cs (9)
102
Host
.CheckValue(ctx, nameof(ctx));
137
Host
.AssertNonEmpty(Infos);
138
Host
.Assert(Infos.Length == Utils.Size(options.Columns));
150
Host
.AssertValue(ctx);
151
Host
.AssertNonEmpty(Infos);
163
Host
.Assert(0 <= iinfo && iinfo < Infos.Length);
170
Host
.AssertValue(ch);
181
Host
.AssertValue(ch);
226
throw
Host
.ExceptNotSupp($"Label column type is not supported for binary remapping: {info.TypeSrc}. Supported types: key, float, double.");
Transforms\NAFilter.cs (21)
96
Host
.CheckValue(args, nameof(args));
97
Host
.CheckValue(input, nameof(input));
98
Host
.CheckUserArg(Utils.Size(args.Columns) > 0, nameof(args.Columns));
99
Host
.CheckValue(env, nameof(env));
110
throw
Host
.ExceptUserArg(nameof(args.Columns), "Source column '{0}' not found", src);
112
throw
Host
.ExceptUserArg(nameof(args.Columns), "Source column '{0}' specified multiple times", src);
116
throw
Host
.ExceptUserArg(nameof(args.Columns), $"Column '{src}' has type {type} which does not support missing values, so we cannot filter on them", src);
126
Host
.CheckValue(ctx, nameof(ctx));
134
Host
.CheckDecode(cbFloat == sizeof(Single) || cbFloat == sizeof(Double));
136
Host
.CheckDecode(cinfo > 0);
146
throw
Host
.ExceptSchemaMismatch(nameof(schema), "source", src);
148
throw
Host
.Except("Source column '{0}' specified multiple times", src);
152
throw
Host
.ExceptSchemaMismatch(nameof(schema), "source", src, "scalar or vector of float, double or KeyType", type.ToString());
171
Host
.CheckValue(ctx, nameof(ctx));
180
Host
.Assert(_infos.Length > 0);
202
Host
.AssertValue(predicate);
209
Host
.AssertValueOrNull(rand);
221
Host
.CheckValueOrNull(rand);
228
Host
.AssertNonEmpty(inputs);
239
Host
.AssertValue(predicate);
387
: base(parent.
Host
, input, parent.OutputSchema, active)
Transforms\RangeFilter.cs (17)
98
Host
.CheckValue(options, nameof(options));
102
throw
Host
.ExceptUserArg(nameof(options.Column), "Source column '{0}' not found", options.Column);
104
using (var ch =
Host
.Start("Checking parameters"))
137
Host
.CheckValue(ctx, nameof(ctx));
147
Host
.CheckDecode(cbFloat == sizeof(float));
152
throw
Host
.ExceptSchemaMismatch(nameof(schema), "source", column);
156
throw
Host
.ExceptSchemaMismatch(nameof(schema), "source", column, "Single, Double or Key", _type.ToString());
161
throw
Host
.Except("min", "min must be less than or equal to max");
179
Host
.CheckValue(ctx, nameof(ctx));
193
Host
.Assert(_min < _max);
203
Host
.AssertValue(predicate);
210
Host
.AssertValueOrNull(rand);
223
Host
.CheckValueOrNull(rand);
230
Host
.AssertNonEmpty(inputs);
245
Host
.Assert(_type is KeyDataViewType);
251
Host
.AssertValue(predicate);
275
: base(parent.
Host
, input, parent.OutputSchema, active)
Transforms\RowShufflingTransformer.cs (12)
113
Host
.CheckValue(options, nameof(options));
115
Host
.CheckUserArg(options.PoolRows > 0, nameof(options.PoolRows), "pool size must be positive");
120
Host
.CheckUserArg(!(_poolOnly && _forceShuffleSource),
124
_forceShuffleSeed = options.ForceShuffleSeed ??
Host
.Rand.NextSigned();
132
Host
.AssertValue(ctx);
142
Host
.CheckDecode(_poolRows > 0);
146
Host
.CheckDecode(!(_poolOnly && _forceShuffleSource));
164
Host
.CheckValue(ctx, nameof(ctx));
247
Host
.AssertValue(predicate, "predicate");
253
Host
.AssertValueOrNull(rand);
287
return new Cursor(
Host
, _poolRows, input, rand);
292
Host
.CheckValueOrNull(rand);
Transforms\SkipTakeFilter.cs (9)
91
Host
.Assert(skip >= 0);
92
Host
.Assert(take >= 0);
171
Host
.CheckValue(ctx, nameof(ctx));
178
Host
.Assert(_skip >= 0);
180
Host
.Assert(_take >= 0);
207
Host
.AssertValue(predicate, "predicate");
213
Host
.AssertValueOrNull(rand);
217
return new Cursor(
Host
, input, OutputSchema, activeColumns, _skip, _take);
222
Host
.CheckValueOrNull(rand);
Transforms\TransformBase.cs (50)
67
Host
.CheckValueOrNull(rand);
80
DataViewUtils.TryCreateConsolidatingCursor(out curs, this, columnsNeeded,
Host
, rng))
149
Host
.CheckValue(ctx, nameof(ctx));
178
Host
.CheckValue(input, nameof(input));
179
Host
.CheckValue(activeColumns, nameof(activeColumns));
180
Host
.Check(input.Schema == Source.Schema, "Schema of input row must be the same as the schema the mapper is bound to");
182
using (var ch =
Host
.Start("GetEntireRow"))
320
Contracts.AssertValue(parent.
Host
);
331
var host = parent.
Host
;
368
var host = parent.
Host
;
469
_parent.Metadata.GetMetadata<TValue>(_parent.
Host
, kind, iinfo, ref value);
502
Host
.CheckUserArg(Utils.Size(column) > 0, nameof(column));
503
Host
.CheckValueOrNull(testType);
516
Host
.CheckUserArg(Utils.Size(column) > 0, nameof(column));
517
Host
.CheckValueOrNull(testType);
530
Host
.CheckValue(ctx, nameof(ctx));
531
Host
.CheckValueOrNull(testType);
547
Host
.CheckValueOrNull(checkType);
569
Host
.CheckValue(ctx, nameof(ctx));
575
Host
.CheckValue(ctx, nameof(ctx));
576
Host
.Assert(((ICanSavePfa)this).CanSavePfa);
605
Host
.CheckValue(ctx, nameof(ctx));
606
Host
.Assert(((ICanSaveOnnx)this).CanSaveOnnx(ctx));
641
Host
.AssertValue(ctx);
642
Host
.Assert(0 <= iinfo && iinfo < _bindings.InfoCount);
643
Host
.Assert(Infos[iinfo] == info);
644
Host
.AssertValue(srcToken);
645
Host
.Assert(((ICanSavePfa)this).CanSavePfa);
662
Host
.Assert(0 <= iinfo && iinfo < Infos.Length);
670
Host
.Assert(0 <= iinfo && iinfo < Infos.Length);
682
Host
.Assert(0 <= iinfo && iinfo < Infos.Length);
696
Host
.AssertValue(input);
697
Host
.Assert(0 <= iinfo && iinfo < Infos.Length);
699
Host
.Assert(input.IsColumnActive(input.Schema[src]));
705
Host
.CheckValue(typeDst, nameof(typeDst));
706
Host
.CheckValue(row, nameof(row));
718
Host
.AssertValue(predicate, "predicate");
736
Host
.AssertValueOrNull(rand);
743
return new Cursor(
Host
, this, input, active);
748
Host
.CheckValueOrNull(rand);
754
Host
.AssertNonEmpty(inputs);
757
inputs = DataViewUtils.CreateSplitCursors(
Host
, inputs[0], n);
758
Host
.AssertNonEmpty(inputs);
763
cursors[i] = new Cursor(
Host
, this, inputs[i], active);
773
Host
.Assert(0 <= col && col < _bindings.ColumnCount);
774
return
Host
.ExceptParam(nameof(col), "Bad call to GetSlotCursor on untransposable column '{0}'",
780
Host
.CheckParam(0 <= col && col < _bindings.ColumnCount, nameof(col));
806
Host
.Assert(false);
807
throw
Host
.ExceptNotImpl("Data view indicated it could transpose a column, but apparently it could not");
830
using (var ch =
Host
.Start("CreateGetters"))