Are you on the latest chainladder version?
Describe the bug in words
Triangle.min() and Triangle.max() aren't defined explicitly, they're passed through. However, this leads to some unpredictable behavior.
How can the bug be reproduced?
import chainladder as cl
raa = cl.load_sample('raa')
raa
12 24 36 48 60 72 84 96 108 120
1981 5012.0 8269.0 10907.0 11805.0 13539.0 16181.0 18009.0 18608.0 18662.0 18834.0
1982 106.0 4285.0 5396.0 10666.0 13782.0 15599.0 15496.0 16169.0 16704.0 NaN
1983 3410.0 8992.0 13873.0 16141.0 18735.0 22214.0 22863.0 23466.0 NaN NaN
1984 5655.0 11555.0 15766.0 21266.0 23425.0 26083.0 27067.0 NaN NaN NaN
1985 1092.0 9565.0 15836.0 22169.0 25955.0 26180.0 NaN NaN NaN NaN
1986 1513.0 6445.0 11702.0 12935.0 15852.0 NaN NaN NaN NaN NaN
1987 557.0 4020.0 10946.0 12314.0 NaN NaN NaN NaN NaN NaN
1988 1351.0 6947.0 13112.0 NaN NaN NaN NaN NaN NaN NaN
1989 3133.0 5395.0 NaN NaN NaN NaN NaN NaN NaN NaN
1990 2063.0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
raa.min()
12 24 36 48 60 72 84 96 108 120
1981 106.0 4020.0 5396.0 10666.0 13539.0 15599.0 15496.0 16169.0 16704.0 18834.0
raa.max()
12 24 36 48 60 72 84 96 108 120
1981 5655.0 11555.0 15836.0 22169.0 25955.0 26180.0 27067.0 23466.0 18662.0 18834.0
Looks like when called without arguments, these functions return the min/max of each development period, but also these are labeled with the 1981 origin period, which doesn't make any sense.
What is the expected behavior?
We should implement these methods explicitly, with the axis parameter controlling which axis the maximum values are taken from. axis=None should return the min/max element of the entire 4-D triangle.
An explicit implementation will allow us to document what these methods do, as well as populate those docs with examples, so users should know what to expect.
Exact criteria is TBD due to the complexity and solve-as-we-go nature of the problem. Some things I'd expect are:
axis=0, collapses the triangle along the index and returns a triangle with the other dimensions intact, with max elements taken along the index.
axis=1, collapses triangle along the columns
axis=2 collapses triangle along the origin
axis=3 collapses triangle along the development
We might need different behavior for multidimensional and single triangle behavior.
For raa, something like raa.max(axis=0) might be better returned as a series:
12 5655.0
24 11555.0
36 15836.0
48 22169.0
60 25955.0
72 26180.0
84 27067.0
96 23466.0
108 18662.0
120 18834.0
Would you be willing to contribute this ticket?
Are you on the latest chainladder version?
Describe the bug in words
Triangle.min()andTriangle.max()aren't defined explicitly, they're passed through. However, this leads to some unpredictable behavior.How can the bug be reproduced?
Looks like when called without arguments, these functions return the min/max of each development period, but also these are labeled with the 1981 origin period, which doesn't make any sense.
What is the expected behavior?
We should implement these methods explicitly, with the
axisparameter controlling which axis the maximum values are taken from.axis=Noneshould return the min/max element of the entire 4-D triangle.An explicit implementation will allow us to document what these methods do, as well as populate those docs with examples, so users should know what to expect.
Exact criteria is TBD due to the complexity and solve-as-we-go nature of the problem. Some things I'd expect are:
axis=0, collapses the triangle along the index and returns a triangle with the other dimensions intact, with max elements taken along the index.axis=1, collapses triangle along the columnsaxis=2collapses triangle along the originaxis=3collapses triangle along the developmentWe might need different behavior for multidimensional and single triangle behavior.
For raa, something like
raa.max(axis=0)might be better returned as a series:Would you be willing to contribute this ticket?