Skip to main content
Ctrl+K
LensKit 2025.1.1 documentation - Home LensKit 2025.1.1 documentation - Home
  • User Guide
  • API Reference
  • Release Notes
  • Indices
  • GitHub
  • Mastodon
  • User Guide
  • API Reference
  • Release Notes
  • Indices
  • GitHub
  • Mastodon

Section Navigation

Core

  • Data Abstractions
    • Basic Data Types
    • lenskit.data.Dataset
    • lenskit.data.EntitySet
    • lenskit.data.AttributeSet
    • lenskit.data.RelationshipSet
    • lenskit.data.MatrixRelationshipSet
    • lenskit.data.CSRStructure
    • lenskit.data.DatasetBuilder
    • lenskit.data.from_interactions_df
    • lenskit.data.load_movielens
    • lenskit.data.load_movielens_df
    • lenskit.data.ItemList
    • lenskit.data.ItemListCollection
    • lenskit.data.ItemListCollector
    • lenskit.data.ListILC
    • lenskit.data.UserIDKey
    • lenskit.data.GenericKey
    • lenskit.data.MutableItemListCollection
    • lenskit.data.RecQuery
    • lenskit.data.QueryInput
    • lenskit.data.schema
    • lenskit.data.Vocabulary
  • Pipeline API
    • lenskit.pipeline.Pipeline
    • lenskit.pipeline.PipelineBuilder
    • lenskit.pipeline.PipelineState
    • lenskit.pipeline.Node
    • lenskit.pipeline.Lazy
    • lenskit.pipeline.Component
    • lenskit.pipeline.RecPipelineBuilder
    • lenskit.pipeline.topn_pipeline
    • lenskit.pipeline.predict_pipeline
    • lenskit.pipeline.PipelineConfig
  • Operation Functions
  • Diagnostic APIs
  • Model Training

Components

  • lenskit.basic
    • lenskit.basic.bias
    • lenskit.basic.candidates
    • lenskit.basic.composite
    • lenskit.basic.history
    • lenskit.basic.popularity
    • lenskit.basic.random
    • lenskit.basic.topn
  • lenskit.knn
    • lenskit.knn.item
    • lenskit.knn.user
  • lenskit.als
  • lenskit.sklearn
    • lenskit.sklearn.svd
  • lenskit.funksvd
  • lenskit.implicit
  • lenskit.hpf

Evaluation

  • Batch Operations
    • lenskit.batch.BatchPipelineRunner
    • lenskit.batch.BatchResults
    • lenskit.batch.predict
    • lenskit.batch.recommend
    • lenskit.batch.InvocationSpec
  • Metrics and Analysis
    • lenskit.metrics.Metric
    • lenskit.metrics.ListMetric
    • lenskit.metrics.GlobalMetric
    • lenskit.metrics.MetricFunction
    • lenskit.metrics.RankingMetricBase
    • lenskit.metrics.RunAnalysis
    • lenskit.metrics.RunAnalysisResult
    • lenskit.metrics.ListLength
    • lenskit.metrics.TestItemCount
    • lenskit.metrics.NDCG
    • lenskit.metrics.RBP
    • lenskit.metrics.Precision
    • lenskit.metrics.Recall
    • lenskit.metrics.RecipRank
    • lenskit.metrics.MeanPopRank
    • lenskit.metrics.RMSE
    • lenskit.metrics.MAE
  • Data Splitting
    • lenskit.splitting.TTSplit
    • lenskit.splitting.split_global_time
    • lenskit.splitting.crossfold_users
    • lenskit.splitting.sample_users
    • lenskit.splitting.LastFrac
    • lenskit.splitting.LastN
    • lenskit.splitting.SampleFrac
    • lenskit.splitting.SampleN
    • lenskit.splitting.crossfold_records
    • lenskit.splitting.sample_records

Implementation Helpers

  • lenskit.logging
    • lenskit.logging.config
    • lenskit.logging.monitor
    • lenskit.logging.processors
    • lenskit.logging.progress
    • lenskit.logging.resource
    • lenskit.logging.stopwatch
    • lenskit.logging.tasks
    • lenskit.logging.tracing
    • lenskit.logging.worker
  • lenskit.math
    • lenskit.math.solve
    • lenskit.math.sparse
  • lenskit.parallel
    • lenskit.parallel.chunking
    • lenskit.parallel.config
    • lenskit.parallel.invoker
    • lenskit.parallel.pool
    • lenskit.parallel.ray
    • lenskit.parallel.sequential
    • lenskit.parallel.serialize
    • lenskit.parallel.worker
  • lenskit.random
  • lenskit.stats
  • lenskit.torch
  • API Reference
  • Data Splitting
  • lenskit.splitting.SampleN

lenskit.splitting.SampleN#

class lenskit.splitting.SampleN(n, rng=None)#

Bases: HoldoutMethod

Randomly select a fixed number of test rows per user/item.

Stability:
Caller (see Stability Levels).
Parameters:
  • n (int) – The number of test items to select.

  • rng (Generator) – The random number generator or seed (see Random Seeds).

__init__(n, rng=None)#
Parameters:
  • n (int)

  • rng (int | Sequence[int] | SeedSequence | Generator | BitGenerator | None)

Methods

__init__(n[, rng])

Attributes

n

rng

previous

lenskit.splitting.SampleFrac

next

lenskit.splitting.crossfold_records

On this page
  • SampleN
    • SampleN.__init__()
Show Source

© Copyright 2018–2024 Drexel University, Boise State University, and collaborators.

Created using Sphinx 8.1.3.

Built with the PyData Sphinx Theme 0.16.0.