We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'implicit.evaluation._memoryviewslice' object has no attribute 'dtype'
mean_average_precision_at_k
Hello! I encountered an issue when using the mean_average_precision_at_k function from the implicit library.
implicit
Problem Description:
When calling the mean_average_precision_at_k function, the following error occurs:
Context:
[tool.poetry.dependencies] python = "^3.10.7" pandas = "^2.2.2" implicit = "^0.7.2"
Steps to Reproduce:
metric_map = mean_average_precision_at_k( model, csr_train, csr_test, K=6, show_progress=True, )
Expected Behavior:
The function should return the MAP@K metric value without errors.
Additional Information:
import numpy as np import pandas as pd from implicit.cpu.als import AlternatingLeastSquares as ALScpu from implicit.evaluation import mean_average_precision_at_k from scipy.sparse import coo_matrix
I would appreciate any assistance in resolving this issue.
The text was updated successfully, but these errors were encountered:
Hi @MRossa157 ! I have trained model with python implicit package and faced the same problem:
The minimum example to reproduce the error
import os import random import pandas as pd from scipy.sparse import csr_matrix from implicit.evaluation import train_test_split, ndcg_at_k, mean_average_precision_at_k from implicit.gpu.als import AlternatingLeastSquares os.environ['OPENBLAS_NUM_THREADS']="1" os.environ['CUDA_VISIBLE_DEVICES']="0" # init random data n_actions = 100000 max_uid = 100000 max_action_id = 10000 df = pd.DataFrame(data={ "user_id" : [random.randint(1, max_uid) for i in range(0, n_actions)], "action" : [random.randint(1, max_action_id) for i in range(0, n_actions)], "impression" : [1 for i in range(0, n_actions)] }) # convert to sparse format user_rows = [uid for uid in df.user_id.tolist()] query_cols = [st for st in df.action.tolist()] qvecs = csr_matrix((df.impression, (user_rows, query_cols))) # train test split and model training train_user_items, test_user_items = train_test_split(qvecs, train_percentage=0.9, random_state=19) model = AlternatingLeastSquares(factors=130, regularization=0.05, alpha=1.0, calculate_training_loss=True) model.fit(train_user_items) # calculate ndcg ndcg = ndcg_at_k(model, train_user_items, test_user_items, K=14, show_progress=True, num_threads=1)
packages version: implicit-0.7.2 (built from source) python-3.11.2 cuda-12.3
os: Debian GNU/Linux 12
Sorry, something went wrong.
Updating to scipy 1.14.1 should resolve the issue.
No branches or pull requests
Hello! I encountered an issue when using the
mean_average_precision_at_k
function from theimplicit
library.Problem Description:
When calling the
mean_average_precision_at_k
function, the following error occurs:Context:
implicit
library version: 0.7.2Steps to Reproduce:
implicit
library version 0.7.2.mean_average_precision_at_k
function with the following parameters:Expected Behavior:
The function should return the MAP@K metric value without errors.
Additional Information:
I would appreciate any assistance in resolving this issue.
The text was updated successfully, but these errors were encountered: