prepare function, its schema and its examples with a rater, so one bundle carries
the whole program. This page starts from the source of effective://example-ca-ppa.
To release a guideline, or a rater on its own, for underwriting on Effective, export it with
rslc export instead: Programs on Effective shows the steps.
Install Relativities and set your API key before running this page.
Program.download saves the program’s source: the rater’s RSL and tables, and the program/
folder. Bundles and exact rating describes how a bundle carries
and verifies its program.
Lay out the program folder
Put the program module, its helpers and the examples in one folder. The example program’s folder has this layout:- Import each helper relatively, as
from .record import incidents. - In
program.py, defineprepare(book), which returns the rater’s inputs for each submission. - Also define
SCHEMA, such asSCHEMA = ppa.SCHEMA. Usewith_columnsto declare a column of your own thatpreparereads. - Put an example book in
examples/book, in theBook.read_csvlayout.
Name item result columns
Put an optionaloutcome-columns.json beside the program module to give stable names to
the columns from program.rate(book, by="vehicles"). Each path starts with the rater’s
list field, followed by the result key or keys inside an item. This example labels
the total result inside each item of vehicles:
premium object vehicle_premium gives its collision result the column
vehicle_premium.collision. Other columns use their usual names. Packing checks
that each path exists and its label is unambiguous. Rating by a table also checks
the labels against that table’s ID columns. The JSON rating outputs retain their keys.
Write the expected outcomes
Write one row per example submission inexpected.csv.
- Write the
submission_idandstatuscolumns. - Add the rater’s outcome columns that you want to check, such as
premium. - For a submission that stays unrated, leave its outcome cells empty.
Packaging options
Packaging options
Pack the program
CallProgram.pack with the rater, the folder and a new .zip
path.- By default,
prepareandSCHEMAcome fromprogram.py, and the examples come from theexamplesfolder. - To name other objects, pass
prepare=andschema=as"module:name", such as"rules:prepare". - To choose the result columns, name a
readfunction the same way, such asread="program:read". Setread.outcome_columns = ("premium", "fees")in the program file to retain those columns in the given order when the book is empty or every submission fails. Return every declared name for each successful call, usingNonefor a missing value. A different set of names gives the submission aread_failedstatus. Omit the declaration to discover column names from the returned mappings.
Program.pack writes the bundle, loads it and checks its examples. The bundle gets a new
bundle_id, and the rater’s own ID stays as engine_id. Each check rates every example, so the
100,000-policy example book takes the time of a full rating.Load the program
To load a packaged program, callProgram.load with a Path or a catalog ID.
Program.load takes revision= and local_files_only= as Rater.load does. It reads the example
book while it loads, behind a progress bar (progress=False hides it), so program.example_book is
ready at once. Rate it with program.rate(program.example_book).
Check the examples
Callprogram.check() to rate the examples again.
CheckError, and its comparison holds the table.
Update an existing program
Update an existing program
Carry the program to a rebuilt rater
To move the program to a rater rebuilt from an edited filing, callprogram.with_rater. This
rebuilt rater has a collision base rate of 1,600 in place of 1,519:Rater.build compiles the folder’s RSL and tables into a new rater, and rebuilt.rater.save("my-ca-ppa-rater.zip")
keeps its bundle. with_rater keeps the expected outcomes, so check shows each premium the new rater changes.
Validate each change independently against the intended rate change.To accept the new premiums as the program’s expectations, pass rebaseline=True:rebaseline=True checks that each example keeps its status, and raises CheckError with the submission ID for a changed status.
Validate a program describes the evidence to keep for new expectations.