Skip to content

lastfm

LastFMDatasetConfig dataclass

Bases: DatasetConfig

LastFM dataset configuration.

Source code in src/recnexteval/datasets/config/lastfm.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
@dataclass
class LastFMDatasetConfig(DatasetConfig):
    """LastFM dataset configuration."""

    user_ix: str = "userID"
    item_ix: str = "artistID"
    timestamp_ix: str = "timestamp"
    tag_ix: str = "tagID"
    """Name of the column in the DataFrame that contains the tag a user gave to the item."""
    dataset_url: str = "https://files.grouplens.org/datasets/hetrec2011"
    remote_zipname: str = "hetrec2011-lastfm-2k"
    remote_filename: str = "user_taggedartists-timestamps.dat"
    default_base_path: str = DatasetConfig.default_base_path + "/lastfm"

user_ix = 'userID' class-attribute instance-attribute

item_ix = 'artistID' class-attribute instance-attribute

timestamp_ix = 'timestamp' class-attribute instance-attribute

tag_ix = 'tagID' class-attribute instance-attribute

Name of the column in the DataFrame that contains the tag a user gave to the item.

dataset_url = 'https://files.grouplens.org/datasets/hetrec2011' class-attribute instance-attribute

remote_zipname = 'hetrec2011-lastfm-2k' class-attribute instance-attribute

remote_filename = 'user_taggedartists-timestamps.dat' class-attribute instance-attribute

default_base_path = DatasetConfig.default_base_path + '/lastfm' class-attribute instance-attribute

default_filename property

Derived filename from remote components.

LastFMUserMetadataConfig dataclass

Bases: MetadataConfig, LastFMDatasetConfig

LastFM User Metadata Configuration.

Source code in src/recnexteval/datasets/config/lastfm.py
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
@dataclass
class LastFMUserMetadataConfig(MetadataConfig, LastFMDatasetConfig):
    """LastFM User Metadata Configuration."""

    user_ix: str = "userID"
    """Name of the column containing user identifiers."""
    friend_ix: str = "friendID"
    """Name of the column containing friend identifiers."""

    remote_filename: str = "user_friends.dat"
    remote_zipname: str = "hetrec2011-lastfm-2k"
    dataset_url: str = "https://files.grouplens.org/datasets/hetrec2011"
    sep: str = "\t"

    @property
    def column_names(self) -> list[str]:
        return [
            self.user_ix,
            self.friend_ix,
        ]

user_ix = 'userID' class-attribute instance-attribute

Name of the column containing user identifiers.

friend_ix = 'friendID' class-attribute instance-attribute

Name of the column containing friend identifiers.

remote_filename = 'user_friends.dat' class-attribute instance-attribute

remote_zipname = 'hetrec2011-lastfm-2k' class-attribute instance-attribute

dataset_url = 'https://files.grouplens.org/datasets/hetrec2011' class-attribute instance-attribute

sep = '\t' class-attribute instance-attribute

column_names property

item_ix = 'artistID' class-attribute instance-attribute

timestamp_ix = 'timestamp' class-attribute instance-attribute

default_base_path = DatasetConfig.default_base_path + '/lastfm' class-attribute instance-attribute

default_filename property

Derived filename from remote components.

tag_ix = 'tagID' class-attribute instance-attribute

Name of the column in the DataFrame that contains the tag a user gave to the item.

dtype_dict property

Data type mapping for all columns.

Used in pd.read_table() dtype parameter to ensure correct column types are loaded from file.

Returns:

Name Type Description
dict dict

Mapping of column names to numpy dtypes

Example

