public SingletonFeatureFlock(IntArray bins, double[] binUpperBounds) : base(1) { Contracts.AssertValue(bins); Contracts.AssertValue(binUpperBounds); Contracts.Assert(bins.Length == 0 || bins.Max() < binUpperBounds.Length); _bins = bins; _binUpperBounds = binUpperBounds; }
/// <summary> /// Make a new FeatureHistogram /// </summary> /// <param name="bins">The bins we will be calculating sumups over</param> /// <param name="numBins">The number of bins, should be at least as large as the number of bins</param> /// <param name="useWeights">Allocates weights array when true</param> public FeatureHistogram(IntArray bins, int numBins, bool useWeights) { Contracts.AssertValue(bins); Contracts.Assert(bins.Length == 0 || (0 <= numBins && bins.Max() < numBins)); _bins = bins; NumFeatureValues = numBins; SumTargetsByBin = new FloatType[NumFeatureValues]; CountByBin = new int[NumFeatureValues]; if (useWeights) { SumWeightsByBin = new double[NumFeatureValues]; } }