predictable


Namepredictable JSON
Version 0.0.1 PyPI version JSON
download
home_page
SummaryA framework for actuarial modelling.
upload_time2023-05-12 11:13:51
maintainer
docs_urlNone
author
requires_python>=3.11
licenseMIT License Copyright (c) 2022 Ratul Maharaj Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords actuarial financial services modelling predictable python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Predictable

[![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)
![PyPI](https://img.shields.io/pypi/v/predictable)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![pytest](https://github.com/RatulMaharaj/predictable/actions/workflows/pytest.yaml/badge.svg?branch=main)](https://github.com/RatulMaharaj/predictable/actions/workflows/pytest.yaml)
[![build](https://github.com/RatulMaharaj/predictable/actions/workflows/build.yaml/badge.svg?branch=main)](https://github.com/RatulMaharaj/predictable/actions/workflows/build.yaml)
[![Documentation Status](https://readthedocs.org/projects/predictable/badge/?version=latest)](https://predictable.readthedocs.io/en/latest/?badge=latest)

## What is it?

A framework for actuarial modelling.

## Installation

```sh
pip install predictable
```

## Quick start example

A `model.py` file will be used to house the modelling logic which will be applied to each modelpoint.

```python
# import the library
from predictable import CashFlow, DiscountFactors, Model, StaticFlow

# Create new model instance
model = Model()

# Add a premium component
model.add_component(
    CashFlow(
        input_array=[100], formula=lambda prev: prev * 1.05, label="premium"
    )
)

# Add a sum assured component
model.add_component(CashFlow(label="cover", input_array=[1_000_000]))

# Add an expense component
model.add_component(
    StaticFlow(
        input_array=[10, 10, 10, 10, 10],
        label="expense",
    )
)

# Add discounting component
model.add_component(DiscountFactors(interest_rate=0.05, label="V"))

# Project cashflows over term
# Results return a pandas df object
df = model.project(term=10)

# Perform linear combination style manipulations
# Discounting the components
components = ["premium", "cover", "expense"]
for component in components:
    df[f"V_{component}"] = df[component] * df["V"]


# Define reserving relationship
df["Reserve"] = df["V_cover"] + df["V_expense"] - df["V_premium"]

# Results get returned as a pandas dataframe
print(df)
```

## Documentation

This project is documented using sphinx and the full documentation can be found at [predictable.readthedocs.io](https://predictable.readthedocs.io/en/latest/).

## Development & Contibutions

The following steps can be followed to set up a development environment.

1. Clone the project:

    ```sh
    git clone https://github.com/RatulMaharaj/predictable.git
    cd predictable
    ```

2. Install [hatch](https://hatch.pypa.io/latest/)

    ```sh
    pipx install hatch
    ```

3. Enter the default environment (this will activate the default virtual environment and install the project in editable mode).

    ```sh
    hatch shell default
    ```

### Testing

This project uses `pytest` for testing purposes. The tests can be found in the `tests` directory. Tests will run after every commit (locally) and on every push (using github actions) but can also be run manually using:

```sh
hatch run test
```

### Linting

This project is linted using `ruff` and formatted with `black`. The linting and formatting can be run manually using:

```sh
hatch run lint
```

```sh
hatch run format
```

### Editing the docs

The documentation for this project can be found in the `docs` directory. The documentation is built using sphinx and can be built locally using:

```sh
hatch run docs:make
```

You can then serve the documentation locally using:

```sh
hatch run docs:serve
```

## License

[MIT](https://github.com/RatulMaharaj/predictable/blob/main/LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "predictable",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "",
    "keywords": "actuarial,financial services,modelling,predictable,python",
    "author": "",
    "author_email": "Ratul Maharaj <ratulmaharaj@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/39/e2/6b564b330dcd63e5925d1031eac2106a18cf4f565d3b105c055a9cf67327/predictable-0.0.1.tar.gz",
    "platform": null,
    "description": "# Predictable\n\n[![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)\n![PyPI](https://img.shields.io/pypi/v/predictable)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n[![pytest](https://github.com/RatulMaharaj/predictable/actions/workflows/pytest.yaml/badge.svg?branch=main)](https://github.com/RatulMaharaj/predictable/actions/workflows/pytest.yaml)\n[![build](https://github.com/RatulMaharaj/predictable/actions/workflows/build.yaml/badge.svg?branch=main)](https://github.com/RatulMaharaj/predictable/actions/workflows/build.yaml)\n[![Documentation Status](https://readthedocs.org/projects/predictable/badge/?version=latest)](https://predictable.readthedocs.io/en/latest/?badge=latest)\n\n## What is it?\n\nA framework for actuarial modelling.\n\n## Installation\n\n```sh\npip install predictable\n```\n\n## Quick start example\n\nA `model.py` file will be used to house the modelling logic which will be applied to each modelpoint.\n\n```python\n# import the library\nfrom predictable import CashFlow, DiscountFactors, Model, StaticFlow\n\n# Create new model instance\nmodel = Model()\n\n# Add a premium component\nmodel.add_component(\n    CashFlow(\n        input_array=[100], formula=lambda prev: prev * 1.05, label=\"premium\"\n    )\n)\n\n# Add a sum assured component\nmodel.add_component(CashFlow(label=\"cover\", input_array=[1_000_000]))\n\n# Add an expense component\nmodel.add_component(\n    StaticFlow(\n        input_array=[10, 10, 10, 10, 10],\n        label=\"expense\",\n    )\n)\n\n# Add discounting component\nmodel.add_component(DiscountFactors(interest_rate=0.05, label=\"V\"))\n\n# Project cashflows over term\n# Results return a pandas df object\ndf = model.project(term=10)\n\n# Perform linear combination style manipulations\n# Discounting the components\ncomponents = [\"premium\", \"cover\", \"expense\"]\nfor component in components:\n    df[f\"V_{component}\"] = df[component] * df[\"V\"]\n\n\n# Define reserving relationship\ndf[\"Reserve\"] = df[\"V_cover\"] + df[\"V_expense\"] - df[\"V_premium\"]\n\n# Results get returned as a pandas dataframe\nprint(df)\n```\n\n## Documentation\n\nThis project is documented using sphinx and the full documentation can be found at [predictable.readthedocs.io](https://predictable.readthedocs.io/en/latest/).\n\n## Development & Contibutions\n\nThe following steps can be followed to set up a development environment.\n\n1. Clone the project:\n\n    ```sh\n    git clone https://github.com/RatulMaharaj/predictable.git\n    cd predictable\n    ```\n\n2. Install [hatch](https://hatch.pypa.io/latest/)\n\n    ```sh\n    pipx install hatch\n    ```\n\n3. Enter the default environment (this will activate the default virtual environment and install the project in editable mode).\n\n    ```sh\n    hatch shell default\n    ```\n\n### Testing\n\nThis project uses `pytest` for testing purposes. The tests can be found in the `tests` directory. Tests will run after every commit (locally) and on every push (using github actions) but can also be run manually using:\n\n```sh\nhatch run test\n```\n\n### Linting\n\nThis project is linted using `ruff` and formatted with `black`. The linting and formatting can be run manually using:\n\n```sh\nhatch run lint\n```\n\n```sh\nhatch run format\n```\n\n### Editing the docs\n\nThe documentation for this project can be found in the `docs` directory. The documentation is built using sphinx and can be built locally using:\n\n```sh\nhatch run docs:make\n```\n\nYou can then serve the documentation locally using:\n\n```sh\nhatch run docs:serve\n```\n\n## License\n\n[MIT](https://github.com/RatulMaharaj/predictable/blob/main/LICENSE)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 Ratul Maharaj  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "A framework for actuarial modelling.",
    "version": "0.0.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/RatulMaharaj/predictable/issues",
        "documentation": "https://predictable.readthedocs.io",
        "homepage": "https://github.com/RatulMaharaj/predictable"
    },
    "split_keywords": [
        "actuarial",
        "financial services",
        "modelling",
        "predictable",
        "python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c23910dc1d8b2a37c2b4ec44093e45167840987c27657a88d1e0dcf7e8dee471",
                "md5": "01106780bf76e85ac4a3670812b639a9",
                "sha256": "5d991d9016e0a0ea1d5683ae38f141e2174c1c282df7ca726f60c7535609c889"
            },
            "downloads": -1,
            "filename": "predictable-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "01106780bf76e85ac4a3670812b639a9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 12427,
            "upload_time": "2023-05-12T11:13:49",
            "upload_time_iso_8601": "2023-05-12T11:13:49.423392Z",
            "url": "https://files.pythonhosted.org/packages/c2/39/10dc1d8b2a37c2b4ec44093e45167840987c27657a88d1e0dcf7e8dee471/predictable-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "39e26b564b330dcd63e5925d1031eac2106a18cf4f565d3b105c055a9cf67327",
                "md5": "06647bb0648524e8ef0579430329fd80",
                "sha256": "2a2702261bd2e0f22111c3b0e3f9c5a6251e24edd14a73be1edb457b05b0a8f4"
            },
            "downloads": -1,
            "filename": "predictable-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "06647bb0648524e8ef0579430329fd80",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 14736,
            "upload_time": "2023-05-12T11:13:51",
            "upload_time_iso_8601": "2023-05-12T11:13:51.384953Z",
            "url": "https://files.pythonhosted.org/packages/39/e2/6b564b330dcd63e5925d1031eac2106a18cf4f565d3b105c055a9cf67327/predictable-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-12 11:13:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RatulMaharaj",
    "github_project": "predictable",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "predictable"
}
        
Elapsed time: 0.16756s