text: import alpenglow as prs
  from alpenglow.offline.models import PopularityModel
  from alpenglow.offline.evaluation import NdcgScore
  import alpenglow.Getter as rs
  import pandas as pd
  import numpy as np
  import unittest
  import pytest
  
  compiler = prs.cpp.__compiler
  stdlib = prs.cpp.__stdlib
  
  
  class TestPopularityModel(unittest.TestCase):
      def test_rmse(self):
          data = pd.read_csv(
              "python/test_alpenglow/test_data_4",
              sep=' ',
              header=None,
              names=['time', 'user', 'item', 'id', 'score', 'eval']
          )
          model = PopularityModel()
          model.fit(data)
  
          def predict(model, user, item):
              rd = rs.RecDat()
              rd.user = user
              rd.item = item
              return model.prediction(rd)
  
          errors = [(1 - predict(model.model, u, i))**2 for (u, i) in data[['user', 'item']].values]
          rmse = np.sqrt(pd.Series(errors)).mean()
          self.assertAlmostEqual(0.37659443516678637, rmse)
  
      def test_ranking(self):
          data = pd.read_csv(
              "python/test_alpenglow/test_data_4",
              sep=' ',
              header=None,
              names=['time', 'user', 'item', 'id', 'score', 'eval']
          )
          exp = PopularityModel()
          exp.fit(data)
          preds = exp.recommend()
  
  
          print("toplist="+str(preds['item'].tolist()))
  
          if(compiler == "gcc" and stdlib == "libstdc++"):
              assert preds['item'].tolist() ==  \
                  [30, 94, 166, 225, 300, 299, 442, 196, 372, 462, 455, 337, 204, 256, 62, 338, 427, 429, 250, 128, 36, 40, 383, 165, 215, 247, 496, 255, 293, 177, 38, 86, 156, 120, 102, 282, 211, 483, 444, 371, 375, 450, 452, 266, 97, 81, 168, 497, 414, 468, 263, 434, 251, 292, 4, 25, 108, 69, 325, 491, 400, 479, 298, 295, 421, 330, 277, 197, 440, 436, 458, 181, 464, 16, 161, 5, 99, 395, 314, 205, 54, 271, 377, 397, 488, 362, 122, 216, 116, 6, 113, 318, 296, 498, 234, 265, 289, 454, 58, 284, 300, 299, 204, 427, 429, 250, 496, 40, 215, 165, 255, 86, 371, 483, 450, 452, 97, 266, 414, 497, 81, 251, 468, 292, 434, 25, 108, 295, 400, 197, 491, 421, 298, 325, 330, 464, 271, 16, 205, 436, 440, 181, 395, 314, 99, 29, 191, 216, 206, 353, 6, 15, 284, 233, 454, 58, 488, 195, 116, 498, 105, 425, 22, 122, 348, 188, 127, 245, 356, 93, 318, 351, 146, 296, 403, 234, 281, 118, 362, 95, 254, 192, 12, 478, 164, 178, 474, 111, 145, 49, 136, 27, 301, 407, 210, 319, 485, 200, 273, 499, 30, 166, 225, 299, 442, 196, 337, 204, 256, 62, 250, 40, 36, 247, 383, 215, 128, 165, 293, 177, 86, 38, 102, 120, 282, 211, 156, 444, 375, 483, 168, 81, 97, 414, 450, 266, 452, 263, 434, 251, 292, 108, 4, 25, 298, 277, 421, 325, 330, 479, 491, 69, 197, 400, 16, 5, 161, 314, 99, 271, 54, 464, 205, 458, 395, 436, 181, 440, 234, 122, 132, 192, 498, 113, 318, 118, 12, 478, 296, 6, 356, 348, 403, 17, 29, 95, 281, 93, 265, 116, 425, 353, 58, 397, 454, 284, 15, 289, 377, 488, 30, 94, 166, 225, 300, 299, 98, 196, 372, 455, 462, 337, 204, 256, 62, 338, 429, 427, 250, 128, 36, 496, 40, 247, 165, 215, 383, 255, 293, 177, 38, 86, 156, 120, 102, 282, 211, 483, 444, 371, 375, 450, 452, 266, 97, 81, 168, 497, 414, 468, 263, 434, 251, 292, 4, 25, 108, 69, 325, 491, 400, 479, 298, 295, 421, 330, 277, 197, 440, 436, 458, 181, 464, 16, 161, 5, 99, 395, 314, 205, 54, 271, 377, 397, 488, 362, 122, 216, 116, 6, 113, 318, 296, 498, 234, 265, 289, 454, 58, 284, 30, 94, 166, 225, 300, 299, 442, 98, 372, 455, 462, 337, 256, 204, 62, 338, 429, 427, 250, 247, 496, 36, 40, 165, 383, 128, 215, 255, 293, 177, 38, 86, 211, 120, 156, 102, 282, 483, 444, 375, 371, 450, 266, 452, 97, 81, 168, 414, 497, 263, 434, 251, 468, 292, 25, 4, 108, 69, 325, 491, 400, 479, 298, 295, 197, 421, 330, 277, 440, 436, 458, 181, 464, 16, 161, 5, 99, 395, 314, 205, 54, 271, 377, 397, 488, 362, 122, 216, 116, 6, 113, 318, 296, 498, 234, 265, 289, 454, 58, 284, 30, 166, 225, 299, 98, 196, 372, 455, 462, 337, 256, 204, 338, 62, 429, 250, 427, 40, 247, 215, 496, 36, 255, 177, 38, 120, 102, 282, 156, 211, 483, 444, 371, 375, 266, 97, 168, 497, 414, 452, 450, 81, 263, 468, 292, 434, 251, 108, 25, 4, 325, 491, 277, 400, 295, 197, 330, 298, 479, 69, 16, 161, 271, 464, 5, 99, 205, 395, 314, 54, 458, 181, 440, 488, 362, 234, 122, 216, 356, 478, 93, 348, 113, 318, 296, 498, 6, 116, 289, 12, 105, 265, 454, 58, 29, 17, 284, 15, 353, 95, 30, 94, 166, 225, 299, 442, 98, 372, 455, 337, 256, 204, 62, 338, 429, 250, 427, 36, 496, 215, 40, 383, 247, 128, 255, 177, 86, 38, 293, 156, 102, 282, 120, 211, 483, 444, 375, 371, 452, 450, 266, 97, 168, 414, 497, 81, 434, 263, 468, 251, 108, 25, 4, 292, 69, 325, 491, 421, 400, 295, 298, 330, 197, 479, 277, 181, 436, 440, 271, 16, 464, 161, 5, 99, 395, 54, 314, 205, 458, 488, 397, 105, 362, 216, 122, 234, 6, 296, 318, 113, 116, 498, 265, 289, 454, 15, 284, 353, 29, 95, 94, 166, 225, 300, 442, 98, 196, 372, 455, 462, 337, 256, 204, 338, 62, 427, 429, 250, 247, 36, 128, 215, 165, 496, 40, 383, 255, 293, 177, 38, 86, 211, 156, 120, 102, 282, 483, 444, 375, 371, 450, 452, 266, 97, 414, 168, 497, 81, 251, 468, 263, 434, 25, 4, 292, 108, 69, 325, 295, 491, 400, 298, 421, 479, 330, 277, 197, 458, 436, 440, 181, 16, 161, 271, 464, 99, 5, 395, 314, 205, 54, 377, 488, 362, 397, 122, 216, 6, 265, 116, 113, 296, 318, 498, 234, 289, 454, 58, 15, 353, 166, 300, 442, 196, 372, 462, 455, 337, 256, 338, 429, 250, 427, 128, 247, 36, 215, 496, 165, 383, 255, 38, 86, 293, 282, 102, 120, 156, 211, 483, 375, 444, 371, 266, 97, 168, 497, 452, 414, 450, 4, 263, 468, 292, 434, 251, 108, 25, 325, 491, 277, 400, 197, 295, 330, 298, 479, 421, 69, 181, 16, 161, 271, 5, 464, 99, 205, 395, 54, 314, 436, 458, 440, 362, 488, 234, 122, 216, 356, 478, 93, 348, 113, 296, 318, 105, 6, 116, 12, 289, 265, 454, 58, 29, 17, 284, 15, 353, 95, 403, 30, 94, 166, 225, 300, 299, 98, 442, 196, 455, 462, 337, 204, 62, 427, 429, 250, 36, 247, 128, 496, 215, 40, 165, 255, 293, 177, 38, 86, 211, 156, 102, 120, 282, 483, 444, 375, 371, 450, 266, 97, 168, 497, 414, 452, 81, 468, 434, 263, 251, 25, 4, 108, 292, 325, 491, 400, 421, 295, 298, 197, 330, 69, 479, 277, 436, 181, 440, 161, 271, 16, 464, 5, 99, 395, 314, 54, 205, 458, 488, 397, 105, 362, 216, 122, 265, 234, 113, 296, 318, 498, 6, 454, 116, 289, 58, 403, 15, 353, 29, 94, 166, 225, 98, 442, 196, 462, 337, 256, 204, 338, 62, 427, 250, 429, 36, 383, 128, 40, 165, 247, 496, 215, 255, 293, 177, 86, 38, 211, 156, 102, 282, 120, 375, 483, 371, 444, 450, 266, 168, 97, 414, 497, 452, 81, 4, 468, 434, 263, 251, 108, 25, 292, 421, 325, 491, 400, 295, 277, 197, 298, 330, 479, 69, 181, 440, 161, 16, 5, 271, 464, 99, 395, 54, 205, 314, 436, 458, 488, 397, 362, 105, 122, 216, 234, 113, 6, 318, 296, 498, 348, 265, 116, 289, 15, 284, 29, 403, 58, 95, 30, 94, 225, 299, 98, 372, 455, 337, 204, 256, 338, 62, 250, 427, 429, 128, 247, 40, 165, 496, 36, 215, 383, 255, 293, 177, 38, 86, 211, 156, 102, 120, 282, 483, 375, 371, 444, 450, 266, 168, 497, 414, 81, 452, 97, 468, 263, 434, 251, 108, 4, 25, 292, 421, 325, 491, 295, 298, 197, 330, 479, 277, 69, 181, 440, 16, 161, 271, 464, 5, 99, 54, 205, 314, 436, 458, 488, 216, 348, 122, 362, 234, 113, 318, 296, 498, 6, 265, 116, 356, 105, 289, 454, 15, 403, 284, 353, 29, 95, 17, 94, 166, 300, 98, 372, 455, 462, 256, 204, 338, 250, 429, 427, 165, 36, 247, 40, 496, 128, 215, 383, 255, 293, 177, 38, 86, 156, 102, 282, 120, 211, 483, 371, 444, 375, 450, 266, 168, 97, 452, 497, 414, 81, 4, 468, 434, 251, 292, 25, 263, 108, 421, 325, 491, 400, 277, 295, 298, 197, 330, 479, 69, 181, 16, 161, 464, 99, 271, 5, 205, 395, 458, 440, 314, 54, 436, 488, 234, 362, 216, 356, 348, 105, 122, 113, 498, 318, 6, 296, 116, 289, 265, 454, 403, 29, 284, 15, 353, 95, 17, 414, 292, 298, 395, 181, 348, 105, 351, 188, 498, 369, 357, 410, 78, 246, 221, 23, 278, 494, 418, 53, 162, 419, 236, 447, 112, 101, 139, 96, 174, 80, 30, 94, 166, 225, 299, 442, 98, 196, 372, 462, 455, 337, 256, 204, 338, 62, 429, 427, 250, 247, 36, 496, 165, 40, 215, 383, 128, 255, 293, 177, 38, 86, 120, 156, 102, 282, 211, 483, 444, 375, 371, 450, 266, 452, 97, 81, 168, 414, 497, 263, 434, 251, 468, 292, 25, 4, 108, 69, 325, 491, 400, 479, 298, 295, 421, 197, 330, 277, 436, 458, 181, 440, 464, 16, 161, 5, 99, 395, 314, 205, 271, 54, 377, 397, 488, 362, 122, 216, 116, 6, 113, 296, 318, 498, 234, 265, 289, 454, 58, 284, 94, 166, 225, 300, 299, 98, 442, 196, 372, 455, 462, 337, 256, 204, 62, 338, 429, 427, 250, 215, 36, 40, 165, 247, 128, 383, 496, 255, 293, 38, 177, 86, 156, 120, 102, 282, 211, 483, 444, 371, 375, 450, 452, 266, 97, 168, 81, 497, 414, 468, 263, 434, 251, 292, 4, 25, 108, 69, 325, 491, 400, 479, 298, 295, 421, 330, 277, 197, 440, 436, 458, 181, 464, 16, 161, 5, 99, 395, 314, 205, 54, 271, 377, 397, 488, 362, 122, 216, 116, 6, 113, 318, 296, 498, 234, 265, 289, 454, 58, 284, 30, 94, 225, 299, 442, 196, 372, 462, 455, 337, 338, 62, 429, 250, 427, 496, 40, 165, 215, 36, 255, 177, 38, 293, 86, 156, 102, 120, 211, 483, 444, 375, 371, 97, 497, 452, 414, 450, 81, 168, 266, 292, 4, 263, 434, 251, 108, 25, 468, 421, 400, 325, 277, 491, 197, 295, 330, 298, 479, 69, 161, 16, 5, 464, 99, 271, 205, 54, 395, 436, 458, 314, 181, 440, 488, 362, 122, 216, 498, 93, 356, 348, 105, 113, 296, 318, 234, 265, 403, 478, 116, 289, 454, 58, 29, 17, 15, 353, 95, 425, 30, 94, 166, 225, 300, 299, 442, 372, 462, 455, 337, 256, 338, 62, 427, 429, 250, 36, 496, 247, 40, 215, 383, 128, 165, 255, 177, 38, 293, 86, 211, 156, 102, 120, 282, 483, 444, 375, 371, 450, 266, 452, 97, 168, 414, 497, 81, 468, 263, 434, 251, 25, 4, 292, 108, 491, 325, 400, 295, 298, 197, 330, 421, 479, 277, 69, 436, 458, 181, 440, 271, 16, 464, 161, 5, 99, 395, 314, 54, 205, 488, 216, 362, 397, 122, 234, 6, 113, 498, 265, 318, 296, 105, 289, 116, 454, 58, 15, 353, 29, 166, 442, 196, 372, 462, 337, 256, 338, 429, 427, 128, 215, 383, 165, 496, 40, 247, 255, 293, 38, 177, 86, 102, 282, 211, 156, 120, 483, 444, 375, 371, 81, 168, 97, 497, 414, 266, 4, 263, 434, 251, 108, 292, 468, 25, 421, 277, 197, 400, 491, 325, 330, 479, 69, 295, 16, 161, 314, 5, 271, 99, 205, 464, 54, 458, 440, 395, 436, 181, 122, 362, 216, 478, 93, 113, 318, 12, 296, 498, 356, 348, 105, 265, 116, 192, 29, 403, 234, 353, 17, 58, 15, 95, 284, 454, 425, 6, 377, 132, 289, 300, 442, 196, 372, 462, 204, 256, 338, 62, 429, 250, 36, 40, 215, 496, 383, 165, 128, 247, 255, 177, 293, 86, 38, 156, 282, 211, 120, 102, 483, 375, 371, 444, 97, 497, 168, 414, 266, 450, 81, 452, 4, 292, 263, 434, 251, 108, 25, 468, 421, 277, 400, 325, 197, 491, 295, 330, 69, 479, 161, 16, 5, 464, 99, 54, 205, 395, 314, 440, 271, 436, 458, 181, 488, 362, 122, 216, 498, 93, 356, 348, 105, 113, 296, 318, 234, 265, 403, 478, 116, 289, 454, 58, 29, 17, 15, 353, 95, 397, 425, 372, 462, 455, 256, 338, 215, 36, 383, 177, 211, 282, 120, 102, 444, 452, 168, 81, 4, 263, 434, 69, 197, 400, 330, 491, 295, 479, 277, 99, 440, 205, 16, 181, 458, 436, 271, 5, 161, 314, 54, 95, 425, 17, 29, 397, 265, 353, 377, 284, 15, 454, 351, 289, 58, 488, 116, 6, 188, 127, 206, 105, 348, 356, 498, 77, 195, 362, 122, 254, 146, 281, 132, 113, 318, 296, 234, 12, 403, 233, 192, 478, 93, 484, 1, 45, 290, 493, 164, 178, 111, 145, 301, 474, 49, 361, 136, 27, 200, 273, 210, 166, 225, 300, 299, 442, 98, 196, 372, 455, 462, 337, 204, 256, 62, 338, 429, 250, 427, 36, 215, 247, 383, 40, 496, 128, 177, 293, 38, 86, 156, 102, 120, 282, 211, 483, 444, 375, 371, 452, 450, 266, 97, 168, 414, 497, 434, 263, 468, 251, 108, 25, 4, 292, 69, 325, 491, 421, 400, 277, 295, 197, 330, 298, 479, 181, 436, 440, 271, 16, 464, 161, 5, 99, 395, 54, 314, 205, 458, 488, 397, 105, 362, 216, 122, 234, 6, 296, 318, 113, 116, 498, 265, 289, 454, 15, 284, 353, 403, 95, 17, 98, 455, 256, 338, 427, 429, 255, 38, 177, 293, 120, 282, 156, 211, 444, 375, 483, 371, 266, 168, 97, 414, 450, 292, 108, 25, 468, 4, 197, 325, 277, 330, 295, 298, 69, 479, 491, 421, 54, 99, 458, 205, 436, 181, 314, 161, 464, 16, 440, 271, 5, 425, 191, 22, 127, 206, 403, 95, 254, 6, 29, 245, 77, 351, 17, 397, 118, 353, 233, 377, 132, 192, 58, 284, 146, 289, 454, 15, 281, 265, 116, 105, 488, 216, 478, 93, 362, 122, 356, 348, 234, 12, 113, 296, 318, 420, 270, 380, 1, 493, 30, 225, 300, 299, 442, 196, 372, 462, 455, 337, 204, 62, 429, 250, 383, 165, 215, 36, 128, 496, 247, 38, 177, 86, 293, 102, 156, 444, 483, 371, 375, 81, 497, 168, 452, 450, 266, 4, 263, 468, 434, 251, 292, 108, 25, 298, 277, 421, 479, 491, 197, 295, 69, 400, 16, 161, 5, 99, 464, 54, 205, 458, 395, 436, 271, 181, 440, 216, 118, 132, 362, 234, 113, 281, 192, 296, 318, 498, 93, 6, 478, 356, 348, 265, 29, 12, 105, 116, 403, 353, 17, 454, 284, 95, 58, 289, 425, 146, 377, 488, 30, 94, 166, 300, 442, 98, 196, 455, 462, 337, 256, 204, 338, 429, 250, 427, 36, 247, 496, 40, 215, 255, 177, 293, 86, 38, 102, 282, 156, 120, 211, 483, 444, 375, 371, 450, 266, 97, 168, 497, 414, 81, 452, 4, 468, 263, 434, 251, 292, 25, 108, 421, 325, 491, 400, 277, 295, 298, 197, 330, 479, 69, 181, 440, 16, 161, 464, 99, 271, 5, 205, 395, 458, 314, 54, 436, 488, 234, 362, 216, 356, 348, 105, 122, 113, 318, 6, 296, 498, 116, 289, 265, 454, 403, 29, 284, 15, 353, 95, 17, 300, 98, 196, 337, 204, 338, 62, 250, 40, 496, 165, 128, 255, 38, 293, 211, 156, 120, 375, 444, 452, 450, 168, 497, 97, 81, 266, 468, 434, 108, 25, 4, 263, 292, 277, 197, 298, 479, 491, 400, 421, 295, 325, 99, 395, 314, 54, 436, 464, 458, 440, 161, 181, 16, 271, 5, 318, 113, 245, 206, 254, 77, 296, 351, 403, 127, 22, 17, 195, 146, 95, 132, 192, 118, 425, 353, 29, 397, 377, 15, 191, 281, 58, 289, 284, 478, 12, 265, 116, 93, 356, 105, 488, 362, 216, 188, 234, 498, 6, 122, 30, 94, 166, 225, 299, 98, 442, 196, 372, 455, 462, 337, 204, 256, 338, 62, 427, 429, 250, 247, 36, 215, 165, 496, 40, 128, 255, 293, 177, 38, 86, 211, 156, 120, 102, 282, 483, 444, 371, 375, 450, 452, 266, 97, 414, 168, 497, 81, 251, 468, 263, 434, 4, 25, 292, 108, 69, 325, 295, 491, 400, 298, 421, 479, 330, 277, 197, 458, 436, 440, 181, 16, 161, 271, 464, 99, 5, 395, 314, 205, 54, 377, 488, 362, 397, 122, 216, 6, 265, 116, 113, 296, 318, 498, 234, 289, 454, 58, 15, 353, 94, 225, 300, 98, 196, 462, 204, 256, 62, 338, 427, 429, 250, 165, 383, 36, 215, 496, 40, 247, 255, 177, 86, 38, 102, 282, 120, 211, 156, 371, 444, 375, 483, 497, 452, 168, 97, 414, 266, 81, 450, 263, 292, 468, 434, 251, 108, 25, 277, 421, 325, 197, 491, 400, 298, 295, 69, 330, 479, 16, 5, 271, 464, 99, 54, 205, 395, 161, 440, 458, 436, 314, 181, 488, 93, 362, 122, 498, 216, 478, 356, 348, 113, 296, 318, 425, 265, 403, 12, 105, 116, 289, 454, 29, 95, 15, 397, 284, 353, 17, 94, 166, 225, 300, 442, 98, 196, 372, 455, 462, 337, 256, 204, 338, 62, 427, 429, 250, 247, 36, 128, 215, 165, 496, 40, 383, 255, 293, 177, 38, 86, 211, 156, 120, 102, 282, 483, 444, 375, 371, 450, 452, 266, 97, 414, 168, 497, 81, 251, 468, 263, 434, 25, 4, 292, 108, 69, 325, 295, 491, 400, 298, 421, 479, 330, 277, 197, 458, 436, 440, 181, 16, 161, 271, 464, 99, 5, 395, 314, 205, 54, 377, 488, 362, 397, 122, 216, 6, 265, 116, 113, 296, 318, 498, 234, 289, 454, 58, 15, 353, 30, 94, 166, 225, 299, 442, 98, 196, 372, 462, 455, 337, 256, 204, 338, 62, 429, 427, 250, 247, 36, 496, 165, 40, 215, 383, 128, 255, 293, 177, 38, 86, 120, 156, 102, 282, 211, 483, 444, 375, 371, 450, 266, 452, 97, 81, 168, 414, 497, 263, 434, 251, 468, 292, 25, 4, 108, 69, 325, 491, 400, 479, 298, 295, 421, 197, 330, 277, 436, 458, 181, 440, 464, 16, 161, 5, 99, 395, 314, 205, 271, 54, 377, 397, 488, 362, 122, 216, 116, 6, 113, 296, 318, 498, 234, 265, 289, 454, 58, 284, 30, 94, 166, 225, 299, 98, 196, 372, 462, 455, 337, 204, 256, 62, 338, 427, 429, 250, 36, 215, 40, 247, 128, 383, 165, 255, 177, 293, 38, 86, 211, 156, 102, 120, 282, 444, 371, 483, 375, 450, 452, 266, 97, 414, 168, 497, 81, 251, 263, 468, 434, 25, 4, 292, 108, 69, 325, 491, 400, 295, 298, 330, 421, 479, 277, 197, 436, 458, 181, 440, 271, 16, 464, 161, 5, 99, 395, 314, 54, 205, 488, 216, 362, 397, 122, 234, 6, 113, 265, 318, 296, 498, 105, 289, 116, 454, 58, 15, 353, 29, 30, 166, 225, 300, 299, 98, 442, 196, 372, 462, 455, 337, 256, 62, 338, 250, 429, 427, 36, 247, 496, 128, 40, 215, 383, 165, 255, 177, 38, 293, 86, 211, 156, 102, 120, 483, 444, 375, 371, 452, 450, 266, 97, 168, 414, 497, 81, 263, 434, 468, 251, 25, 4, 292, 108, 69, 491, 325, 400, 295, 298, 197, 330, 421, 479, 277, 436, 458, 181, 440, 271, 16, 464, 161, 5, 99, 395, 314, 54, 205, 488, 216, 362, 397, 122, 234, 6, 113, 498, 265, 318, 296, 105, 289, 116, 454, 58, 15, 353, 29, 30, 94, 166, 300, 299, 98, 442, 196, 372, 455, 462, 337, 256, 204, 338, 427, 429, 250, 36, 247, 496, 215, 165, 128, 383, 255, 293, 38, 177, 86, 156, 120, 211, 102, 282, 483, 444, 375, 371, 450, 452, 266, 97, 168, 81, 497, 414, 468, 263, 434, 251, 25, 4, 292, 108, 69, 325, 491, 400, 298, 295, 479, 421, 330, 277, 197, 440, 436, 458, 181, 271, 464, 16, 161, 205, 99, 5, 395, 314, 54, 377, 397, 488, 362, 122, 216, 116, 6, 113, 296, 318, 498, 234, 454, 105, 265, 289, 58, 284, 15, 30, 300, 299, 442, 196, 372, 462, 455, 337, 204, 256, 338, 62, 429, 165, 215, 36, 496, 128, 247, 40, 383, 255, 293, 177, 86, 38, 156, 102, 282, 120, 211, 375, 483, 444, 371, 450, 266, 497, 97, 168, 81, 414, 452, 468, 263, 434, 251, 4, 25, 108, 292, 421, 325, 491, 400, 298, 277, 197, 330, 479, 295, 69, 181, 16, 161, 464, 5, 271, 99, 395, 314, 54, 205, 458, 440, 436, 488, 216, 362, 348, 105, 122, 498, 6, 113, 296, 318, 116, 289, 356, 234, 265, 454, 58, 29, 403, 425, 284, 15, 94, 166, 225, 300, 299, 442, 98, 372, 462, 337, 256, 338, 62, 427, 429, 250, 36, 165, 40, 247, 496, 128, 215, 383, 255, 293, 177, 86, 38, 211, 156, 102, 282, 120, 483, 375, 371, 444, 450, 168, 97, 452, 497, 414, 81, 468, 4, 434, 251, 108, 25, 263, 292, 421, 325, 491, 400, 295, 277, 197, 298, 330, 479, 69, 181, 440, 16, 161, 464, 271, 5, 99, 395, 54, 205, 314, 436, 458, 488, 216, 105, 122, 362, 498, 234, 113, 296, 318, 116, 6, 348, 265, 289, 454, 15, 403, 284, 353, 29, 95, 166, 300, 299, 98, 196, 462, 455, 256, 204, 62, 250, 427, 247, 496, 383, 128, 40, 215, 165, 36, 255, 38, 293, 86, 177, 156, 120, 102, 211, 282, 483, 444, 371, 375, 168, 97, 414, 452, 497, 450, 81, 266, 4, 263, 292, 434, 251, 108, 25, 468, 421, 400, 325, 277, 491, 197, 295, 298, 330, 69, 479, 16, 161, 271, 5, 464, 99, 205, 395, 314, 54, 458, 436, 181, 440, 488, 216, 356, 362, 234, 348, 122, 498, 105, 296, 318, 113, 265, 6, 289, 93, 403, 116, 454, 58, 29, 95, 284, 15, 353, 196, 204, 62, 427, 429, 250, 496, 165, 128, 40, 383, 215, 247, 255, 86, 293, 177, 282, 102, 444, 483, 375, 371, 497, 97, 81, 168, 450, 414, 266, 452, 25, 4, 434, 251, 108, 292, 468, 263, 197, 277, 479, 400, 295, 69, 325, 330, 491, 314, 5, 99, 205, 161, 54, 271, 464, 436, 181, 458, 395, 440, 16, 122, 425, 113, 498, 146, 281, 318, 132, 296, 6, 195, 118, 192, 12, 403, 397, 93, 356, 17, 29, 105, 351, 478, 348, 353, 95, 377, 289, 15, 265, 116, 58, 284, 488, 216, 234, 454, 362, 30, 166, 225, 299, 442, 372, 462, 337, 338, 40, 215, 496, 36, 383, 255, 120, 211, 444, 483, 168, 97, 81, 497, 414, 452, 4, 251, 263, 25, 292, 434, 277, 479, 197, 298, 69, 400, 330, 421, 491, 295, 325, 5, 54, 99, 314, 395, 205, 458, 436, 440, 181, 161, 464, 271, 296, 234, 254, 206, 233, 77, 245, 195, 146, 351, 29, 403, 281, 95, 425, 127, 132, 353, 17, 192, 15, 58, 397, 118, 12, 289, 454, 377, 93, 478, 265, 116, 22, 356, 348, 105, 488, 362, 216, 122, 6, 191, 113, 498, 318, 337, 256, 204, 338, 62, 40, 383, 128, 165, 86, 120, 102, 156, 282, 375, 450, 168, 452, 497, 97, 266, 468, 108, 4, 263, 434, 325, 298, 69, 277, 197, 479, 421, 440, 99, 54, 436, 464, 161, 16, 314, 395, 205, 5, 458, 403, 188, 29, 17, 95, 191, 22, 127, 254, 353, 425, 77, 284, 377, 454, 58, 397, 206, 195, 265, 116, 488, 216, 132, 192, 356, 118, 122, 362, 289, 234, 6, 233, 498, 15, 245, 478, 93, 113, 281, 12, 296, 318, 270, 493, 420, 380, 484, 1, 331, 45, 290, 111, 164, 178, 30, 94, 166, 225, 299, 442, 196, 372, 455, 462, 337, 256, 204, 338, 62, 429, 427, 250, 383, 247, 36, 215, 165, 496, 40, 128, 255, 293, 177, 38, 86, 211, 156, 120, 102, 282, 483, 444, 371, 375, 450, 452, 266, 97, 414, 168, 497, 81, 251, 468, 263, 434, 4, 25, 292, 108, 69, 325, 295, 491, 400, 298, 421, 479, 330, 277, 197, 458, 436, 440, 181, 16, 161, 271, 464, 99, 5, 395, 314, 205, 54, 377, 488, 362, 397, 122, 216, 6, 265, 116, 113, 296, 318, 498, 234, 289, 454, 58, 15, 353, 166, 225, 299, 98, 196, 372, 462, 455, 256, 204, 62, 250, 427, 429, 247, 36, 40, 165, 128, 215, 383, 496, 255, 293, 177, 86, 38, 156, 282, 102, 211, 120, 483, 444, 375, 371, 450, 266, 97, 81, 497, 414, 168, 452, 468, 263, 434, 251, 4, 25, 108, 292, 421, 325, 491, 400, 298, 295, 277, 197, 330, 479, 69, 181, 440, 16, 161, 464, 5, 271, 99, 395, 314, 54, 458, 205, 436, 488, 216, 362, 348, 105, 122, 6, 113, 296, 318, 498, 116, 289, 356, 234, 265, 454, 58, 29, 403, 284, 15, 353, 30, 94, 166, 300, 299, 442, 98, 196, 372, 462, 455, 337, 256, 204, 338, 427, 250, 429, 247, 215, 36, 40, 496, 128, 165, 383, 255, 293, 177, 38, 86, 156, 120, 102, 282, 211, 483, 444, 375, 371, 450, 452, 266, 97, 168, 81, 497, 414, 251, 468, 263, 434, 25, 4, 292, 108, 69, 325, 491, 400, 298, 295, 479, 421, 330, 277, 197, 440, 436, 458, 181, 464, 16, 161, 205, 271, 99, 5, 395, 314, 54, 377, 397, 488, 362, 122, 216, 116, 6, 113, 296, 318, 498, 234, 454, 265, 289, 58, 284, 15, 94, 166, 225, 300, 299, 98, 442, 196, 372, 455, 462, 337, 256, 204, 62, 338, 429, 427, 250, 215, 36, 40, 165, 247, 128, 383, 496, 255, 293, 38, 177, 86, 156, 120, 102, 282, 211, 483, 444, 371, 375, 450, 452, 266, 97, 168, 81, 497, 414, 468, 263, 434, 251, 292, 4, 25, 108, 69, 325, 491, 400, 479, 298, 295, 421, 330, 277, 197, 440, 436, 458, 181, 464, 16, 161, 5, 99, 395, 314, 205, 54, 271, 377, 397, 488, 362, 122, 216, 116, 6, 113, 318, 296, 498, 234, 265, 289, 454, 58, 284, 455, 204, 256, 427, 247, 128, 165, 36, 383, 177, 38, 86, 156, 282, 102, 375, 371, 483, 168, 450, 414, 97, 266, 81, 497, 452, 108, 251, 468, 4, 421, 277, 197, 295, 330, 298, 400, 69, 479, 325, 54, 205, 5, 395, 314, 458, 161, 16, 436, 464, 440, 296, 191, 318, 6, 22, 245, 233, 77, 403, 17, 254, 29, 95, 127, 188, 118, 281, 132, 192, 353, 425, 351, 397, 15, 377, 58, 195, 289, 454, 284, 146, 12, 265, 116, 356, 348, 105, 93, 362, 488, 122, 234, 478, 216, 498, 113, 409, 270, 493, 300, 98, 196, 372, 455, 462, 337, 204, 250, 429, 427, 128, 383, 165, 247, 255, 177, 38, 86, 293, 282, 102, 156, 211, 375, 371, 483, 81, 452, 497, 450, 266, 263, 4, 251, 25, 108, 468, 197, 298, 277, 479, 325, 295, 421, 330, 69, 491, 400, 16, 5, 395, 99, 464, 54, 271, 458, 436, 181, 440, 161, 362, 216, 195, 146, 122, 351, 113, 498, 296, 318, 234, 281, 118, 132, 12, 478, 425, 93, 356, 348, 403, 29, 77, 192, 105, 17, 95, 6, 284, 15, 116, 58, 397, 289, 377, 254, 265, 454, 488, 30, 94, 225, 300, 299, 98, 442, 196, 372, 455, 462, 337, 204, 256, 62, 338, 429, 427, 250, 215, 36, 40, 165, 247, 128, 383, 496, 255, 293, 38, 177, 86, 156, 120, 102, 282, 211, 483, 444, 371, 375, 450, 452, 266, 97, 168, 81, 497, 414, 468, 263, 434, 251, 292, 4, 25, 108, 69, 325, 491, 400, 479, 298, 295, 421, 330, 277, 197, 440, 436, 458, 181, 464, 16, 161, 5, 99, 395, 314, 205, 54, 271, 377, 397, 488, 362, 122, 216, 116, 6, 113, 318, 296, 498, 234, 265, 289, 454, 58, 284, 299, 98, 62, 338, 429, 383, 40, 496, 247, 36, 215, 128, 255, 293, 120, 282, 444, 371, 81, 497, 452, 414, 97, 468, 251, 292, 263, 25, 434, 330, 491, 400, 325, 479, 295, 421, 277, 298, 69, 395, 205, 458, 16, 54, 161, 271, 181, 5, 464, 314, 99, 397, 29, 17, 281, 191, 353, 216, 377, 22, 206, 15, 454, 284, 254, 116, 488, 265, 188, 362, 245, 77, 351, 105, 127, 118, 348, 289, 498, 132, 122, 233, 146, 192, 113, 12, 478, 195, 93, 425, 45, 290, 111, 164, 178, 484, 474, 145, 27, 136, 442, 196, 372, 62, 338, 427, 165, 383, 128, 255, 86, 177, 293, 282, 156, 120, 211, 371, 375, 444, 414, 168, 97, 81, 266, 450, 434, 251, 25, 108, 292, 468, 4, 263, 277, 69, 330, 295, 197, 479, 421, 298, 325, 400, 491, 5, 395, 99, 205, 54, 314, 458, 440, 271, 161, 464, 16, 436, 181, 113, 318, 6, 351, 195, 296, 425, 281, 403, 118, 132, 77, 146, 192, 17, 12, 29, 397, 478, 95, 93, 348, 353, 254, 377, 356, 105, 15, 454, 58, 265, 116, 284, 488, 216, 289, 233, 362, 234, 122, 498, 30, 94, 166, 225, 300, 299, 98, 442, 196, 372, 455, 337, 204, 256, 62, 338, 429, 427, 250, 215, 36, 40, 165, 247, 128, 383, 496, 255, 293, 38, 177, 86, 156, 120, 102, 282, 211, 483, 444, 371, 375, 450, 452, 266, 97, 168, 81, 497, 414, 468, 263, 434, 251, 292, 4, 25, 108, 69, 325, 491, 400, 479, 298, 295, 421, 330, 277, 197, 440, 436, 458, 181, 464, 16, 161, 5, 99, 395, 314, 205, 54, 271, 377, 397, 488, 362, 122, 216, 116, 6, 113, 318, 296, 498, 234, 265, 289, 454, 58, 284, 94, 225, 98, 372, 455, 337, 204, 338, 62, 427, 250, 429, 496, 165, 36, 247, 40, 383, 128, 255, 177, 38, 293, 86, 156, 102, 282, 120, 211, 444, 371, 375, 483, 97, 497, 452, 414, 168, 450, 81, 266, 292, 4, 263, 434, 251, 108, 25, 468, 421, 400, 325, 277, 491, 197, 295, 298, 330, 479, 69, 16, 161, 5, 464, 99, 271, 205, 395, 314, 54, 436, 458, 181, 440, 488, 216, 362, 122, 234, 93, 356, 348, 105, 113, 296, 318, 498, 265, 6, 478, 403, 116, 289, 454, 58, 29, 95, 284, 15, 353, 30, 300, 299, 98, 196, 462, 455, 337, 256, 204, 62, 338, 250, 496, 40, 165, 215, 383, 247, 36, 255, 177, 86, 293, 38, 156, 102, 282, 120, 211, 483, 444, 375, 97, 497, 452, 414, 168, 266, 81, 450, 4, 292, 263, 434, 251, 108, 25, 468, 421, 277, 400, 325, 197, 491, 295, 298, 330, 69, 479, 16, 161, 5, 464, 99, 54, 271, 205, 395, 314, 440, 436, 458, 181, 488, 216, 362, 498, 122, 234, 93, 356, 348, 105, 113, 296, 318, 6, 265, 403, 478, 116, 289, 454, 58, 29, 17, 15, 353, 95, 30, 94, 166, 225, 300, 442, 98, 196, 372, 455, 462, 337, 256, 204, 62, 429, 250, 427, 36, 128, 247, 40, 215, 383, 165, 496, 255, 293, 177, 38, 86, 211, 156, 102, 120, 282, 444, 483, 375, 371, 450, 266, 452, 97, 414, 168, 81, 497, 468, 263, 434, 251, 25, 292, 4, 108, 69, 325, 491, 295, 400, 298, 421, 197, 479, 330, 277, 436, 458, 181, 440, 16, 161, 271, 464, 99, 5, 395, 314, 205, 54, 377, 488, 362, 397, 122, 216, 6, 265, 116, 113, 296, 318, 234, 289, 498, 454, 58, 15, 353, 300, 299, 442, 98, 196, 372, 462, 455, 337, 204, 256, 338, 62, 427, 250, 429, 247, 40, 128, 215, 165, 383, 36, 496, 255, 293, 177, 38, 86, 211, 120, 156, 102, 282, 444, 375, 371, 483, 266, 450, 168, 97, 497, 81, 414, 452, 468, 4, 263, 434, 251, 108, 25, 292, 325, 491, 400, 421, 298, 197, 295, 330, 69, 479, 277, 181, 436, 440, 161, 271, 16, 464, 5, 99, 395, 314, 54, 205, 458, 488, 216, 105, 362, 122, 265, 6, 113, 296, 318, 498, 289, 58, 234, 116, 454, 284, 403, 425, 15, 353, 299, 442, 196, 62, 427, 429, 250, 496, 36, 215, 40, 255, 38, 293, 156, 120, 211, 483, 444, 371, 414, 450, 97, 81, 266, 108, 263, 251, 25, 4, 434, 292, 295, 421, 325, 298, 400, 491, 330, 99, 205, 395, 271, 181, 314, 436, 440, 464, 216, 188, 191, 377, 206, 245, 22, 233, 254, 353, 15, 284, 425, 58, 289, 488, 498, 195, 265, 77, 351, 146, 362, 127, 105, 192, 348, 132, 397, 122, 118, 6, 113, 454, 296, 318, 17, 403, 234, 93, 95, 281, 12, 478, 356, 484, 1, 290, 45, 145, 49, 474, 299, 98, 372, 455, 337, 62, 338, 427, 250, 247, 40, 36, 128, 496, 255, 38, 293, 177, 102, 282, 120, 156, 371, 444, 483, 375, 97, 497, 168, 450, 266, 414, 25, 251, 434, 468, 292, 4, 108, 277, 197, 298, 421, 69, 479, 325, 295, 400, 330, 491, 5, 314, 99, 54, 464, 205, 458, 271, 161, 436, 181, 16, 395, 440, 281, 122, 498, 113, 118, 318, 192, 296, 146, 132, 12, 478, 93, 403, 105, 17, 348, 29, 95, 195, 356, 265, 353, 425, 397, 15, 6, 377, 116, 289, 58, 284, 234, 351, 454, 362, 300, 196, 455, 204, 62, 427, 383, 128, 165, 247, 255, 177, 38, 293, 86, 102, 211, 282, 371, 497, 81, 452, 266, 450, 4, 434, 251, 292, 108, 25, 263, 468, 400, 277, 197, 69, 330, 491, 298, 421, 205, 99, 54, 395, 436, 161, 16, 314, 458, 181, 5, 271, 318, 113, 425, 403, 188, 6, 17, 22, 127, 296, 95, 265, 191, 206, 245, 233, 351, 29, 397, 77, 195, 353, 377, 284, 15, 454, 254, 118, 289, 58, 146, 116, 488, 132, 478, 348, 105, 216, 362, 356, 498, 234, 122, 270, 380, 409, 1, 493, 30, 94, 166, 225, 300, 299, 442, 98, 372, 455, 462, 337, 256, 204, 62, 338, 429, 427, 250, 247, 496, 36, 40, 165, 383, 128, 215, 255, 293, 177, 38, 86, 211, 120, 156, 102, 282, 483, 444, 375, 371, 450, 266, 452, 97, 81, 168, 414, 497, 263, 434, 251, 468, 292, 25, 4, 108, 69, 325, 491, 400, 479, 298, 295, 197, 421, 330, 277, 440, 436, 458, 181, 464, 16, 161, 5, 99, 395, 314, 205, 54, 271, 377, 397, 488, 362, 122, 216, 116, 6, 113, 318, 296, 498, 234, 265, 289, 454, 58, 284, 94, 166, 225, 300, 299, 98, 442, 196, 372, 455, 462, 337, 256, 204, 62, 338, 429, 427, 250, 215, 36, 40, 165, 247, 128, 383, 496, 255, 293, 38, 177, 86, 156, 120, 102, 282, 211, 483, 444, 371, 375, 450, 452, 266, 97, 168, 81, 497, 414, 468, 263, 434, 251, 292, 4, 25, 108, 69, 325, 491, 400, 479, 298, 295, 421, 330, 277, 197, 440, 436, 458, 181, 464, 16, 161, 5, 99, 395, 314, 205, 54, 271, 377, 397, 488, 362, 122, 216, 116, 6, 113, 318, 296, 498, 234, 265, 289, 454, 58, 284, 30, 166, 300, 98, 442, 196, 372, 462, 455, 337, 256, 204, 338, 62, 429, 250, 427, 165, 36, 496, 215, 40, 383, 247, 128, 177, 293, 86, 38, 156, 102, 282, 120, 211, 483, 444, 375, 371, 452, 450, 266, 97, 168, 414, 497, 81, 434, 263, 468, 251, 25, 108, 4, 292, 69, 325, 491, 421, 400, 295, 277, 197, 298, 330, 479, 181, 436, 440, 271, 16, 464, 161, 5, 99, 395, 54, 205, 314, 458, 488, 397, 105, 362, 216, 122, 234, 6, 296, 318, 113, 116, 498, 265, 289, 454, 15, 284, 353, 403, 95, 30, 94, 166, 225, 300, 299, 442, 196, 372, 462, 455, 337, 204, 256, 62, 338, 427, 429, 250, 128, 36, 40, 383, 165, 215, 247, 496, 255, 293, 177, 38, 86, 156, 120, 102, 282, 211, 483, 444, 371, 375, 450, 452, 266, 97, 81, 168, 497, 414, 468, 263, 434, 251, 292, 4, 25, 108, 69, 325, 491, 400, 479, 298, 295, 421, 330, 277, 197, 440, 436, 458, 181, 464, 16, 161, 5, 99, 395, 314, 205, 54, 271, 377, 397, 488, 362, 122, 216, 116, 6, 113, 318, 296, 498, 234, 265, 289, 454, 58, 284, 30, 94, 225, 300, 98, 442, 196, 372, 462, 455, 337, 256, 204, 62, 338, 429, 250, 427, 36, 496, 215, 40, 383, 165, 128, 177, 293, 86, 38, 211, 156, 102, 120, 282, 483, 375, 444, 371, 450, 452, 266, 97, 168, 414, 497, 81, 434, 263, 468, 251, 25, 108, 4, 292, 69, 325, 491, 421, 400, 295, 277, 298, 330, 197, 479, 181, 436, 440, 271, 16, 464, 161, 5, 99, 395, 54, 205, 314, 458, 488, 397, 105, 362, 216, 122, 234, 6, 296, 318, 113, 116, 498, 265, 289, 454, 15, 284, 353, 403, 95, 30, 225, 300, 299, 442, 196, 372, 455, 462, 337, 256, 204, 338, 62, 429, 427, 250, 36, 496, 128, 383, 247, 40, 215, 165, 255, 177, 38, 293, 86, 211, 156, 102, 120, 282, 483, 444, 375, 371, 450, 266, 452, 97, 168, 414, 497, 81, 468, 263, 434, 251, 4, 25, 292, 108, 491, 325, 400, 295, 298, 197, 330, 421, 479, 277, 69, 436, 458, 181, 440, 271, 16, 464, 161, 5, 99, 395, 314, 54, 205, 488, 216, 362, 397, 122, 234, 6, 113, 498, 265, 318, 296, 105, 289, 116, 454, 58, 15, 353, 29, 30, 94, 225, 300, 299, 98, 442, 196, 372, 455, 462, 337, 204, 256, 62, 338, 429, 427, 250, 215, 36, 40, 165, 247, 128, 383, 496, 255, 293, 38, 177, 86, 156, 120, 102, 282, 211, 483, 444, 371, 375, 450, 452, 266, 97, 168, 81, 497, 414, 468, 263, 434, 251, 292, 4, 25, 108, 69, 325, 491, 400, 479, 298, 295, 421, 330, 277, 197, 440, 436, 458, 181, 464, 16, 161, 5, 99, 395, 314, 205, 54, 271, 377, 397, 488, 362, 122, 216, 116, 6, 113, 318, 296, 498, 234, 265, 289, 454, 58, 284, 94, 442, 98, 372, 462, 337, 256, 338, 62, 427, 250, 429, 36, 215, 496, 383, 247, 128, 40, 165, 255, 293, 86, 38, 177, 156, 102, 282, 120, 211, 483, 444, 371, 375, 168, 97, 497, 414, 452, 450, 81, 266, 292, 4, 263, 434, 251, 108, 25, 468, 421, 400, 325, 277, 491, 69, 295, 298, 330, 479, 16, 161, 5, 464, 99, 271, 205, 395, 314, 440, 54, 436, 458, 181, 488, 216, 362, 122, 234, 498, 93, 356, 348, 105, 113, 296, 318, 265, 6, 478, 403, 116, 289, 454, 58, 29, 95, 284, 15, 353, 462, 204, 256, 429, 128, 383, 247, 165, 86, 102, 211, 282, 371, 375, 483, 414, 168, 452, 497, 81, 251, 468, 263, 295, 479, 197, 330, 421, 69, 298, 325, 400, 161, 54, 464, 271, 205, 436, 16, 395, 440, 5, 458, 314, 403, 397, 22, 29, 17, 146, 353, 95, 188, 191, 6, 15, 284, 216, 58, 206, 289, 377, 116, 233, 265, 245, 254, 105, 488, 281, 348, 195, 118, 362, 122, 132, 192, 318, 113, 454, 296, 498, 77, 12, 234, 93, 356, 290, 484, 1, 178, 45, 493, 111, 474, 164, 27, 301, 49, 361]
  
          assert NdcgScore(data, preds, top_k=20) == pytest.approx(0, abs=1e-2)
  
          preds2 = exp.recommend(users = [1, 2], exclude_known=False)
          assert preds2['user'].unique().tolist() == [1,2]
  
          preds = exp.recommend(exclude_known=True)
          joined_preds = preds.join(
              data.set_index(['user', 'item']),
              on=['user','item'], how='inner', rsuffix="_right"
          )
          assert len(joined_preds) == 0