{ "age": "int64", "gender": "<U1", # string "occupation": "object", "zipcode": "object" }

LastFMItemMetadataConfig dataclass

Bases: MetadataConfig, LastFMDatasetConfig

LastFM Item Metadata Configuration.

Source code in src/recnexteval/datasets/config/lastfm.py
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
@dataclass
class LastFMItemMetadataConfig(MetadataConfig, LastFMDatasetConfig):
    """LastFM Item Metadata Configuration."""

    item_ix: str = "id"
    """Name of the column containing item identifiers."""
    name_ix: str = "name"
    """Name of the column containing item names."""
    url_ix: str = "url"
    """Name of the column containing item URLs."""
    picture_url_ix: str = "pictureURL"
    """Name of the column containing item picture URLs."""

    remote_filename: str = "artists.dat"
    remote_zipname: str = "hetrec2011-lastfm-2k"
    dataset_url: str = "https://files.grouplens.org/datasets/hetrec2011"
    sep: str = "\t"

    @property
    def column_names(self) -> list[str]:
        return [
            self.item_ix,
            self.name_ix,
            self.url_ix,
            self.picture_url_ix,
        ]

    @property
    def dtype_dict(self) -> dict:
        return {
            self.name_ix: str,
            self.url_ix: str,
            self.picture_url_ix: str,
        }

item_ix = 'id' class-attribute instance-attribute

Name of the column containing item identifiers.

name_ix = 'name' class-attribute instance-attribute

Name of the column containing item names.

url_ix = 'url' class-attribute instance-attribute

Name of the column containing item URLs.

picture_url_ix = 'pictureURL' class-attribute instance-attribute

Name of the column containing item picture URLs.

remote_filename = 'artists.dat' class-attribute instance-attribute

remote_zipname = 'hetrec2011-lastfm-2k' class-attribute instance-attribute

dataset_url = 'https://files.grouplens.org/datasets/hetrec2011' class-attribute instance-attribute

sep = '\t' class-attribute instance-attribute

column_names property

dtype_dict property

user_ix = 'userID' class-attribute instance-attribute

timestamp_ix = 'timestamp' class-attribute instance-attribute

default_base_path = DatasetConfig.default_base_path + '/lastfm' class-attribute instance-attribute

default_filename property

Derived filename from remote components.

tag_ix = 'tagID' class-attribute instance-attribute

Name of the column in the DataFrame that contains the tag a user gave to the item.

LastFMTagMetadataConfig dataclass

Bases: MetadataConfig, LastFMDatasetConfig

LastFM Tag Metadata Configuration.

Source code in src/recnexteval/datasets/config/lastfm.py
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
@dataclass
class LastFMTagMetadataConfig(MetadataConfig, LastFMDatasetConfig):
    """LastFM Tag Metadata Configuration."""

    tag_ix: str = "tagID"
    """Name of the column containing tag identifiers."""
    name_ix: str = "tagValue"
    """Name of the column containing tag names."""

    remote_filename: str = "tags.dat"
    remote_zipname: str = "hetrec2011-lastfm-2k"
    dataset_url: str = "https://files.grouplens.org/datasets/hetrec2011"
    sep: str = "\t"

    @property
    def column_names(self) -> list[str]:
        return [
            self.tag_ix,
            self.name_ix,
        ]

    @property
    def dtype_dict(self) -> dict:
        return {
            self.tag_ix: str,
            self.name_ix: str,
        }

tag_ix = 'tagID' class-attribute instance-attribute

Name of the column containing tag identifiers.

name_ix = 'tagValue' class-attribute instance-attribute

Name of the column containing tag names.

remote_filename = 'tags.dat' class-attribute instance-attribute

remote_zipname = 'hetrec2011-lastfm-2k' class-attribute instance-attribute

dataset_url = 'https://files.grouplens.org/datasets/hetrec2011' class-attribute instance-attribute

sep = '\t' class-attribute instance-attribute

column_names property

dtype_dict property

user_ix = 'userID' class-attribute instance-attribute

item_ix = 'artistID' class-attribute instance-attribute

timestamp_ix = 'timestamp' class-attribute instance-attribute

default_base_path = DatasetConfig.default_base_path + '/lastfm' class-attribute instance-attribute

default_filename property

Derived filename from remote components.