Skip to content
Open

#689 #690

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ celerybeat-schedule
.venv
venv/
ENV/
.ipynb_checkpoints
.virtual_documents

# Spyder project settings
.spyderproject
Expand Down
4 changes: 4 additions & 0 deletions chainladder/adjustments/parallelogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ class ParallelogramOLF(BaseEstimator, TransformerMixin, EstimatorIO):
5% decrease should be stated as -0.05
date_col: str
A list-like set of effective dates corresponding to each of the changes
approximation_grain: str
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think typing.Literal["M", "D"] is more informative, but a change like this could wait until there is more comprehensive type hinting.

The resolution of the internal calendar used for calculating the on-level factors:
monthly ('M') or daily ('D'). Daily is finer and adjusts for leap years when assigning
factors to origin periods.
vertical_line:
Rates are typically stated on an effective date basis and premiums on
and earned basis. By default, this argument is False and produces
Expand Down
6 changes: 5 additions & 1 deletion docs/library/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@ cd chainladder-python
# Create virtual environment and install all dependencies
uv sync --extra all

```

Once the environment is set up, we may go into development mode with `uv`:
```bash
# Activate the environment
uv run python # or uv run jupyter-lab
uv run jupyter-lab # or uv run python
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this step.

$ uv run jupyter-lab
error: Failed to spawn: `jupyter-lab`
  Caused by: program not found

jupyter-lab doesn't seem to exist: https://pypi.org/project/jupyter-lab/ (404). I know jupyterlab is a package, but it is not a dependency (or an extra) of chainladder-python so it won't exist in the venv.

uv run python is a decent option for starting the python REPL. My suggestion would be to provide IDE agnostic instructions. venv activation varies slightly by platform:
Linux/macOS: source .venv/bin/activate and Windows: .venv\Scripts\activate, per:
https://docs.astral.sh/uv/pip/environments/#using-a-virtual-environment

I think it can be assumed that any potential contributors already have an IDE setup or are capable of doing so.

```

This will install the package in editable mode with all development dependencies. After finishing work, deactivate:
Expand Down
28 changes: 10 additions & 18 deletions docs/user_guide/adjustments.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"id": "252ed464-a589-4a09-9bc7-937c4b0a8529",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -704,7 +704,7 @@
"2020 1.034456"
]
},
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -713,7 +713,7 @@
"data = pd.DataFrame({\n",
" 'Year': [2016, 2017, 2018, 2019, 2020],\n",
" 'EarnedPremium': [10_000]*5})\n",
"prem_tri = cl.Triangle(data, origin='Year', columns='EarnedPremium')\n",
"prem_tri = cl.Triangle(data, origin='Year', columns='EarnedPremium', cumulative = True)\n",
"prem_tri = cl.ParallelogramOLF(rate_history, change_col='RateChange', date_col='EffDate').fit_transform(prem_tri)\n",
"prem_tri.olf_"
]
Expand Down Expand Up @@ -757,7 +757,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"id": "af652141-0a29-4dcf-9807-18f252c6cd3c",
"metadata": {},
"outputs": [
Expand All @@ -767,7 +767,7 @@
"True"
]
},
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -801,7 +801,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"id": "dae2933e-864f-4d42-a866-e3fda52d1f2a",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -972,7 +972,7 @@
"1997 1.00 NaN NaN NaN NaN NaN NaN NaN NaN NaN"
]
},
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -981,22 +981,14 @@
"ppauto_loss = cl.load_sample('clrd').groupby('LOB').sum().loc['ppauto', 'CumPaidLoss']\n",
"cl.Trend(\n",
" trends=[.05, .03],\n",
" dates=[('1997-12-31', '1995'),('1995', '1992-07')]\n",
" dates=[('1997-12-31', '1995-01-01'),('1995-01-01', '1992-07-01')]\n",
").fit(ppauto_loss).trend_.round(2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "eaaf2ea2-cf4e-4549-ae83-4f1b6476e30e",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.7.11 ('cl_dev')",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -1010,7 +1002,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.11"
"version": "3.9.12"
},
"vscode": {
"interpreter": {
Expand Down
Loading