import alpenglow as prs
import alpenglow.Getter as rs
import alpenglow.experiments
import pandas as pd
import math
import pytest
import sys
from alpenglow.evaluation import DcgScore
import alpenglow.cpp
compiler = alpenglow.cpp.__compiler
stdlib = alpenglow.cpp.__stdlib


class TestBatchFactorExperiment:
    def test_batchFactorExperiment(self):
        data = pd.read_csv(
            "python/test_alpenglow/test_data_4",
            sep=' ',
            header=None,
            names=['time', 'user', 'item', 'id', 'score', 'eval']
        )
        sbExperiment = alpenglow.experiments.BatchFactorExperiment(
            top_k=100,
            negative_rate=3,
            seed=254938879,
            period_length=1000
        )
        rankings = sbExperiment.run(data, verbose=True, exclude_known=True)
        assert rankings.top_k == 100
        desired_ranks = [101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 42.0, 1.0, 10.0, 101.0, 101.0, 20.0, 101.0, 101.0, 101.0, 18.0, 87.0, 101.0, 92.0, 101.0, 101.0, 48.0, 3.0, 101.0, 77.0, 25.0, 75.0, 3.0, 80.0, 10.0, 101.0, 101.0, 101.0, 101.0, 89.0, 101.0, 66.0, 101.0, 6.0, 101.0, 52.0, 83.0, 101.0, 101.0, 56.0, 24.0, 26.0, 38.0, 101.0, 101.0, 16.0, 58.0, 15.0, 31.0, 101.0, 26.0, 101.0, 76.0, 72.0, 12.0, 7.0, 50.0, 24.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 32.0, 101.0, 101.0, 101.0, 52.0, 95.0, 3.0, 101.0, 98.0, 94.0, 101.0, 22.0, 101.0, 101.0, 25.0, 101.0, 3.0, 83.0, 2.0, 101.0, 25.0, 9.0, 27.0, 101.0, 37.0, 12.0, 101.0, 101.0, 64.0, 101.0, 101.0, 101.0, 101.0, 26.0, 50.0, 5.0, 101.0, 101.0, 66.0, 101.0, 45.0, 11.0, 101.0, 7.0, 101.0, 34.0, 101.0, 1.0, 98.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 4.0, 101.0, 10.0, 10.0, 101.0, 101.0, 101.0, 101.0, 31.0, 6.0, 101.0, 101.0, 101.0, 7.0, 54.0, 12.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 6.0, 101.0, 101.0, 45.0, 101.0, 101.0, 22.0, 101.0, 101.0, 45.0, 101.0, 101.0, 89.0, 101.0, 101.0, 101.0, 30.0, 3.0, 20.0, 101.0, 3.0, 10.0, 101.0, 16.0, 101.0, 101.0, 101.0, 25.0, 94.0, 16.0, 101.0, 101.0, 101.0, 4.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 31.0, 101.0, 101.0, 53.0, 3.0, 101.0, 2.0, 2.0, 101.0, 43.0, 101.0, 26.0, 36.0, 101.0, 101.0, 5.0, 5.0, 101.0, 21.0, 3.0, 3.0, 5.0, 37.0, 47.0, 101.0, 101.0, 35.0, 12.0, 101.0, 23.0, 101.0, 28.0, 101.0, 7.0, 82.0, 26.0, 101.0, 101.0, 20.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 2.0, 10.0, 80.0, 72.0, 26.0, 101.0, 38.0, 48.0, 10.0, 101.0, 65.0, 101.0, 4.0, 101.0, 12.0, 101.0, 50.0, 101.0, 101.0, 101.0, 101.0, 101.0, 3.0, 7.0, 101.0, 10.0, 14.0, 78.0, 97.0, 6.0, 1.0, 8.0, 15.0, 29.0, 3.0, 101.0, 96.0, 46.0, 32.0, 101.0, 12.0, 58.0, 101.0, 101.0, 53.0, 52.0, 4.0, 25.0, 70.0, 99.0, 14.0, 25.0, 38.0, 3.0, 1.0, 101.0, 1.0, 101.0, 101.0, 101.0, 101.0, 101.0, 90.0, 1.0, 101.0, 101.0, 101.0, 4.0, 101.0, 100.0, 44.0, 22.0, 56.0, 42.0, 101.0, 65.0, 100.0, 35.0, 7.0, 101.0, 101.0, 101.0, 88.0, 101.0, 2.0, 58.0, 101.0, 33.0, 8.0, 1.0, 37.0, 93.0, 101.0, 3.0, 36.0, 17.0, 20.0, 62.0, 1.0, 35.0, 101.0, 4.0, 77.0, 17.0, 101.0, 101.0, 1.0, 101.0, 101.0, 28.0, 101.0, 101.0, 19.0, 101.0, 37.0, 18.0, 101.0, 1.0, 101.0, 101.0, 25.0, 35.0, 101.0, 19.0, 47.0, 42.0, 21.0, 101.0, 101.0, 88.0, 101.0, 9.0, 4.0, 101.0, 4.0, 101.0, 3.0, 87.0, 16.0, 14.0, 101.0, 101.0, 46.0, 13.0, 44.0, 101.0, 31.0, 101.0, 101.0, 101.0, 1.0, 101.0, 57.0, 101.0, 85.0, 1.0, 91.0, 101.0, 101.0, 101.0, 101.0, 42.0, 33.0, 101.0, 101.0, 54.0, 16.0, 28.0, 101.0, 15.0, 15.0, 56.0, 101.0, 101.0, 101.0, 9.0, 101.0, 3.0, 101.0, 12.0, 9.0, 16.0, 5.0, 11.0, 2.0, 16.0, 101.0, 1.0, 101.0, 14.0, 66.0, 25.0, 28.0, 24.0, 5.0, 101.0, 93.0, 101.0, 18.0, 101.0, 101.0, 50.0, 10.0, 32.0, 30.0, 101.0, 18.0, 101.0, 17.0, 4.0, 8.0, 40.0, 36.0, 101.0, 38.0, 101.0, 2.0, 24.0, 8.0, 101.0, 101.0, 5.0, 101.0, 101.0, 8.0, 101.0, 6.0, 27.0, 101.0, 101.0, 90.0, 16.0, 84.0, 12.0, 101.0, 101.0, 23.0, 26.0, 101.0, 2.0, 101.0, 34.0, 43.0, 37.0, 17.0, 35.0, 2.0, 9.0, 5.0, 6.0, 28.0, 101.0, 29.0, 11.0, 5.0, 86.0, 8.0, 28.0, 7.0, 31.0, 11.0, 1.0, 12.0, 101.0, 30.0, 31.0, 101.0, 14.0, 101.0, 76.0, 5.0, 101.0, 13.0, 101.0, 43.0, 2.0, 2.0, 22.0, 47.0, 93.0, 48.0, 101.0, 11.0, 101.0, 101.0, 1.0, 7.0, 101.0, 4.0, 82.0, 17.0, 101.0, 22.0, 35.0, 35.0, 17.0, 101.0, 6.0, 101.0, 101.0, 29.0, 24.0, 101.0, 91.0, 101.0, 2.0, 2.0, 3.0, 101.0, 22.0, 21.0, 15.0, 8.0, 12.0, 19.0, 25.0, 17.0, 19.0, 96.0, 101.0, 21.0, 11.0, 46.0, 4.0, 1.0, 101.0, 101.0, 49.0, 17.0, 13.0, 1.0, 43.0, 101.0, 2.0, 1.0, 94.0, 56.0, 6.0, 40.0, 2.0, 101.0, 101.0, 22.0, 4.0, 28.0, 1.0, 101.0, 13.0, 30.0, 101.0, 101.0, 1.0, 39.0, 23.0, 12.0, 17.0, 7.0, 101.0, 5.0, 22.0, 2.0, 24.0, 101.0, 101.0, 76.0, 35.0, 46.0, 101.0, 16.0, 7.0, 68.0, 101.0, 31.0, 4.0, 6.0, 16.0, 9.0, 101.0, 101.0, 27.0, 9.0, 3.0, 1.0, 7.0, 29.0, 16.0, 3.0, 101.0, 10.0, 3.0, 101.0, 1.0, 2.0, 35.0, 101.0, 1.0, 36.0, 40.0, 2.0, 25.0, 1.0, 101.0, 101.0, 101.0, 101.0, 101.0, 18.0, 17.0, 1.0, 101.0, 9.0, 25.0, 13.0, 12.0, 101.0, 3.0, 101.0, 25.0, 101.0, 46.0, 62.0, 101.0, 101.0, 5.0, 5.0, 6.0, 14.0, 101.0, 101.0, 28.0, 11.0, 41.0, 24.0, 3.0, 68.0, 7.0, 9.0, 101.0, 101.0, 98.0, 101.0, 101.0, 101.0, 11.0, 14.0, 31.0, 32.0, 22.0, 101.0, 2.0, 20.0, 23.0, 101.0, 23.0, 20.0, 1.0, 9.0, 31.0, 16.0, 11.0, 4.0, 34.0, 6.0, 101.0, 101.0, 37.0, 4.0, 15.0, 1.0, 101.0, 12.0, 15.0, 5.0, 101.0, 24.0, 5.0, 5.0, 31.0, 100.0, 38.0, 101.0, 11.0, 8.0, 28.0, 101.0, 34.0, 101.0, 101.0, 16.0, 11.0, 22.0, 13.0, 20.0, 101.0, 12.0, 101.0, 101.0, 101.0, 101.0, 101.0, 20.0, 23.0, 11.0, 101.0, 42.0, 3.0, 101.0, 12.0, 101.0, 16.0, 2.0, 9.0, 9.0, 101.0, 101.0, 101.0, 40.0, 101.0, 101.0, 16.0, 101.0, 21.0, 101.0, 10.0, 12.0, 1.0, 4.0, 5.0, 35.0, 1.0, 101.0, 97.0, 5.0, 21.0, 9.0, 101.0, 101.0, 28.0, 32.0, 101.0, 16.0, 10.0, 27.0, 2.0, 44.0, 101.0, 27.0, 5.0, 29.0, 101.0, 22.0, 39.0, 12.0, 2.0, 58.0, 1.0, 10.0, 37.0, 12.0, 101.0, 2.0, 6.0, 10.0, 92.0, 23.0, 2.0, 101.0, 1.0, 1.0, 62.0, 101.0, 16.0, 22.0, 26.0, 41.0, 101.0, 101.0, 101.0]

        if(compiler == "gcc" and stdlib == "libstdc++"):
            assert list(rankings["rank"].fillna(101)) == desired_ranks

        assert DcgScore(rankings).mean() == pytest.approx(0.15820316053460715, abs=5*1e-3)


    def test_batchFactorExperiment_timeframe(self):
        data = pd.read_csv(
            "python/test_alpenglow/test_data_4",
            sep=' ',
            header=None,
            names=['time', 'user', 'item', 'id', 'score', 'eval']
        )
        sbExperiment = alpenglow.experiments.BatchFactorExperiment(
            top_k=100,
            negative_rate=3,
            seed=254938879,
            period_length=1000,
            timeframe_length=2000
        )
        rankings = sbExperiment.run(data, verbose=True, exclude_known=True)
        assert rankings.top_k == 100
        desired_ranks=[101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 42.0, 1.0, 10.0, 101.0, 101.0, 20.0, 101.0, 101.0, 101.0, 18.0, 87.0, 101.0, 92.0, 101.0, 101.0, 48.0, 3.0, 101.0, 77.0, 25.0, 75.0, 3.0, 80.0, 10.0, 101.0, 101.0, 101.0, 101.0, 89.0, 101.0, 66.0, 101.0, 6.0, 101.0, 52.0, 83.0, 101.0, 101.0, 56.0, 24.0, 26.0, 38.0, 101.0, 101.0, 16.0, 58.0, 15.0, 31.0, 101.0, 26.0, 101.0, 76.0, 72.0, 12.0, 7.0, 50.0, 24.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 32.0, 101.0, 101.0, 101.0, 52.0, 95.0, 3.0, 101.0, 98.0, 94.0, 101.0, 22.0, 101.0, 101.0, 25.0, 101.0, 3.0, 83.0, 2.0, 101.0, 25.0, 9.0, 27.0, 101.0, 37.0, 12.0, 101.0, 101.0, 64.0, 101.0, 101.0, 101.0, 101.0, 26.0, 50.0, 5.0, 101.0, 101.0, 66.0, 101.0, 45.0, 11.0, 101.0, 7.0, 101.0, 34.0, 101.0, 1.0, 98.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 4.0, 101.0, 10.0, 10.0, 101.0, 101.0, 101.0, 101.0, 31.0, 6.0, 101.0, 101.0, 101.0, 7.0, 54.0, 12.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 6.0, 101.0, 101.0, 45.0, 101.0, 101.0, 22.0, 101.0, 101.0, 45.0, 101.0, 101.0, 89.0, 101.0, 101.0, 101.0, 30.0, 3.0, 20.0, 101.0, 3.0, 10.0, 101.0, 16.0, 101.0, 101.0, 101.0, 25.0, 94.0, 16.0, 101.0, 101.0, 101.0, 4.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 31.0, 101.0, 101.0, 53.0, 3.0, 101.0, 2.0, 2.0, 101.0, 43.0, 101.0, 26.0, 36.0, 101.0, 101.0, 5.0, 5.0, 101.0, 21.0, 3.0, 3.0, 5.0, 37.0, 47.0, 101.0, 101.0, 35.0, 12.0, 101.0, 23.0, 101.0, 28.0, 101.0, 7.0, 82.0, 26.0, 101.0, 101.0, 20.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 2.0, 10.0, 80.0, 72.0, 26.0, 101.0, 38.0, 48.0, 10.0, 101.0, 65.0, 101.0, 4.0, 101.0, 12.0, 101.0, 50.0, 101.0, 101.0, 101.0, 101.0, 101.0, 3.0, 7.0, 101.0, 10.0, 14.0, 78.0, 97.0, 6.0, 1.0, 8.0, 15.0, 29.0, 3.0, 101.0, 96.0, 46.0, 32.0, 101.0, 12.0, 58.0, 101.0, 101.0, 53.0, 52.0, 4.0, 25.0, 70.0, 99.0, 14.0, 25.0, 38.0, 3.0, 1.0, 101.0, 1.0, 101.0, 101.0, 101.0, 101.0, 101.0, 90.0, 1.0, 101.0, 101.0, 101.0, 4.0, 101.0, 100.0, 44.0, 22.0, 56.0, 42.0, 101.0, 65.0, 100.0, 35.0, 7.0, 101.0, 101.0, 101.0, 88.0, 101.0, 2.0, 58.0, 101.0, 33.0, 8.0, 1.0, 37.0, 93.0, 101.0, 3.0, 36.0, 17.0, 20.0, 62.0, 1.0, 35.0, 101.0, 4.0, 77.0, 17.0, 101.0, 101.0, 1.0, 101.0, 101.0, 28.0, 101.0, 101.0, 19.0, 101.0, 37.0, 18.0, 101.0, 1.0, 101.0, 101.0, 25.0, 35.0, 101.0, 19.0, 47.0, 42.0, 21.0, 101.0, 101.0, 88.0, 101.0, 9.0, 4.0, 101.0, 4.0, 101.0, 3.0, 87.0, 16.0, 14.0, 101.0, 101.0, 46.0, 13.0, 44.0, 101.0, 31.0, 101.0, 101.0, 101.0, 1.0, 101.0, 57.0, 101.0, 85.0, 1.0, 91.0, 101.0, 101.0, 101.0, 101.0, 42.0, 22.0, 101.0, 101.0, 55.0, 9.0, 15.0, 101.0, 16.0, 63.0, 44.0, 101.0, 101.0, 64.0, 10.0, 101.0, 4.0, 101.0, 11.0, 2.0, 94.0, 43.0, 19.0, 13.0, 11.0, 101.0, 1.0, 101.0, 20.0, 39.0, 51.0, 53.0, 13.0, 5.0, 101.0, 46.0, 101.0, 73.0, 101.0, 101.0, 101.0, 75.0, 36.0, 17.0, 101.0, 101.0, 101.0, 101.0, 1.0, 4.0, 101.0, 72.0, 35.0, 101.0, 101.0, 6.0, 15.0, 3.0, 101.0, 101.0, 24.0, 101.0, 101.0, 37.0, 101.0, 32.0, 83.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 25.0, 13.0, 101.0, 6.0, 101.0, 63.0, 34.0, 23.0, 96.0, 25.0, 3.0, 83.0, 13.0, 2.0, 17.0, 101.0, 25.0, 31.0, 1.0, 96.0, 2.0, 72.0, 4.0, 101.0, 2.0, 4.0, 94.0, 101.0, 101.0, 95.0, 101.0, 37.0, 101.0, 83.0, 2.0, 101.0, 12.0, 101.0, 101.0, 2.0, 2.0, 58.0, 101.0, 42.0, 23.0, 101.0, 23.0, 101.0, 101.0, 1.0, 13.0, 101.0, 7.0, 101.0, 25.0, 101.0, 16.0, 94.0, 67.0, 21.0, 101.0, 6.0, 101.0, 101.0, 17.0, 26.0, 101.0, 101.0, 101.0, 6.0, 14.0, 10.0, 101.0, 22.0, 101.0, 9.0, 54.0, 79.0, 72.0, 36.0, 79.0, 101.0, 101.0, 26.0, 101.0, 22.0, 57.0, 7.0, 4.0, 101.0, 101.0, 24.0, 23.0, 33.0, 2.0, 101.0, 101.0, 3.0, 4.0, 32.0, 29.0, 54.0, 25.0, 9.0, 101.0, 101.0, 12.0, 11.0, 16.0, 1.0, 101.0, 86.0, 13.0, 101.0, 101.0, 6.0, 49.0, 13.0, 92.0, 19.0, 10.0, 101.0, 2.0, 35.0, 3.0, 25.0, 101.0, 85.0, 101.0, 75.0, 84.0, 101.0, 29.0, 5.0, 101.0, 46.0, 14.0, 10.0, 43.0, 28.0, 10.0, 101.0, 101.0, 89.0, 20.0, 4.0, 7.0, 18.0, 43.0, 28.0, 46.0, 101.0, 7.0, 3.0, 101.0, 1.0, 11.0, 20.0, 101.0, 3.0, 99.0, 101.0, 9.0, 23.0, 4.0, 101.0, 101.0, 101.0, 101.0, 101.0, 8.0, 42.0, 43.0, 101.0, 5.0, 16.0, 17.0, 12.0, 101.0, 51.0, 58.0, 65.0, 101.0, 101.0, 101.0, 101.0, 101.0, 14.0, 14.0, 25.0, 26.0, 101.0, 101.0, 69.0, 18.0, 79.0, 38.0, 9.0, 101.0, 28.0, 9.0, 101.0, 101.0, 101.0, 101.0, 101.0, 101.0, 8.0, 30.0, 32.0, 2.0, 35.0, 101.0, 9.0, 2.0, 29.0, 101.0, 19.0, 14.0, 6.0, 22.0, 21.0, 12.0, 2.0, 4.0, 101.0, 5.0, 101.0, 101.0, 82.0, 97.0, 17.0, 4.0, 101.0, 57.0, 13.0, 12.0, 101.0, 10.0, 16.0, 9.0, 13.0, 101.0, 68.0, 101.0, 12.0, 17.0, 33.0, 101.0, 81.0, 101.0, 101.0, 12.0, 16.0, 47.0, 19.0, 85.0, 101.0, 2.0, 101.0, 101.0, 101.0, 101.0, 101.0, 33.0, 33.0, 15.0, 101.0, 101.0, 12.0, 101.0, 8.0, 101.0, 30.0, 1.0, 11.0, 22.0, 87.0, 101.0, 101.0, 101.0, 101.0, 101.0, 18.0, 101.0, 38.0, 101.0, 15.0, 20.0, 3.0, 1.0, 1.0, 97.0, 1.0, 101.0, 34.0, 7.0, 62.0, 5.0, 101.0, 101.0, 60.0, 101.0, 101.0, 2.0, 12.0, 59.0, 9.0, 101.0, 101.0, 30.0, 8.0, 38.0, 96.0, 90.0, 76.0, 25.0, 8.0, 101.0, 5.0, 5.0, 101.0, 33.0, 101.0, 8.0, 33.0, 18.0, 101.0, 5.0, 6.0, 101.0, 6.0, 1.0, 100.0, 101.0, 1.0, 17.0, 48.0, 41.0, 101.0, 101.0, 101.0]

        if(compiler == "gcc" and stdlib == "libstdc++"):
            assert list(rankings["rank"].fillna(101)) == desired_ranks

        assert DcgScore(rankings).mean() == pytest.approx(0.14411975824368886, abs=5*1e-3)
