2 writes to _featureHistogram
Microsoft.ML.StandardTrainers (2)
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (2)
299
_featureHistogram
= featureHistogram;
335
_featureHistogram
= new long[_labelCount][];
25 references to _featureHistogram
Microsoft.ML.StandardTrainers (25)
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (25)
277
public IReadOnlyList<IReadOnlyList<int>> GetFeatureHistogram() => Array.ConvertAll(
_featureHistogram
, x => Array.ConvertAll(x, y => (int)y));
282
public IReadOnlyList<IReadOnlyList<long>> GetFeatureHistogramLong() =>
_featureHistogram
;
303
_absentFeaturesLogProb = CalculateAbsentFeatureLogProbabilities(_labelHistogram,
_featureHistogram
, _featureCount);
341
_featureHistogram
[iLabel] = ctx.Reader.ReadLongArray(_featureCount);
343
_featureHistogram
[iLabel] = Array.ConvertAll(ctx.Reader.ReadIntArray(_featureCount) ?? new int[0], x => (long)x);
345
Host.CheckDecode(
_featureHistogram
[iLabel][iFeature] >= 0);
380
ctx.Writer.WriteLongStream(
_featureHistogram
[i]);
427
float[] featureHistogram = new float[
_featureHistogram
[0].Length * _labelHistogram.Length];
428
float[] labelHistogramExpanded = new float[
_featureHistogram
[0].Length * _labelHistogram.Length];
430
for (int i = 0; i <
_featureHistogram
.Length; i++)
432
Array.Copy(
_featureHistogram
[i], 0, featureHistogram, i *
_featureHistogram
[i].Length,
_featureHistogram
[i].Length);
434
for (int i = 0; i <
_featureHistogram
[0].Length; i++)
436
Array.Copy(_labelHistogram, 0, labelHistogramExpanded, i *
_featureHistogram
.Length,
_featureHistogram
.Length);
446
var featureHistogramName = ctx.AddInitializer(featureHistogram, new long[] {
_featureHistogram
.Length,
_featureHistogram
[0].Length }, "featureHistogram");
447
var labelHistogramName = ctx.AddInitializer(labelHistogramExpanded, new long[] {
_featureHistogram
[0].Length, _labelHistogram.Length }, "labelHistogramExpanded");
451
var typeFea = new VectorDataViewType(NumberDataViewType.Single,
_featureHistogram
[0].Length);
452
var typeLabelByFea = new VectorDataViewType(NumberDataViewType.Single, _labelHistogram.Length,
_featureHistogram
[0].Length);
455
var greaterOutput = ctx.AddIntermediateVariable(new VectorDataViewType(BooleanDataViewType.Instance,
_featureHistogram
[0].Length), "greaterOutput");
466
var isFeaturePresent = ctx.AddIntermediateVariable(new VectorDataViewType(NumberDataViewType.Single, 1,
_featureHistogram
[0].Length), "isFeaturePresent");
576
var logOutput = ctx.AddIntermediateVariable(new VectorDataViewType(NumberDataViewType.Single,
_featureHistogram
[0].Length), "LogOutput");
589
double featureCount =
_featureHistogram
[labelIndex][featureIndex];