3 instantiations of HashingEstimator
Microsoft.ML.Data (3)
DataLoadSave\DataOperationsCatalog.cs (1)
574
data = new
HashingEstimator
(env, columnOptions).Fit(data).Transform(data);
Transforms\ConversionsExtensionsCatalog.cs (2)
47
=> new
HashingEstimator
(CatalogUtils.GetEnvironment(catalog), outputColumnName, inputColumnName, numberOfBits, maximumNumberOfInverts);
66
=> new
HashingEstimator
(CatalogUtils.GetEnvironment(catalog), columns);
106 references to HashingEstimator
Microsoft.ML.Data (43)
DataLoadSave\DataOperationsCatalog.cs (2)
572
new
HashingEstimator
.ColumnOptions(splitColumnName, hashInputColumnName, 30, (uint)seedToUse.Value, combine: true) :
573
new
HashingEstimator
.ColumnOptions(splitColumnName, hashInputColumnName, 30, combine: true);
Transforms\ConversionsExtensionsCatalog.cs (6)
13
using static Microsoft.ML.Transforms.
HashingEstimator
;
15
using HashDefaults =
HashingEstimator
.Defaults;
23
/// Create a <see cref="
HashingEstimator
"/>, which hashes the data from the column specified in <paramref name="inputColumnName"/>
45
public static
HashingEstimator
Hash(this TransformsCatalog.ConversionTransforms catalog, string outputColumnName, string inputColumnName = null,
50
/// Create a <see cref="
HashingEstimator
"/>, which hashes the input column's data type <see cref="ColumnOptions.InputColumnName" />
65
public static
HashingEstimator
Hash(this TransformsCatalog.ConversionTransforms catalog, params ColumnOptions[] columns)
Transforms\Hashing.cs (35)
33
/// <see cref="ITransformer"/> resulting from fitting a <see cref="
HashingEstimator
"/>.
45
public int NumberOfBits =
HashingEstimator
.Defaults.NumberOfBits;
48
public uint Seed =
HashingEstimator
.Defaults.Seed;
52
public bool Ordered =
HashingEstimator
.Defaults.UseOrderedHashing;
56
public int MaximumNumberOfInverts =
HashingEstimator
.Defaults.MaximumNumberOfInverts;
59
public bool Combine =
HashingEstimator
.Defaults.Combine;
141
private readonly
HashingEstimator
.ColumnOptions[] _columns;
143
internal IReadOnlyCollection<
HashingEstimator
.ColumnOptions> Columns => _columns;
151
if (!
HashingEstimator
.IsColumnTypeValid(type))
152
throw Host.ExceptParam(nameof(inputSchema),
HashingEstimator
.ExpectedColumnType);
155
private static (string outputColumnName, string inputColumnName)[] GetColumnPairs(
HashingEstimator
.ColumnOptions[] columns)
161
private DataViewType GetOutputType(DataViewSchema inputSchema,
HashingEstimator
.ColumnOptions column)
178
internal HashingTransformer(IHostEnvironment env, params
HashingEstimator
.ColumnOptions[] columns) :
185
throw Host.ExceptParam(nameof(columns), $"Found column with {nameof(column.MaximumNumberOfInverts)} set to non zero value, please use {nameof(
HashingEstimator
)} instead");
188
throw Host.ExceptParam(nameof(
HashingEstimator
.ColumnOptions.Combine), "When the 'Combine' option is specified, ordered hashing is not supported.");
192
internal HashingTransformer(IHostEnvironment env, IDataView input, params
HashingEstimator
.ColumnOptions[] columns) :
292
_columns = new
HashingEstimator
.ColumnOptions[columnsLength];
295
_columns[i] = new
HashingEstimator
.ColumnOptions(ColumnPairs[i].outputColumnName, ColumnPairs[i].inputColumnName, ctx);
334
var cols = new
HashingEstimator
.ColumnOptions[options.Columns.Length];
338
cols[i] = new
HashingEstimator
.ColumnOptions(
352
Host.Assert(
HashingEstimator
.IsColumnTypeValid(srcType));
404
Host.Assert(
HashingEstimator
.IsColumnTypeValid(srcType.ItemType));
466
Host.Assert(
HashingEstimator
.IsColumnTypeValid(srcType));
1483
private readonly
HashingEstimator
.ColumnOptions _ex;
1487
private InvertHashHelper(DataViewRow row,
HashingEstimator
.ColumnOptions ex)
1508
public static InvertHashHelper Create(DataViewRow row,
HashingEstimator
.ColumnOptions ex, int invertHashMaxCount, Delegate dstGetter)
1519
var consTypes = new Type[] { typeof(DataViewRow), typeof(
HashingEstimator
.ColumnOptions), typeof(int), typeof(Delegate) };
1596
protected Impl(DataViewRow row,
HashingEstimator
.ColumnOptions ex, int invertHashMaxCount)
1629
public ImplOne(DataViewRow row,
HashingEstimator
.ColumnOptions ex, int invertHashMaxCount, Delegate dstGetter)
1663
public ImplVec(DataViewRow row,
HashingEstimator
.ColumnOptions ex, int invertHashMaxCount, Delegate dstGetter)
1697
public ImplVecOrdered(DataViewRow row,
HashingEstimator
.ColumnOptions ex, int invertHashMaxCount, Delegate dstGetter)
1763
/// <seealso cref="ConversionsExtensionsCatalog.Hash(TransformsCatalog.ConversionTransforms,
HashingEstimator
.ColumnOptions[])"/>
1901
/// Initializes a new instance of <see cref="
HashingEstimator
"/>.
1923
/// Initializes a new instance of <see cref="
HashingEstimator
"/>.
1931
_host = env.Register(nameof(
HashingEstimator
));
Microsoft.ML.IntegrationTests (1)
DataTransformation.cs (1)
12
using static Microsoft.ML.Transforms.
HashingEstimator
;
Microsoft.ML.PerformanceTests (1)
HashBench.cs (1)
86
var info = new
HashingEstimator
.ColumnOptions("Bar", "Foo", numberOfBits: numberOfBits);
Microsoft.ML.Samples (3)
Dynamic\Transforms\Conversion\HashWithOptions.cs (3)
45
var
pipeline = mlContext.Transforms.Conversion.Hash(
48
new
HashingEstimator
.ColumnOptions(
55
new
HashingEstimator
.ColumnOptions(
Microsoft.ML.TestFramework (2)
DataPipe\TestDataPipe.cs (2)
1116
var hashTransform = new HashingTransformer(Env, new
HashingEstimator
.ColumnOptions("F1", "F1", 5, 42)).Transform(srcView);
1147
var hashTransform = new HashingTransformer(Env, new
HashingEstimator
.ColumnOptions("F1V", "F1V", 5, 42)).Transform(srcView);
Microsoft.ML.Tests (29)
OnnxConversionTest.cs (3)
1042
var
pipeline = ML.Transforms.Conversion.Hash("ValueHashed", "Value");
1078
var
pipeline = new HashingEstimator(Env, "Value", useOrderedHashing: useOrderedHashing, numberOfBits: numberOfBits);
1129
var
pipeline = new HashingEstimator(Env, "Value", useOrderedHashing: false, numberOfBits: numberOfBits);
Transformers\HashTests.cs (26)
51
var
pipe = ML.Transforms.Conversion.Hash(new[]{
52
new
HashingEstimator
.ColumnOptions("HashA", "A", numberOfBits:4, maximumNumberOfInverts:-1),
53
new
HashingEstimator
.ColumnOptions("HashB", "B", numberOfBits:3, useOrderedHashing:true),
54
new
HashingEstimator
.ColumnOptions("HashC", "C", seed:42),
55
new
HashingEstimator
.ColumnOptions("HashD", "A"),
73
var
pipe = ML.Transforms.Conversion.Hash(new[] {
74
new
HashingEstimator
.ColumnOptions("HashA", "A", maximumNumberOfInverts:1, numberOfBits:10),
75
new
HashingEstimator
.ColumnOptions("HashAUnlim", "A", maximumNumberOfInverts:-1, numberOfBits:10),
76
new
HashingEstimator
.ColumnOptions("HashAUnlimOrdered", "A", maximumNumberOfInverts:-1, numberOfBits:10, useOrderedHashing:true)
113
var
pipe = ML.Transforms.Conversion.Hash(new[]{
114
new
HashingEstimator
.ColumnOptions("HashA", "A", numberOfBits:4, maximumNumberOfInverts:-1),
115
new
HashingEstimator
.ColumnOptions("HashB", "B", numberOfBits:3, useOrderedHashing:true),
116
new
HashingEstimator
.ColumnOptions("HashC", "C", seed:42),
117
new
HashingEstimator
.ColumnOptions("HashD" ,"A"),
138
ValueGetter<TType> hashGetter<TType>(
HashingEstimator
.ColumnOptions colInfo)
149
var info = new
HashingEstimator
.ColumnOptions("Bar", "Foo", numberOfBits: bits);
156
info = new
HashingEstimator
.ColumnOptions("Bar", "Foo", numberOfBits: bits, useOrderedHashing: true);
169
info = new
HashingEstimator
.ColumnOptions("Bar", "Foo", numberOfBits: bits, useOrderedHashing: false);
179
info = new
HashingEstimator
.ColumnOptions("Bar", "Foo", numberOfBits: bits, useOrderedHashing: true);
189
info = new
HashingEstimator
.ColumnOptions("Bar", "Foo", numberOfBits: bits, combine: true);
200
info = new
HashingEstimator
.ColumnOptions("Bar", "Foo", numberOfBits: bits, useOrderedHashing: false);
209
info = new
HashingEstimator
.ColumnOptions("Bar", "Foo", numberOfBits: bits, useOrderedHashing: true);
217
info = new
HashingEstimator
.ColumnOptions("Bar", "Foo", numberOfBits: bits, combine: true);
385
new
HashingEstimator
.ColumnOptions("AHashed", "A"),
386
new
HashingEstimator
.ColumnOptions("DHashed", "D"),
387
new
HashingEstimator
.ColumnOptions("DHashedCombined", "D", combine: true)));
Microsoft.ML.Transforms (27)
Dracula\CountTargetEncodingTransformer.cs (21)
86
public int NumberOfBits =
HashingEstimator
.NumBitsLim - 1;
119
private readonly
HashingEstimator
.ColumnOptions[] _hashingColumns;
120
private readonly
HashingEstimator
_hashingEstimator;
124
int numberOfBits =
HashingEstimator
.Defaults.NumberOfBits,
125
bool combine =
HashingEstimator
.Defaults.Combine, uint hashingSeed =
HashingEstimator
.Defaults.Seed)
133
CountTableBuilderBase countTableBuilder, int numberOfBits =
HashingEstimator
.Defaults.NumberOfBits,
134
bool combine =
HashingEstimator
.Defaults.Combine, uint hashingSeed =
HashingEstimator
.Defaults.Seed)
250
private
HashingEstimator
.ColumnOptions[] InitializeHashingColumnOptions(CountTableEstimator.ColumnOptionsBase[] columns, int numberOfBits, bool combine, uint hashingSeed)
252
var cols = new
HashingEstimator
.ColumnOptions[columns.Length];
256
cols[i] = new
HashingEstimator
.ColumnOptions(column.Name, column.InputColumnName,
262
private
HashingEstimator
.ColumnOptions[] InitializeHashingColumnOptions(Options options)
265
var cols = new
HashingEstimator
.ColumnOptions[columns.Length];
269
cols[i] = new
HashingEstimator
.ColumnOptions(column.Name, column.Source,
437
int numberOfBits =
HashingEstimator
.Defaults.NumberOfBits,
438
bool combine =
HashingEstimator
.Defaults.Combine,
439
uint hashingSeed =
HashingEstimator
.Defaults.Seed)
506
int numberOfBits =
HashingEstimator
.Defaults.NumberOfBits,
507
bool combine =
HashingEstimator
.Defaults.Combine,
508
uint hashingSeed =
HashingEstimator
.Defaults.Seed)
OneHotHashEncoding.cs (4)
169
internal OneHotHashEncodingTransformer(
HashingEstimator
hash, IEstimator<ITransformer> keyToVector, IDataView input)
269
public readonly
HashingEstimator
.ColumnOptions HashingOptions;
292
HashingOptions = new
HashingEstimator
.ColumnOptions(name, inputColumnName ?? name, numberOfBits, seed, useOrderedHashing, maximumNumberOfInverts);
299
private readonly
HashingEstimator
_hash;
Text\WordHashBagProducingTransform.cs (2)
335
var hashColumns = new List<
HashingEstimator
.ColumnOptions>();
356
hashColumns.Add(new
HashingEstimator
.ColumnOptions(tmpName, column.Source[isrc],