Skip to main content
Rate submissions with one carrier’s rater, and read each premium and status. Install Relativities and download the example data before running this page.
The rater is the synthetic example in relativities-examples/example-auto.zip. Its premium is for a twelve-month term. It refuses a vehicle over 30,000 miles a year.

Load a rater

  • To load a local bundle, pass a Path to Rater.load.
  • To load a catalog rater, pass its ID as a string, with EFFECTIVE_API_KEY set.
The first catalog load downloads the bundle, verifies it and caches it by its bundle_id. Bundles and exact rating describes the checks.

Pin a revision

To load a numbered release, pass revision= a whole number. To rerun a rating exactly, pass revision= the bundle_id.
A cached bundle_id loads offline with local_files_only=True.

Download a rater to a folder

To keep a rater next to your work, call Rater.download with a path. Then load it from that path.
  • A path that ends in .zip gets the bundle archive. Any other path gets a folder with the rater’s RSL source, its tables and, for a program, its program/ folder.
  • The bundle is verified first. Then it goes to a new path or an empty folder, and the call raises FileExistsError for any other path.
  • revision= pins the download, as it does for Rater.load.

List the fields a rater accepts

rater.inputs lists each field a submission can give, one row per field. rater.outputs lists the outcomes that rate returns. Both use the type names of a book’s Schema.
path names the field as explain does, with [] for each list. values gives the allowed values or range, and the default when the rater has one. input_schema is the same contract as JSON Schema.

Rate one submission or a list

  • To rate one submission, pass a dict.
  • To rate several submissions, pass a list. Each row ID is the list position.
The dict holds the fields of the rater’s root record, Policy.

Rate a dataset

To keep your own IDs on the results, build a Dataset with a key column. Then rate the dataset, as the first example does.
  • The key column stays on every result row. The rater receives the other columns.
  • A NaN, None or NaT cell leaves its field out of the rater’s input.
  • A date becomes ISO 8601 text.

Read the results in pandas

Call to_pandas() for one row per submission, with float64 outcomes.
S-3 has the status refused with the rule’s code and message. Its premium is NaN, so the mean skips it. Results lists every column and status. Report the two successes and one refusal with that mean. It describes the successfully rated population on this rater’s coverage basis.

Read exact values

To read exact Decimal values, use results.rows.
Each row holds the root record’s fields. Nested records are lists and dicts. To list the calculations behind one premium, see Explain a premium.

Release the raters

Close each rater to release its runtime.
with Rater.load(...) as rater: closes the rater at the end of the block.