> ## Documentation Index
> Fetch the complete documentation index at: https://docs.effectiveai.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Rate with a rating model

> List the rating models in your catalog, pick one by carrier, check its sources, and rate inputs with it locally.

A rating model computes one part of a carrier's rating plan, such as a credit score, a tier or a tier factor.

[Install Relativities and set your API key](https://docs.effectiveai.app/relativities/setup.md) before running this page.

## List the models

```python theme={null}
from relativities import RatingModels

models = RatingModels.list(layer="factor")
sorted(models)  # ['example.mileage-factor']
```

`RatingModels.list` returns the newest upload of each model in your organization's catalog.
Filter by `carrier`, `layer`, `state` or `fidelity`. Each `layer` is `score`, `tier` or `factor`.

## Pick a model and check its sources

```python theme={null}
model = models.example.mileage_factor
model.descriptor["fidelity"]  # 'exact_filed'
model.descriptor["sources"]  # [{'serffTrackingNumber': 'EXMP-000000001', 'pages': 'pp.4-5'}]
```

The part of the model ID before the first `.` groups the models by carrier.
The rest of the ID becomes the attribute, with each `-` and `.` written as `_`.
`models["example.mileage-factor"]` names the same model.

The descriptor records the filings behind the model and its `knownGaps`.
Its `fidelity` says how closely the model follows them:

* `exact_filed`: the filed tables and rules, as filed.
* `alt_state_proxy`: one state's filing stands in for another state's confidential one.
* `non_filed_assumption`: a step that rests on an assumption, with the assumption in `knownGaps`.

## Rate inputs

```python theme={null}
submission = {
    "Policy": {
        "drivers": [{"age": 42}],
        "vehicles": [{"annual_mileage": 5000}],
        "coverages": {"collision": False},
    }
}
results = model.rate(submission)
results.to_pandas()["annual_premium"].tolist()  # [400.0]
```

The model downloads and verifies its bundle the first time it rates.
Rating then runs on your machine, on the same native engine as a `Rater`.
`rate` and `explain` take the model's own inputs, as `model.input_schema` describes them.

## Pin an upload

```python theme={null}
from relativities import RatingModel

pinned = RatingModel.load("example.mileage-factor", bundle_id=model.bundle_id)
pinned.bundle_id == model.bundle_id  # True
pinned.close()
model.close()
```

Rating models use immutable uploads in place of releases. Each upload's `bundle_id` names it exactly.
Pass `bundle_id` to rate with one upload every time.
After the first download, `local_files_only=True` loads that upload from the local cache, offline.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.