Skip to content

Commit

Permalink
Revised setcol() for csr
Browse files Browse the repository at this point in the history
  • Loading branch information
myui committed Dec 10, 2024
1 parent 73ccd1e commit f38cb47
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rtrec/models/internal/slim_elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def set_col(self, j: int, values: ArrayLike) -> None:
values : ArrayLike
The new values for the column.
"""
self.csc_matrix[:, j] = values
start, end = self.csc_matrix.indptr[j], self.csc_matrix.indptr[j+1]
assert len(values) == end - start, f"Values must have the same length as the column: {len(values)} != {end - start}"
self.csc_matrix.data[start:end] = values

class FeatureSelectionWrapper:

Expand Down

0 comments on commit f38cb47

Please sign in to comment.