예제 #1
0
        public override IEnumerable <TestResult> ComputeTests(double[] scores)
        {
            short[][] trainQueriesTopLabels = _rankingObjectiveFunction.TrainQueriesTopLabels;
            double    fastNdcg = 0;

            switch (NdcgTruncation)
            {
            case 1:
                fastNdcg = DcgCalculator.Ndcg1(Dataset, trainQueriesTopLabels);
                break;

            case 3:
                fastNdcg = DcgCalculator.Ndcg3(Dataset, trainQueriesTopLabels);
                break;

            default:
                throw Contracts.Except("FastNDCGTest only supports NDCG1 & NDCG3");
            }
            List <TestResult> result = new List <TestResult>()
            {
                new TestResult("NDCG@" + NdcgTruncation.ToString(), fastNdcg * Dataset.NumQueries, Dataset.NumQueries, false, TestResult.ValueOperator.Average),
            };

            return(result);
        }
예제 #2
0
        public override IEnumerable <TestResult> ComputeTests(double[] scores)
        {
            double fastNdcg = 0;

            switch (NdcgTruncation)
            {
            case 1:
                fastNdcg = DcgCalculator.Ndcg1(Dataset, Labels, scores);
                break;

            case 3:
                fastNdcg = DcgCalculator.Ndcg3(Dataset, Labels, scores);
                break;

            default:
                Contracts.Assert(false);
                throw Contracts.Except();
            }

            List <TestResult> result = new List <TestResult>()
            {
                new TestResult("NDCG@" + NdcgTruncation.ToString(), fastNdcg * Dataset.NumQueries, Dataset.NumQueries, false, TestResult.ValueOperator.Average),
            };

            return(result);
        }