python-recsys: A simple python recommender system
See some usage examples here
Base class Algorithm
It has the basic methods to load a dataset, get the matrix and the raw input data, add more data (tuples), etc.
Any other Algorithm derives from this base class
Add a tuple in the dataset
Parameters: |
|
---|
Returns: | An instance of Data class. The raw dataset (input for matrix M). |
---|
Returns: | matrix M |
---|
Returns: | the self-similarity matrix |
---|
K-means clustering. http://en.wikipedia.org/wiki/K-means_clustering
Clusterizes the (cols) values of a given row, or viceversa
Parameters: |
|
---|
Loads a dataset file
See params definition in datamodel.Data.load()
Saves the dataset in divisi2 matrix format (i.e: value <tab> row <tab> col)
Parameters: |
|
---|
Sets the raw dataset (input for matrix M)
Parameters: |
|
---|
Parameters: |
|
---|---|
Returns: | the most similar elements of i |
Parameters: |
|
---|---|
Returns: | the similarity between the two elements i and j |
Inherits from base class Algorithm. It computes SVD (Singular Value Decomposition) on a matrix M
It also provides recommendations and predictions using the reconstructed matrix M’
Parameters: |
|
---|
Computes SVD on matrix M,
Parameters: |
|
---|
K-means clustering. It uses k-means++ (http://en.wikipedia.org/wiki/K-means%2B%2B) to choose the initial centroids of the clusters
Clusterizes a list of IDs (either row or cols)
Parameters: |
|
---|
Loads SVD transformation (U, Sigma and V matrices) from a ZIP file
Parameters: |
|
---|
Predicts the value of , using reconstructed matrix
Parameters: |
---|
Recommends items to a user (or users to an item) using reconstructed matrix
E.g. if i is a row and only_unknowns is True, it returns the higher values of
Parameters: |
|
---|
Saves SVD transformation (U, Sigma and V matrices) to a ZIP file
Parameters: |
---|
Classic Neighbourhood plus Singular Value Decomposition. Inherits from SVD class
Predicts the value of , using simple avg. (weighted) of all the ratings by the most similar users (or items). This similarity, sim(i,j) is derived from the SVD
Parameters: |
---|
Predicts the value of , using simple avg. (weighted) of all the ratings by the most similar users (or items)
Parameters: |
|
---|
See some examples
Base class for Evaluation
It has the basic methods to load ground truth and test data. Any other Evaluation class derives from this base class.
Parameters: |
|
---|
Adds a tuple <real rating, pred. rating>
Parameters: |
|
---|
Adds a predicted rating to the current test list
Parameters: |
|
---|
Computes the evaluation using the loaded ground truth and test lists
Returns: | the ground truth list |
---|
Returns: | the test dataset (a list) |
---|
Loads both the ground truth and the test lists. The two lists must have the same length.
Parameters: |
---|
pyrecsys data model includes: users, items, and its interaction. See some datamodel examples
An item, with its related metadata information
Parameters: |
|
---|---|
Returns: | an item instance |
Parameters: |
|
---|
Returns the associated information of the item
Returns the Item id
User information, including her interaction with the items
Parameters: |
|
---|---|
Returns: | a user instance |
Parameters: |
|
---|
Returns the User id
Returns the list of items for the user
Handles the relationshops among users and items
Parameters: |
|
---|
Returns: | a list of tuples |
---|
Loads data from a file
Parameters: |
|
---|
Saves data in output file
Parameters: |
|
---|