Function __call__
has 28 lines of code (exceeds 25 allowed). Consider refactoring.
def __call__(self, query: QueryInput, items: ItemList) -> ItemList:
"""
Compute predictions for a user and items.
Args:
Function score_items_with_neighbors
has 27 lines of code (exceeds 25 allowed). Consider refactoring.
def score_items_with_neighbors(
log: structlog.stdlib.BoundLogger,
items: torch.Tensor,
nbr_rows: torch.Tensor,
nbr_sims: torch.Tensor,
Avoid too many return
statements within this function.
return UserRatings(index, ratings, umean)
Line too long (89 > 79 characters)
_log.warning("normalized ratings are zero, centering is not recommended")
Line too long (87 > 79 characters)
_log.warning("user %s has no ratings and none provided", query.user_id)
Line too long (89 > 79 characters)
user history component (e.g., :class:`~lenskit.basic.UserTrainingHistoryLookup`).
Line too long (96 > 79 characters)
from pydantic import AliasChoices, BaseModel, Field, PositiveFloat, PositiveInt, field_validator
Line too long (85 > 79 characters)
the user's ratings (indexed by item id); if provided, will be used to
Line too long (89 > 79 characters)
(np.where(rmask, 0, 1), nbr_rates.indices, nbr_rates.indptr), nbr_rates.shape
Line too long (80 > 79 characters)
assert ratings.shape == (len(self.items_),)
Line too long (84 > 79 characters)
either directly in the input or by wiring its query input to the output of a
Line too long (93 > 79 characters)
iidxs = items.numbers(format="torch", vocabulary=self.items_, missing="negative").to(
Line too long (80 > 79 characters)
Line too long (85 > 79 characters)
max_nbrs: PositiveInt = Field(20, validation_alias=AliasChoices("max_nbrs", "k"))
Line too long (80 > 79 characters)
if less than the smallest 32-bit normal (:math:`1.175 \\times 10^{-38}`), is
Line too long (89 > 79 characters)
"Ratings seem to have the same value, centering is not recommended.",
Line too long (93 > 79 characters)
ratings(pandas.DataFrame): (user, item, rating) data for collaborative filtering.
Line too long (90 > 79 characters)
results = pd.Series(scores, index=items.ids()[ki_mask.numpy()], name="prediction")
Line too long (83 > 79 characters)
_log.warning("user %s has items but no ratings", query.user_id)
Line too long (81 > 79 characters)
def train(self, data: Dataset, options: TrainingOptions = TrainingOptions()):
Line too long (98 > 79 characters)
ui_nos = query.user_items.numbers("torch", missing="negative", vocabulary=self.items_)
Line too long (96 > 79 characters)
"Train" a user-user CF model. This memorizes the rating data in a format that is usable
There are no issues that match your filters.