recpack.preprocessing.filters.MinUsersPerItem

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

Require that a minimum number of users has interacted with an item.

Parameters
  • min_users_per_item (int) – Minimum number of users 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 user, 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]