Skip to content

compositional.mle v0.2.0

Choose a tag to compare

@queelius queelius released this 18 Dec 04:05
· 40 commits to master since this release

Major Refactoring: Composable MLE Solvers

This release renames the package from numerical.mle to compositional.mle and introduces a new composable API based on SICP principles.

Key Changes

  • Factory Pattern: Solvers are now factory functions that return solver functions with uniform signature: (problem, theta0, trace) -> result
  • Composition Operators:
    • %>>% - Sequential chaining (coarse-to-fine strategies)
    • %|% - Parallel racing (pick best result)
    • with_restarts() - Multiple random starting points
    • unless_converged() - Conditional refinement
  • Problem Specification: New mle_problem() separates the statistical problem from optimization strategy
  • New Solvers: bfgs(), lbfgsb(), nelder_mead(), random_search(), fisher_scoring()
  • Tracing: mle_trace() for configurable iteration diagnostics
  • Transformers: with_subsampling(), with_penalty() (L1/L2/elastic net)

Example

# Define problem once
problem <- mle_problem(loglike, score, constraint = mle_constraint(...))

# Create composable strategy
strategy <- grid_search(n = 5) %>>% gradient_ascent() %>>% newton_raphson()

# Or race different methods
strategy <- gradient_ascent() %|% bfgs() %|% nelder_mead()

# Solve
result <- strategy(problem, theta0)

Testing

All 255 tests passing.