This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from distributed import Client, LocalCluster | |
import dask.dataframe as dd | |
import numpy as np | |
cluster = LocalCluster(ip='0.0.0.0', n_workers=32, threads_per_worker=1, diagnostics_port=8787, **{'memory_limit': 2e9}) | |
client = Client(cluster) | |
print(client) | |
df = dd.read_parquet('parquet/') | |
print(f'found {len(df)} interactions') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bpr_loss(positive_predictions, negative_predictions): | |
""" | |
Bayesian Personalised Ranking pairwise loss function. Original Implementation: https://github.com/maciejkula/spotlight | |
""" | |
loss = (1.0 - F.sigmoid(positive_predictions - | |
negative_predictions)) | |
return loss.mean() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import numpy as np | |
import pyarrow as pa | |
import pyarrow.parquet as pq | |
import requests | |
import datetime | |
import os | |
import gzip | |
from joblib import Parallel, delayed |
NewerOlder