CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-pymc3

Probabilistic Programming in Python: Bayesian Modeling and Probabilistic Machine Learning with Theano

Agent Success

Agent success rate when using this tile

68%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.94x

Baseline

Agent success rate without this tile

72%

Overview
Eval results
Files

task.mdevals/scenario-4/

Labeled Sales Forecasting

Build a small probabilistic model for weekly sales across multiple stores that uses labeled dimensions for stores and weeks, and keeps observed data replaceable without rebuilding the model.

The model must accept:

  • A coords mapping containing store identifiers and week numbers.
  • An observed mapping containing sales and price arrays shaped by those coordinates, plus an optional boolean promo array of the same shape.

Capabilities

Coordinates drive shapes

  • Model defines coordinates for stores and weeks and binds all stochastic and observed arrays to those labels so posterior samples expose these coordinate names. @test

Shared data updates

  • Observed arrays are attached through a mutable data container that can be replaced with new arrays using the same coordinates without redefining the model graph. @test

Minibatch likelihood

  • Likelihood evaluation can run on minibatches of store-week pairs drawn repeatedly while keeping coordinate mapping intact and scaling contributions so posterior estimates match full-data usage. @test

Implementation

@generates

API

from typing import Any, Mapping, Sequence

ArrayLike = Any

def build_model(coords: Mapping[str, Sequence[str] | Sequence[int]], observed: Mapping[str, ArrayLike]) -> Any:
    """
    Creates and returns the probabilistic model for store-week sales using labeled dimensions and shared data containers.
    """

def sample_posterior(model: Any, draws: int = 500, tune: int = 500, seed: int | None = None) -> Any:
    """
    Runs posterior sampling on the provided model and returns the inference results.
    """

def update_observed(model: Any, new_observed: Mapping[str, ArrayLike]) -> None:
    """
    Replaces the observed data in the existing model using the mutable data containers while preserving labeled coordinates.
    """

def posterior_predictive(model: Any, trace: Any, samples: int = 300) -> Any:
    """
    Generates posterior predictive draws using the latest observed data already bound to the model.
    """

Dependencies { .dependencies }

pymc { .dependency }

Probabilistic programming library with labeled dimension and shared data utilities.

tile.json