Skip to content

Commit

Permalink
simplified sparse matrix instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanhausen committed Aug 21, 2024
1 parent 101bab1 commit d2204e4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions treeple/stats/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,15 +476,15 @@ def _compute_null_distribution_coleman_sparse(
:, 0
] # (n_oob_samples)

oob_predictions = sp.coo_matrix(
oob_predictions = sp.csc_matrix(
(all_oob_values, (tree_row_ids, all_oob_idxs)),
shape=(n_trees, len(y_test)),
).tocsc() # (n_trees, n_samples)
) # (n_trees, n_samples)

oob_indicators = sp.coo_matrix(
oob_indicators = sp.csc_matrix(
(np.ones_like(all_oob_values, dtype=np.uint8), (tree_row_ids, all_oob_idxs)),
shape=(n_trees, len(y_test)),
).tocsc() # (n_trees, n_samples)
) # (n_trees, n_samples)

observe_stat, permute_stat = _parallel_build_null_forests_sparse(
np.arange(n_trees),
Expand Down

0 comments on commit d2204e4

Please sign in to comment.