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