recpack.preprocessing.filters.MinItemsPerUser

class recpack.preprocessing.filters.MinItemsPerUser(min_items_per_user: int, item_ix: str, user_ix: str, count_duplicates: bool = False)

Require that a user has interacted with a minimum number of items.

Parameters
  • min_items_per_user (int) – Minimum number of items required.

  • item_ix (str) – Name of the column in which item identifiers are listed.

  • user_ix (str) – Name of the column in which user identifiers are listed.

  • count_duplicates (bool) – Count multiple interactions with the same item, defaults to False

Methods

apply(df)

Apply Filter to the DataFrame passed.

apply_all(*dfs)

Apply the filter to a list of pandas DataFrames.

apply(df)

Apply Filter to the DataFrame passed.

Parameters

df (pd.DataFrame) – DataFrame to filter

apply_all(*dfs: pandas.core.frame.DataFrame) List[pandas.core.frame.DataFrame]

Apply the filter to a list of pandas DataFrames.

The filter is applied independently to each of the DataFrames.

Returns

The list of processed DataFrames

Return type

List[pd.DataFrame]