3 writes to _labelHistogram
Microsoft.ML.StandardTrainers (3)
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (3)
298
_labelHistogram
= labelHistogram;
323
_labelHistogram
= ctx.Reader.ReadLongArray() ?? new long[0];
326
_labelHistogram
= Array.ConvertAll(ctx.Reader.ReadIntArray() ?? new int[0], x => (long)x);
21 references to _labelHistogram
Microsoft.ML.StandardTrainers (21)
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (21)
265
public IReadOnlyList<int> GetLabelHistogram() => Array.ConvertAll(
_labelHistogram
, x => (int)x);
270
public IReadOnlyList<long> GetLabelHistogramLong() =>
_labelHistogram
;
300
_totalTrainingCount =
_labelHistogram
.Sum();
301
_labelCount =
_labelHistogram
.Length;
303
_absentFeaturesLogProb = CalculateAbsentFeatureLogProbabilities(
_labelHistogram
, _featureHistogram, _featureCount);
328
_labelCount =
_labelHistogram
.Length;
330
foreach (int labelCount in
_labelHistogram
)
338
if (
_labelHistogram
[iLabel] > 0)
350
_totalTrainingCount =
_labelHistogram
.Sum();
375
ctx.Writer.WriteLongStream(
_labelHistogram
);
379
if (
_labelHistogram
[i] > 0)
427
float[] featureHistogram = new float[_featureHistogram[0].Length *
_labelHistogram
.Length];
428
float[] labelHistogramExpanded = new float[_featureHistogram[0].Length *
_labelHistogram
.Length];
436
Array.Copy(
_labelHistogram
, 0, labelHistogramExpanded, i * _featureHistogram.Length, _featureHistogram.Length);
444
var labelHistogram = ctx.AddInitializer(labelHistogramExpanded.Take(
_labelHistogram
.Length), new long[] {
_labelHistogram
.Length, 1 }, "labelHistogram");
447
var labelHistogramName = ctx.AddInitializer(labelHistogramExpanded, new long[] { _featureHistogram[0].Length,
_labelHistogram
.Length }, "labelHistogramExpanded");
452
var typeLabelByFea = new VectorDataViewType(NumberDataViewType.Single,
_labelHistogram
.Length, _featureHistogram[0].Length);
453
var typeLabelByOne = new VectorDataViewType(NumberDataViewType.Single,
_labelHistogram
.Length, 1);
607
double labelOccurrenceCount =
_labelHistogram
[iLabel];
610
if (
_labelHistogram
[iLabel] > 0)