File size: 733 Bytes
6077218 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import numpy as np
import time
import torch
import torch.nn as nn
import torch.nn.functional as F
from .base.abstract_model import AbstractModel
from .base.abstract_RS import AbstractRS
from tqdm import tqdm
class Random_RS(AbstractRS):
def __init__(self, args, special_args) -> None:
super().__init__(args, special_args)
def train_one_epoch(self, epoch):
return None
class Random(AbstractModel):
def __init__(self, args, data) -> None:
super().__init__(args, data)
def forward(self):
return None
def predict(self, users, items=None):
if items is None:
items = list(range(self.data.n_items))
return np.random.rand(len(users), len(items)) |