MaartenGr / MaartenGr/Concept

Exemplar dict is not serializable

Open
#13 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
230
Forks
17
PR merge metrics
No merged PRs in 30d

Description

Hi, thanks for your awesome libraries.

Just a short question: In this line:

https://github.com/MaartenGr/Concept/blob/d270607d6ea4d789a42d54880ab4a0c977bb69ce/concept/_model.py#L304

you're casting the numpy int64s to integers, presumably so they can be used as indexes?
In any case, the cluster *keys* remain np.int64. This means the whole dict cannot be serialized (as json doesn't know how to handle numpy data types).

My suggestion would be to int() the keys as well to make this a bit less perplexing. But I'm not sure if you rely on the indexes being np.int64 in some other place?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at concept/_model.py around line 304 and inspect how the exemplar dictionary is assembled, including its cluster keys. Check the resulting dictionary with JSON serialization, then confirm that the keys use serializable values without breaking their use as indexes.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.