Skip to content

Error AttributeError: 'implicit.evaluation._memoryviewslice' object has no attribute 'dtype' when calling mean_average_precision_at_k function #726

@MRossa157

Description

@MRossa157

Hello! I encountered an issue when using the mean_average_precision_at_k function from the implicit library.

Problem Description:

When calling the mean_average_precision_at_k function, the following error occurs:

AttributeError: 'implicit.evaluation._memoryviewslice' object has no attribute 'dtype'

Context:

  • Operating System: Windows 10
  • Python: 3.10.7
  • implicit library version: 0.7.2
  • Installed dependencies:
    [tool.poetry.dependencies]
    python = "^3.10.7"
    pandas = "^2.2.2"
    implicit = "^0.7.2"

Steps to Reproduce:

  1. Installed the implicit library version 0.7.2.
  2. Called the mean_average_precision_at_k function with the following parameters:
    metric_map = mean_average_precision_at_k(
        model,
        csr_train,
        csr_test,
        K=6,
        show_progress=True,
    )
  3. Encountered the above-mentioned error.

Expected Behavior:

The function should return the MAP@K metric value without errors.

Additional Information:

  • Tried reinstalling the library and its dependencies, but the error persists.
  • The code includes the following imports:
    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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions