In [1]:
%matplotlib inline
import pandas as pd
import sys
import shutil
from alpenglow.experiments import BatchFactorExperiment, ExternalModelExperiment
from alpenglow.evaluation import DcgScore
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
In [2]:
data = pd.read_csv('http://info.ilab.sztaki.hu/~fbobee/alpenglow/tutorial_dataset.csv', header=None, names=['time', 'user', 'item'])
In [3]:
exp = ExternalModelExperiment(
period_length=60 * 60 * 24 * 7 * 4,
in_name_base="batches/batch",
mode="read",
)
In [4]:
res = exp.run(data)
In [5]:
res['dcg'] = DcgScore(res)
In [6]:
res['dcg'].mean()
Out[6]:
In [7]:
exp = BatchFactorExperiment(
period_length=60 * 60 * 24 * 7 * 4,
negative_rate=5
)
res2 = exp.run(data)
In [8]:
res2['dcg'] = DcgScore(res2)
In [9]:
res2['dcg'].mean()
Out[9]:
In [10]:
plt.figure(figsize=(15,8))
res.groupby(res.time//(60*60*24)).dcg.mean().plot()
res2.groupby(res2.time//(60*60*24)).dcg.mean().plot()
plt.ylabel('daily average ndcg')
plt.legend(['turicreate', 'alpenglow'])
Out[10]:
In [ ]: