Fork me on GitHub

MyMediaLite: Relation files

News

MyMediaLite 3.11 has been released.


Relation files

Relation files describe binary relations over one type of entity, e.g. over users or over items. An example for a user relation is the edges in the social network. An example for an item relation would be the relation "A is a sequel to B" for movies.

Please note that relations are not automatically symmetric. This means that "1,2" does not imply "2,1". If you want to have a symmetric relation, make sure that both lines are contained in the file.

Relation files have exactly two columns. Each column contains an entity ID. One line in a file means there exists a relation between the first and the second entity mentioned in that line.

Examples

Tab-separated columns (.tsv)

51    5
51    22
51    26
51    29
51    35
51    36
51    45
This means that the entity 51 (may be a user or item) is in relation with the entities 5, 22, 26, ... of the same type If this example is complete, it also means entity 51 does not have a relation with entities 0, 1, 2, 3, 4, 6, ...

Space-separated columns

51 5
51 22
51 26
51 29
51 35
51 36
51 45

Comma-separated columns (.csv)

51,5
51,22
51,26
51,29
51,35
51,36
51,45

Command-line tools

Both the item recommendation tool and the rating prediction tool support this file format.

Classes

Reading

The class for reading in this kind of file is MyMediaLite.IO.RelationData.

Writing

Writing this file format is trivial, so there is no specific class for that in MyMediaLite.

Future Work

In the future, we plan to extend relation support in MyMediaLite. Feel free to leave a comment on issue #37 on MyMediaLite's github tracker if you have specific requirements or ideas.

ContactFollow us on Twitter