Skip to content

Roadmap #23: optimize AdditiveChi2Sampler.transform #232

Closed

Description

@godofecht

Tracks rank 23 in benchmarks/OPTIMIZATION_ROADMAP.md: AdditiveChi2Sampler.transform. Complete the roadmap optimization hypothesis with sklearn-parity-gated benchmark evidence, then update the roadmap evidence/disposition before closing.

Implementation ready

PR #319 precomputes the Fourier frequencies once per transform call, skips redundant zero writes into the calloc-backed output matrix, and replaces hot-loop matrix helper calls with direct row-major Matrix.data access. A focused regression test compares every output cell against the previous implementation on mixed positive/zero/negative inputs and includes an identical-workload A/B timing harness.

The branch has been rebuilt on current main; generated benchmark/roadmap artifacts were removed from the review diff. Fresh CI is fully green: Flow syntax/import validation, canonical benchmark/parity, scaled benchmark/self-baseline gate, Python package, and all tests/examples pass. The dedicated AdditiveChi2 optimization test passes in the full suite. PR #319 is now ready for review; keep this issue open until it lands and the roadmap evidence is regenerated on main.

Activity

  1. godofecht commented on Aug 18, 2026

    @godofecht
    OwnerAuthor

    Verified this is already delivered on main.

    PR #319 ("Optimize AdditiveChi2Sampler.transform hot loop") is MERGED and its commit is on origin/main as a992995:

    $ git log --oneline origin/main -1 -- lib/scikit/kernel_approximation.flow
    a992995 Optimize AdditiveChi2Sampler transform hot loop (#319)
    
    $ gh pr view 319 --json state,mergedAt,files
    state: MERGED, mergedAt: 2026-08-17T13:08:04Z
    files: lib/scikit/kernel_approximation.flow (+20/-20)
           tests/test_additive_chi2_transform_optimization.flow (+123/-0)
    

    The optimized hot loop is present on main: the transform now precomputes the Fourier frequencies once per call, skips the redundant zero writes into the calloc-backed output, and indexes X.data / result.data directly instead of going through matrix_at/matrix_set per element (see lib/scikit/kernel_approximation.flow around lines 344-351). The regression test tests/test_additive_chi2_transform_optimization.flow is also on main.

    Nothing further to do here, so closing. No new PR opened for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions