Skip to content

Commit 04e3565

Browse files
author
Morgan Squire
committed
presentation
1 parent 1dbf3df commit 04e3565

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+6293
-18
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ graph TB
1515
p2 --> I[Industry]
1616
p3 --> A[Asset Size]
1717
p3 --> D[Difference]
18-
D --> R[Retention]
1918
D --> L[Limit]
19+
D --> R[Retention]
2020
```
2121
When the `calculate()` method is called on the root object, it calls the `calculate()` method on its child nodes. When a terminal node is reached, the factor is returned and when a non-terminal node is reached, the CompoundFactor calls the `calculate()` method on its children.
2222

Diff for: demo/create_rate_plan.pdf

19.4 KB
Binary file not shown.

Diff for: example.py renamed to demo/create_rate_plan.qmd

+20-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
---
2+
title: "Pyrateer Demo"
3+
---
4+
```{python}
15
from pyrateer.factors import NumericFactor, CategoricalFactor, ConstantFactor
26
import pickle
7+
```
38

9+
## Create the Rate Plan
410

11+
```{python}
512
asset_size = NumericFactor(
613
"Asset Size",
714
{
@@ -88,9 +95,17 @@
8895
}
8996
)
9097
loss_cost = ConstantFactor("Loss Cost", 1.7)
98+
```
9199

100+
Once the rate plan factors have been created, they can be combined using arithmetic operators.
101+
102+
```{python}
92103
rate_plan = asset_size * (limit - retention) * industry * loss_cost
104+
```
105+
106+
## Test
93107

108+
```{python}
94109
json_input = {
95110
"Asset Size": 1_200_000,
96111
"Limit": 5_000_000,
@@ -101,6 +116,10 @@
101116
rate = rate_plan.calculate(**json_input)
102117
103118
print(rate)
119+
```
104120

121+
## Pickle the Rate Plan
122+
```{python}
105123
with open("rate_plan.pkl", "wb") as f:
106-
pickle.dump(rate_plan, f)
124+
pickle.dump(rate_plan, f)
125+
```

Diff for: demo/presentation.html

+841
Large diffs are not rendered by default.

Diff for: demo/presentation.qmd

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: "Pyrateer Demo"
3+
author: "Morgan Squire"
4+
format: revealjs
5+
---
6+
7+
## Actuarial Analysis
8+
9+
- See Excel file
10+
11+
## Pyrateer Package
12+
13+
- Python rating engine
14+
- Uses base class for quick implementation of new subclasses
15+
- `ConstantFactor` was added later in a matter of minutes
16+
- Overloads arithmetic operators so ROC formulas can be typed directly
17+
```{.python code-line-numbers="|1|2-7|8"}
18+
rate_plan = asset_size * (limit - retention) * industry * loss_cost
19+
json_input = {
20+
"Asset Size": 1_200_000,
21+
"Limit": 5_000_000,
22+
"Retention": 1_000_000,
23+
"Industry": "Hazard Group 2"
24+
}
25+
print(rate_plan.calculate(json_input))
26+
```
27+
28+
## Classes
29+
30+
- `RatingFactor`: base class
31+
- `NumericFactor`: numeric inputs
32+
- `CategoricalFactor`: categorical inputs
33+
- `ConstantFactor`: no inputs
34+
- `CompoundFactor`: the result of arithmetic operators
35+
36+
## Compound Factors
37+
38+
Created with arithmetic operators
39+
40+
Has a special calculate function that calculates the component objects and combines them using the provided operator
41+
42+
```{mermaid}
43+
graph TB
44+
p1[Product] --> p2[Product]
45+
p1 --> LC[Loss Cost Factor]
46+
p2 --> p3[Product]
47+
p2 --> I[Industry]
48+
p3 --> A[Asset Size]
49+
p3 --> D[Difference]
50+
D --> L[Limit]
51+
D --> R[Retention]
52+
```
53+
54+
## Rate Plan PDFs
55+
56+
See rate plan pdfs
57+
58+
## Room for Improvement
59+
60+
- Tree navigation functions
61+
- Interaction Factors
62+
- JSON rate_plan definition (better than pickling)

Diff for: demo/presentation_files/libs/clipboard/clipboard.min.js

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)