Quantco / Quantco/tabmat

Improve efficiency of `__getitem__`

Open
#101 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

code quality performance
Dominant language
Python
Stars
140
Forks
10
Avg merge
18h 17m
Merged PRs (30d)
2

Description

Currently, our approach for some of the __getitem__ methods is inefficient. For example, column subsetting for CategoricalMatrix converts the full matrix to a csc_matrix.

Here's a list to update with potential improvements:

  • DenseMatrix: nothing to do. Already optimized with np.ndarray
  • SparseMatrix: nothing to do. Already optimized with sps.csc_matrix
  • CategoricalMatrix:
    • row: nothing to do, trivial
    • column: create a SparseMatrix with only the subset of columns/rows selected
  • SplitMatrix:
    • Test thoroughly all the potential ways to index
  • StandardizedMatrix
    • Not sure if columns subset with only one row works
  • Write docstrings for expected behavior
  • Write tests covering all expected behavior

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the getitem implementations for CategoricalMatrix, SplitMatrix, and StandardizedMatrix, then inspect how each indexing mode is currently handled. Improve the listed inefficient or uncertain cases, document expected behavior, and add tests covering all specified indexing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
data, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.