Showing 23 of 957 total issues
ItemList
has 40 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class ItemList: """ Representation of a (usually ordered) list of items, possibly with scores and other associated data; many components take and return item lists. Item lists are to be treated as **immutable** — create a new list with modified
ItemListCollection
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class ItemListCollection(Generic[KL], ABC): """ A collection of item lists. This protocol defines read access to the collection; see :class:`ItemListCollector` for the ability to add new lists.
Dataset
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
Open
class Dataset: """ Representation of a data set for LensKit training, evaluation, etc. Data can be accessed in a variety of formats depending on the needs of a component. See :ref:`data-model` for details of the LensKit data model.
Function __call__
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def __call__(self, query: QueryInput, items: ItemList) -> ItemList: query = RecQuery.create(query) log = _log.bind(user_id=query.user_id, n_items=len(items)) trace(log, "beginning prediction")
Function train
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def train(self, data: Dataset, options: TrainingOptions = TrainingOptions()): """ Train a FunkSVD model. Args:
Function quick_measure_model
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def quick_measure_model( model: Component, data: Dataset, *, predicts_ratings: bool = False,
Function __call__
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
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. Open
Open
def score_items_with_neighbors( log: structlog.stdlib.BoundLogger, items: torch.Tensor, nbr_rows: torch.Tensor, nbr_sims: torch.Tensor,
Function train
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def train(self, data: Dataset, options: TrainingOptions = TrainingOptions()): """ Train a model. The model-training process depends on ``save_nbrs`` and ``min_sim``, but *not* on other
Function add_entities
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def add_entities( self, cls: str, source: IDSequence | pa.Array[Any] | pa.ChunkedArray[Any] | TableInput, *,
Avoid deeply nested control flow statements. Open
Open
if m.is_decomposed: assert isinstance(m.metric, DecomposedMetric) val = m.metric.compute_list_data(out, list_test) list_intermediates[m.label].append(val) mv = m.metric.extract_list_metric(val)
Avoid deeply nested control flow statements. Open
Open
if mv is None and m.is_listwise: mv = m.measure_list(out, list_test) l_row.append(mv)
Avoid too many return
statements within this function. Open
Open
return False
Avoid too many return
statements within this function. Open
Open
return False
Avoid too many return
statements within this function. Open
Open
return NotImplemented
Avoid too many return
statements within this function. Open
Open
return cls(user_id=data)
Avoid too many return
statements within this function. Open
Open
return get_origin(ct)
Avoid too many return
statements within this function. Open
Open
return UserRatings(index, ratings, umean)
Avoid too many return
statements within this function. Open
Open
return reduce_storage(obj)
Avoid too many return
statements within this function. Open
Open
return True