Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lime/lime_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,5 +481,10 @@ def distance_fn(x):
data[i, inactive] = 0
inverse_data.append(indexed_string.inverse_removing(inactive))
labels = classifier_fn(inverse_data)

# if labels are a sparse matrix, convert to a dense array
if sp.sparse.issparse(labels):
labels = labels.toarray()

distances = distance_fn(sp.sparse.csr_matrix(data))
return data, labels, distances