A Recommender System Python Library
Project description
pyRecommenderSystem - A Recommender System Python Library
- Install
pip install pyRecommenderSystem
- Algorithms:
-
Content-Based Filtering: This approach uses a series of descriptions of an item in order to recommend additional items with similar properties . The term "content" refers to these descriptions, and in this case manipulated with TF-IDF matrices. The function returns a list with the k-top similarities (cosine similarity).
-
Xdata = Dataset Attributes. A 0-1 matrix with the content in columns.
-
k = Up to k-top similarities (cosine similarity) that are greater or equal the cut_off value. The default value is 5.
-
show_all = Boolean that indicates if the similiarities of each item will be calculated (show_all = True) or for just one item (show_all = False). The default value is True.
-
graph = Boolean that indicates if the cosine similarity will be displayed (graph = True) or not (graph = False). The default value is True.
-
size = Graph size. The default value is 10.
-
target = k-top similarities of target item. Only relevant if "show_all = False". The default value is "none".
-
cut_off = Value between -1 and 1 that filter similar item according to a certain threshold value. The default value is -0.9999.
-
-
Collaborative Filtering - Item Based: This approach builds a model from past behaviors, comparing items or users trough ratings, and in this case an Item Based Regression technique is used to predict the missing values. The Grey Wolf Optmizer (GWO) is used to find minimum loss value. The function returns: the prediction of the missing data and the gwo solution.
-
Xdata = Dataset Attributes. A matrix with users ratings about a set of items.
-
user_in_columns = Boolean that indicates if the user is in the column (user_in_column = True) or in the row (user_in_column = False). The default value is True.
-
pack_size = To find the weights, a metaheuristic know as Grey Wolf Optmizer (GWO) is used. The initial population (pack_size) helps to find the optimal solution. The default value is 25.
-
iterations = The total number of iterations. The defaul value is 100
-
-
Collaborative Filtering - User Based: This approach builds a model from past behaviors, comparing items or users trough ratings, and in this case an User Based Regression technique is used to predict the missing values. The Grey Wolf Optmizer (GWO) is used to find minimum loss value. The function returns: the prediction of the missing data and the gwo solution.
-
Xdata = Dataset Attributes. A matrix with users ratings about a set of items.
-
user_in_columns = Boolean that indicates if the user is in the column (user_in_column = True) or in the row (user_in_column = False). The default value is True.
-
pack_size = To find the weights, a metaheuristic know as Grey Wolf Optmizer (GWO) is used. The initial population (pack_size) helps to find the optimal solution. The default value is 25.
-
iterations = The total number of iterations. The defaul value is 100
-
-
Collaborative Filtering - User-Item Based: This approach builds a model from past behaviors, comparing items or users trough ratings, and in this case an User-Item Based Regression technique is used to predict the missing values. The Grey Wolf Optmizer (GWO) is used to find minimum loss value. The function returns: the prediction of the missing data and the gwo solution.
-
Xdata = Dataset Attributes. A matrix with users ratings about a set of items.
-
user_in_columns = Boolean that indicates if the user is in the column (user_in_column = True) or in the row (user_in_column = False). The default value is True.
-
pack_size = To find the weights, a metaheuristic know as Grey Wolf Optmizer (GWO) is used. The initial population (pack_size) helps to find the optimal solution. The default value is 25.
-
iterations = The total number of iterations. The defaul value is 100
-
-
Collaborative Filtering - Latent Factors: This approach builds a model from past behaviors, comparing items or users trough ratings, and in this case a Regression with Latent Factors technique can extract k features to predict the missing values. The Stochastic Gradient Descent is used to find minimum loss value. The function returns: the prediction of the missing data, the users features weights, the items features weights and the rmse (root mean square error).
-
Xdata = Dataset Attributes. A matrix with users ratings about a set of items.
-
mean_centering = "none", "row", "column", "global". If "none" is selected then no centering is made, if "row" is selected then a row mean centering is performed, if "column" is selected then a column mean centering is performed and if "global" is selected then a global centering (matrix mean) is performed. The default value is "none".
-
features = Total number of features to be extracted. The default value is 2.
-
iterations = The total number of iterations. The default value is 1000.
-
alpha = The learning rate. The default value is 0.01.
-
-
Collaborative Filtering - Nearest Neighbors: This approach builds a model from past behaviors, comparing items or users trough ratings, and in this case the Nearest Neighbors (memory based) is used to calculate the k-top similar users/items (cosine or pearson similarity). The function returns, the k-top similar users/items, the mean and the similarity matrix.
-
Xdata = Dataset Attributes. A matrix with users ratings about a set of items.
-
k = Up to k-top similarities (cosine similarity or pearson correlation) that are greater or equal the cut_off value. The default value is 5.
-
user_in_columns = Boolean that indicates if the user is in the column (user_in_column = True) then a user-user similarity is made, if (user_in_column = False) then an item-item similarity is performed instead. The default value is True.
-
simil = "cosine", "correlation". If "cosine" is chosen then a cosine similarity is performed, and if "correlation" is chosen then a pearson correlation is performed. The default value is "correlation".
-
graph = Boolean that indicates if the similarity matrix will be displayed (graph = True) or not (graph = False). The default value is True.
-
mean_centering = "none", "row", "column", "global". If "none" is selected then no centering is made, if "row" is selected then a row mean centering is performed, if "column" is selected then a column mean centering is performed and if "global" is selected then a global centering (matrix mean) is performed. The default value is "none".
-
cut_off = Value between -1 and 1 that filter similar item according to a certain threshold value. The default value is -0.9999.
-
Finnaly a prediction function - prediction( ) - is also included.
-
-
Collaborative Filtering - SVD: This approach builds a model from past behaviors, comparing items or users trough ratings, and in this case the SVD (Singular Value Decomposition) technique can extract k features that can be used to find similar users/items. The function returns: the predictions, the rmse (root mean square error), the U matrix (users relation to the features), the Sigma matrix (features matrix)and the V matrix (items relation to the features).
-
Xdata = Dataset Attributes. A matrix with users ratings about a set of items.
-
mean_centering = "none", "row", "column", "global". If "none" is selected then no centering is made, if "row" is selected then a row mean centering is performed, if "column" is selected then a column mean centering is performed and if "global" is selected then a global centering (matrix mean) is performed. The default value is "none".
-
k = Total number of features to be extracted. The default value is 2.
-
user_in_columns = Boolean that indicates if the user is in the column (user_in_column = True) then a user-user similarity is made, if (user_in_column = False) then an item-item similarity is performed instead. The default value is True.
-
graph = Boolean that indicates if the first 2 features of the users and items will be displayed (graph = True) or not (graph = False). The default value is True.
-
size_x = Graph X axis size. The default value is 15.
-
size_y = Graph Y axis size. The default value is 15.
-
- Try it in Colab:
- Content-Based Filtering ( Colab Demo )
- Collaborative Filtering - Item Based ( Colab Demo )
- Collaborative Filtering - User Based ( Colab Demo )
- Collaborative Filtering - User-Item Based ( Colab Demo )
- Collaborative Filtering - Latent Factors ( Colab Demo )
- Collaborative Filtering - Nearest Neighbors ( Colab Demo )
- Collaborative Filtering - SVD ( Colab Demo )
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyRecommenderSystem-1.5.2.tar.gz
.
File metadata
- Download URL: pyRecommenderSystem-1.5.2.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.25.11 tqdm/4.62.2 importlib-metadata/4.8.1 keyring/23.1.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45d956d6809513b2b281a11e422294e95ccb3d681d31ea6a197a21738b4befb3 |
|
MD5 | 177d73622663b6dac5a0c215efc23318 |
|
BLAKE2b-256 | 520af543e7bbe49bf97a2faf89c6aa3ee0cc7be2eae731eaf7ffd7ddfd7322b2 |
File details
Details for the file pyRecommenderSystem-1.5.2-py3-none-any.whl
.
File metadata
- Download URL: pyRecommenderSystem-1.5.2-py3-none-any.whl
- Upload date:
- Size: 20.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.25.11 tqdm/4.62.2 importlib-metadata/4.8.1 keyring/23.1.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70e8a6bf0b54a38bbbd7cc595c1ae0618b7a3c97d3ad5e5d94e8f2b42d3923b8 |
|
MD5 | acf4ba47b5f514b88d03855cdf796d39 |
|
BLAKE2b-256 | 4ea3f62da6409490111ce57160000ae2e67cb6081143e89e3019b8762c5effa7 |