This notebooks explores the fastlife model, a parallel processing model, by taking a closer look at some of the Spaces unique to the fastlife model.

If you're viewing this page as a static HTML page on https://lifelib.io, the same contents are also available here on binder as Jupyter notebook executable online (it may take a while to load). To run this notebook and get all the outputs below, Go to the **Cell** menu above, and then click **Run All**.

The fastlife model is saved as a folder named *model* in the fastlife folder. To create a live model, import **modelx** and call `read_model`

function by passing the folder path.

In [1]:

```
import modelx as mx
model = mx.read_model("model")
```

The previously created model is renamed automatically to avoid name conflict. To get all existing models, `get_models`

modelx API function can be used. `get_models`

returns a dict of all the existing models associated with their names.

In [2]:

```
import modelx as mx
mx.get_models()
```

Out[2]:

The present values of net cashflows are calculated in `PV_NetCashsflow`

Cells in the `Projection`

Space.

In [14]:

```
model.Projection.PV_NetCashflow(0)
```

Out[14]:

Unlike the **simplelife** model, `PV_NetCashflow`

returns a pandas Seris object with Policy index. Each element of the returned Series is the present value of the net cashflow of each model point. Below is the formula of `PV_NetCashflow`

.

In [13]:

```
model.Projection.PV_NetCashflow.formula
```

Out[13]:

As you see, `PV_NetCashflow`

at time 0 is the sum of `PV_PremIncome`

, `PV_ExpsTotal`

and `PV_BenefitTotal`

.

In [16]:

```
model.Projection.PV_PremIncome(0)
```

Out[16]:

In [18]:

```
model.Projection.PV_PremIncome.formula
```

Out[18]:

Most of the Cells in `Projection`

Space operate on Serieses indexed by Policy just like `PV_NetCashflow`

, because their precedent Cells operate on Serieses with the same index.

The `Projection`

Space have a child Space named `Policy`

. `Policy`

contains policy data and Cells to calculate policyholder values. The `PolicyData`

Reference holds a `PandasData`

object, which internaly stores policy data read from an input file as a pandas DataFrame.

In [22]:

```
model.Projection.Policy.PolicyData
```

Out[22]:

To get the DataFrame stored in the `PolicyData`

object, call it:

In [21]:

```
model.Projection.Policy.PolicyData()
```

Out[21]:

`PolicyData`

is a `PandasData`

object, and it was created by the new_pandas method of `UserSpace`

. The location of the input file can be acquired as its `path`

attribute.

In [26]:

```
model.Projection.Policy.PolicyData.path
```

Out[26]:

There are many Cells in `Policy`

whose roles are for calculating policyholder values such as premiums and cash surrender values from commutation functions and actuarial notations.
For example, `GrossPremRate`

is for calculating gross premium rates:

In [29]:

```
model.Projection.Policy.GrossPremRate.formula
```

Out[29]:

As we see in the `Projection`

Space, `GrossPremRate`

also retuns results for all model points in a Series with the Policy index.

In [28]:

```
model.Projection.Policy.GrossPremRate()
```

Out[28]:

`Projection`

has another space named `Assumptions`

. `Assumptions`

associates projection assumptions to model points, by looking up paramters in a table stored as an `ExcelRange`

object associated to a Reference named `Assumption`

.

In [32]:

```
model.Projection.Assumptions.Assumption
```

Out[32]:

Just like `PandasData`

objects, `Assumption`

has the `path`

attribute hoding a path to its input file.

In [38]:

```
model.Projection.Assumptions.Assumption.path
```

Out[38]:

`Assumption`

is a dict-like object, whose keys are tuples of assumption type, product ID, policy type ID and genration ID. For example, For the assumption type 'Surrender' and product 'TERM'

In [36]:

```
model.Projection.Assumptions.Assumption["Surrender", "TERM", None, None]
```

Out[36]:

Most of the Cells in the `Assumption`

Space are for lookup operations just like the above example. The lookup results are also in Series.

In [37]:

```
model.Projection.Assumptions.SurrRateID()
```

Out[37]: