1. Read the book
Read the synthetic book from its CSV files: Install Relativities and download the example data before running this page.2. Write prepare
Carrier A’s rater takes each driver’s age, and each vehicle’s mileage and collision deductible. Write aprepare function that reads the whole book and returns each submission’s rater input,
keyed by submission_id:
prepare is plain pandas. Its input for each submission has the shape of the rater’s inputs.
3. Rate the book
Pair the rater withprepare in a program, and rate the book. schema is the book the program
accepts:
invalid_inputs and the premium NaN.
carrier_a.schema lists each table and column the program accepts. Read the drivers’ dates:
prepare runs, and gives prepare only
the schema’s columns.
4. Explain a premium
Explain S2’s premium of $825:explanation.json_in is the input
that prepare built, and explanation.book holds S2’s facts.
5. Add a second carrier
Carrier B’s rater takes each driver’s years licensed, each vehicle’s miles, and a comprehensive flag. Write itsprepare, and rate the book with both carriers in a market:
program column. Each carrier’s outcome keeps the name its rater gives it:
premium for six months from carrier A, and annual_premium for twelve months from carrier B.
6. Compare on one basis
Select liability only, then annualize carrier A’s six-month premium for this illustrative comparison:What you did
You prepared shared facts, wroteprepare for two raters, explained a premium, and compared a matched population. To go further:
- Compare carriers on one basis.
- Price a deductible change with a study.
- Read Books and studies and Programs and schemas.