MCPcopy
hub / github.com/benfred/implicit / check_csr

Function check_csr

implicit/utils.py:159–169  ·  view source on GitHub ↗
(user_items)

Source from the content-addressed store, hash-verified

157
158
159def check_csr(user_items):
160 if not isinstance(user_items, scipy.sparse.csr_matrix):
161 class_name = user_items.__class__.__name__
162 start = time.time()
163 user_items = user_items.tocsr()
164 warnings.warn(
165 f"Method expects CSR input, and was passed {class_name} instead. "
166 f"Converting to CSR took {time.time() - start} seconds",
167 ParameterWarning,
168 )
169 return user_items

Callers 6

fitMethod · 0.90
fitMethod · 0.85
fitMethod · 0.85
recalculate_userMethod · 0.85
recalculate_itemMethod · 0.85
explainMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected