apriori.py line 224: ValueError: negative dimensions are not allowed
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.2k
- Forks
- 916
- Avg merge
- 17h 31m
- Merged PRs (30d)
- 4
Description
Processing 24785850 combinations | Sampling itemset size 6
Traceback (most recent call last):
File "***.py", line 116, in
frequent_itemsets = apriori(df, min_support=0.8, use_colnames=True, verbose=1)File "C:\ProgramData\Anaconda3\lib\site-packages\mlxtend\frequent_patterns\apriori.py", line 219, in apriori
_bools = X[:, combin[:, 0]] == all_onesFile "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse_index.py", line 53, in getitem
return self._get_sliceXarray(row, col)File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\csc.py", line 222, in _get_sliceXarray
return self._major_index_fancy(col)._minor_slice(row)File "C:\ProgramData\Anaconda3\lib\site-packages\scipy\sparse\compressed.py", line 693, in _major_index_fancy
res_indices = np.empty(nnz, dtype=idx_dtype)ValueError: negative dimensions are not allowed
In my apriori.py, variable "combin" is a (4130975, 6) dataframe comprise of indices (dtype = int32).
In compressed.py, numpy cumsum takes the dtype from indices of "combin".
Negative values appeared after the numpy cumsum reached maximum of int32.
Not sure if it is an exception for numpy cumsum or mlxtend apriori.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with mlxtend/frequent_patterns/apriori.py at the linked line and trace the reported scipy sparse indexing failure back through the int32 combin array and NumPy cumsum behavior. Reproduce the reported apriori call, then determine whether the failure belongs in mlxtend or a dependency; done means the large-combination case no longer raises this error or the limitation is clearly documented with coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100