lenskit.knn.item.ItemKNNConfig#

class lenskit.knn.item.ItemKNNConfig#

Bases: pydantic.BaseModel

Configuration for ItemKNNScorer.

max_nbrs: pydantic.PositiveInt#

The maximum number of neighbors for scoring each item.

min_nbrs: pydantic.PositiveInt = 1#

The minimum number of neighbors for scoring each item.

min_sim: pydantic.PositiveFloat = 1e-06#

Minimum similarity threshold for considering a neighbor. Must be positive; if less than the smallest 32-bit normal (\(1.175 \times 10^{-38}\)), is clamped to that value.

save_nbrs: pydantic.PositiveInt | None = None#

The number of neighbors to save per item in the trained model (None for unlimited).

feedback: lenskit.data.FeedbackType = 'explicit'#

The type of input data to use (explicit or implicit). This affects data pre-processing and aggregation.

block_size: int = 250#

The block size for computing item similarity blocks in parallel. Only affects performance, not behavior.

static clamp_min_sim(sim)#
Return type:

float

property explicit: bool#

Query whether this is in explicit-feedback mode.

Return type:

bool