load_users(filepath,
batch_size=None,
stochastic=False,
threshold=4)
|
|
Load users from a text file. If `batch_size` is given, behaves like a
generator and returns one batch at a time. Each user is represented as a
list of tuples, where each tuple contains an item id and a rating.
Each line is assumed to contain a 3-tuple of a user id, an item id,
and a rating. The ratings of users should be grouped. For example:
1488844 1 3
1488844 8 4
1488844 17 2
1488844 30 3
8850131 33 4
8850131 35 1
8850131 86 5
- Parameters:
filepath (str ) - path to file containing data
batch_size (int ) - the number of users to return at once
stochastic (bool ) - if True, the batch size is drawn from a Poisson distribution
threshold (int ) - only load users whose rating is greater or equal this threshold
- Returns:
list /generator
- returns either a list of users or a generator of lists of users
|