gaspatchio-model-building

Guides writing and modifying gaspatchio actuarial model code with enforced idioms and performance rules.

4|Updated Jul 4, 2026
One-click install
npx skills add https://github.com/gaspatchio/gaspatchio --skill gaspatchio-model-building-gaspatchio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gaspatchio-model-building
Source: https://github.com/gaspatchio/gaspatchio/tree/main/skills/gaspatchio-model-building
Command: npx skills add https://github.com/gaspatchio/gaspatchio --skill gaspatchio-model-building-gaspatchio

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing actuarial models in gaspatchio requires knowing the correct ActuarialFrame idioms, method signatures, and performance rules; guessing them leads to silent wrong results, broken lazy execution, and slow code. This Skill enforces a mandatory documentation lookup gate, model classification, and a three-phase build pattern so models are auditable, vectorized, and correct. ## Core Features & Use Cases - Mandatory doc lookup gate: Requires running uv run gspio docs "<method>" before using any unverified gaspatchio method, eliminating the ~70% error rate from guessed signatures. - Model classification: Routes models into standard projection, linear recurrence (accumulate), state-machine rollforward, fund aggregate, or cash flow waterfall classes before any code is written. - Three-phase build pattern with performance rules: Enforces setup/timeline/calculation phases, bans map_elements and Python loops, and provides a gotcha reference table of real production failures. - Use Case: When converting an Excel variable annuity model to gaspatchio, use this Skill to classify the model, look up Table.lookup and cumulative_survival signatures, build the projection timeline, and validate each section with run-single-policy. ## Quick Start Use the gaspatchio-model-building skill to write a monthly mortality projection model from my model_points.parquet file, looking up each method with gspio docs first.

Frequently Asked Questions about gaspatchio-model-building

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a gaspatchio actuarial model in Python?

Follow the three-phase pattern: Phase 1 loads assumptions and prepares scalar columns with .collect() allowed, Phase 2 calls af.projection.set() to build the timeline, and Phase 3 adds lazy column calculations. Always run uv run gspio docs before using any method.

How do I compute running balances or account values without Python loops?

Use the accumulate() projection method for linear recurrences of the form state[t] = state[t-1] * multiply[t] + add[t]. If within-period charges depend on the running balance, use af.projection.rollforward(states={...}) instead of a loop.

When should I use MortalityTable instead of Table.lookup?

Use MortalityTable when the table has an age-basis convention or a select/ultimate structure, since it clamps duration at the select period automatically. For flat dimensional tables like lapse rates or expense loadings, call Table.lookup directly.

Why does my gaspatchio model return NaN from a table lookup?

Tables with two or more string-type dimension columns silently return NaN under the default storage_mode="auto". Pass storage_mode="hash" explicitly when constructing the Table to fix the lookup.

Can I use .collect() during the projection phase in gaspatchio?

No. Calling .collect() after af.projection.set() breaks lazy execution and can produce incorrect results. It is only safe in Phase 1 setup before the timeline exists, or in Phase 4 when aggregating per-entity results to fund level.

How do I discount cash flows with an EIOPA yield curve in gaspatchio?

Build a Curve with Curve.from_zero_rates(), pre-compute discount factors once via Schedule.cumulative_year_fractions(), and broadcast them as a list literal. Calling Curve.discount_factor on a list column falls back to map_elements and is only acceptable for single-policy debugging.