Skip to content

apriori.py line 224: ValueError: negative dimensions are not allowed #613

@fixablecar

Description

@fixablecar

_bools = X[:, combin[:, 0]] == all_ones

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_ones

File "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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions