SPB Git

Repository Public

History of MetrikaKit/Sources/ZQGPU Clear filter
Page 1
  1. Wed, Aug 5, 20264 commits

    1. feat(stats): Bayesian linear regression via Gibbs sampling (bayes prefix)
      ···
      - PhiloxStream in ZQGPU: sequential variate stream over a dedicated
        counter block (bit 62 + per-stream 2^48 words, disjoint from bootstrap
        and permutation streams); Box-Muller normals, Marsaglia-Tsang gammas
        (moments verified against theory at 200k draws)
      - ZQBayesianRegression: semi-conjugate Gibbs with Stata bayes default
        priors (coefficients N(0, 10000), variance InvGamma(.01, .01)); exact
        full conditionals via dense Cholesky; posterior mean/sd and
        equal-tailed 95% credible intervals; ZQStats now depends on ZQGPU for
        the shared RNG
      - engine: 'bayes [, mcmcsize() burnin() seed() normalprior()]: reg …'
        with reproducible chains; manual entry included
      - validation: with diffuse priors the posterior reproduces OLS (mean
        within 5% of a posterior SD, sd ratio in [0.9, 1.15], CrI brackets the
        estimate, sigma recovers the DGP); tight priors shrink toward zero;
        chains bit-reproducible per seed
      - 111 tests green (swift test and xcodebuild with GPU suites)
      
      Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
      simon-pierre boucher 1 file +77
    2. feat(stats): permutation tests and single-variable graphics
      ···
      - ZQResampling.permutationIndices: permutation as argsort of 64-bit
        Philox keys — order-free and counter-addressable so a future GPU
        argsort path reproduces it exactly; dedicated stream offset (bit 63,
        applied after word expansion) keeps permutations disjoint from
        bootstrap draws under the same seed
      - engine: 'permute, reps(#) [seed(#)]: reg …' — permutes the response
        within the estimation sample, parallel chunked refits, empirical
        two-sided p per coefficient (c, reps, p, SE(p)); degenerate _cons row
        omitted
      - planner: GPU heuristic restricted to bootstrap until the permute
        argsort path lands
      - graphics: standalone histogram/scatter/kdensity verbs; single-variable
        histogram (Sturges default, bins() option) and Epanechnikov kdensity
        with Silverman bandwidth (density integrates to 1 in tests)
      - 81 tests green (swift test and xcodebuild with GPU suites)
      
      Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
      simon-pierre boucher 1 file +25
    3. feat(gpu): MLX-batched pairs bootstrap with bit-identical Philox streams
      ···
      - mlx-swift dependency in ZQGPU (the only module allowed to import MLX)
      - Philox4x32-10 as vectorized MLX uint64 ops with the reference key
        schedule: GPU resample indices are bit-identical to the CPU generator
        (asserted per replicate) — the §5 reproducibility contract
      - batched gather + float32 cross-products on GPU, float64 Cholesky solves
        on CPU (§5 hybrid); chunked to the memory budget
      - conditioning: predictors standardized by fixed full-sample mean/scale
        (exact reparametrization) before forming X'X — raw data with an
        intercept lost 2-3 digits in float32
      - MLX workaround: batched GEMM mis-accumulates small k x k outputs at
        batch >= 2 (~6e-4 rel, stride/fusion-independent); X'X is built one
        column at a time through the exact (count,k,n)@(count,n,1) path, with
        regression tests pinning the behavior
      - planner: gpuAvailable detected from actual metallib presence (SwiftPM
        CLI cannot compile Metal shaders - swift test skips GPU suites, the
        xcodebuild-built app and tests get the GPU); reps >= 500 dispatches
        bootstrap to .gpu
      - engine: backend-aware bootstrap, drops singular resamples, output
        titled 'GPU batched' with gpu scalar
      - 68 tests green under xcodebuild (66 + GPU suites under swift test skip)
      
      Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
      simon-pierre boucher 2 files +402
    4. feat: bootstrap Metrika v0.1 skeleton with working ZQL vertical slice
      ···
      - MetrikaKit SPM package: ZQParser, ZQPlanner, ZQEngine, ZQData, ZQStats,
        ZQGPU, ZQGraphics, ZQPlugins (Swift 6, strict concurrency)
      - ZQL parser: lexer, Pratt expressions, factor variables, prefix commands,
        column-cited errors with Levenshtein verb suggestions
      - ZQData: DuckDB-backed load/save (parquet, csv, json, arrow)
      - ZQStats: OLS via LAPACK QR, HC0-HC3 and cluster-robust SE, summarize,
        t/F distributions accurate in the far tails
      - ZQGPU: Philox4x32-10 reference RNG, counter-addressable bootstrap
      - ZQEngine: session actor with use/save/gen/replace/drop/keep/summarize/
        regress/count/list/graph/bootstrap/set seed/xtset/log
      - SwiftUI app (xcodegen): console with history, variables sidebar,
        Swift Charts plots; sandboxed + hardened runtime entitlements
      - Tests: 44 green (parser golden, R fixtures at 1e-10, Philox KAT,
        end-to-end engine); Tests/Fixtures/generate.R; Tests/Bench harness
      - scripts: check_headers.sh + pre-commit hook, make_icns.sh, release.sh
      
      Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
      simon-pierre boucher 2 files +114
Menu

Theme