Skip to main content

Rate the book

Load the example program and rate its synthetic book:
rate returns one row per submission, in book order. For this example, premium is the annual policy premium, stored as an exact Decimal. Rating runs on your machine. Your book and results stay local.

Check rating results

Count submissions by status and reason:
Unrated submissions keep their rows and reasons, with NaN as their premium. Retain them in your analysis alongside the rated submissions.
Before it rates anything, rate checks the preparation function’s columns against the rater’s inputs (program.rater.inputs). Each column must name an input, and each required input must have a column. Each column’s type must also fit its input. A mismatch, such as text for an int, raises TypeError, which lists each column to fix in the preparation function. A bad value, such as a blank or an out-of-range number, fails only its own submission, as invalid_inputs. The Results reference describes the result columns and statuses.

Find missing inputs for a quote

To find which unanswered inputs still affect a price or carrier decision, pass allow_missing=True:
Each path identifies an input in that submission’s rating request. A submission can price with unanswered inputs when its price and eligibility are settled. For mapping_failed rows with reason_code == "NEEDS_INPUT", read needs for the book columns the mapper requests. For invalid_inputs, read reason to correct a supplied value. Update the source facts and rate the book again.

Explain a premium

Inspect the calculations behind one submission’s premium:
The full explanation includes the rater’s inputs and intermediate calculations. Here, the two vehicle premiums total $2,636 for an annual term.

Analyze the results

Join the results to the book by submission_id, then summarize in pandas:
count counts premiums with a value. mean excludes NaN, so each mean describes the rated policies in that region.
Pass by="vehicles" to return vehicle rows with their coverage premiums:

Next step

Create a market to rate the same book with several programs.