public Transform(IHostEnvironment env, IDataView input, string labelCol, string scoreCol, string groupCol, int truncationLevel, Double[] labelGains) : base(env, input, labelCol, scoreCol, groupCol, RegistrationName) { Host.CheckParam(0 < truncationLevel, nameof(truncationLevel), "Truncation level must be greater than 0"); Host.CheckValue(labelGains, nameof(labelGains)); _truncationLevel = truncationLevel; _discountMap = RankingUtils.GetDiscountMap(_truncationLevel); _labelGains = labelGains; _bindings = new Bindings(Host, Source.Schema, true, LabelCol, ScoreCol, GroupCol, _truncationLevel); }
public Counters(Double[] labelGains, int truncationLevel, bool groupSummary) { Contracts.Assert(truncationLevel > 0); Contracts.AssertValue(labelGains); TruncationLevel = truncationLevel; _discountMap = RankingUtils.GetDiscountMap(truncationLevel); _sumDcgAtN = new Double[TruncationLevel]; _sumNdcgAtN = new Double[TruncationLevel]; _groupDcgCur = new Double[TruncationLevel]; _groupMaxDcgCur = new Double[TruncationLevel]; if (groupSummary) { _groupNdcg = new List <Double[]>(); _groupDcg = new List <Double[]>(); _groupMaxDcg = new List <Double[]>(); } _queryLabels = new List <short>(); _queryOutputs = new List <Single>(); _labelGains = labelGains; }