You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to implement a basic poisson regression using the DevelopmentML function on summy dummy data. Please can you point out any errors :) I am getting an error message " DevelopmentML' object has no attribute 'average" when trying to fit the model.
data = {
'Accident Year': [2020, 2020, 2020, 2020, 2020, 2021, 2021, 2021, 2021, 2022, 2022, 2022, 2023, 2023, 2024],
'Development Year': [2020, 2021, 2022, 2023, 2024, 2021, 2022, 2023, 2024, 2022, 2023, 2024, 2023, 2024, 2024],
'Paid': [1000, 300, 200, 50, 20, 3500, 800, 500, 100, 5000, 1000, 300, 8000, 2000, 9000]
}
df = pd.DataFrame(data)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am trying to implement a basic poisson regression using the DevelopmentML function on summy dummy data. Please can you point out any errors :) I am getting an error message " DevelopmentML' object has no attribute 'average" when trying to fit the model.
data = {
'Accident Year': [2020, 2020, 2020, 2020, 2020, 2021, 2021, 2021, 2021, 2022, 2022, 2022, 2023, 2023, 2024],
'Development Year': [2020, 2021, 2022, 2023, 2024, 2021, 2022, 2023, 2024, 2022, 2023, 2024, 2023, 2024, 2024],
'Paid': [1000, 300, 200, 50, 20, 3500, 800, 500, 100, 5000, 1000, 300, 8000, 2000, 9000]
}
df = pd.DataFrame(data)
Remove any non-numeric columns or rows
df = df.apply(pd.to_numeric, errors='coerce')
df = df.dropna()
Convert the DataFrame to a Triangle with incremental data
triangle = cl.Triangle(df, origin='Accident Year', development='Development Year', columns=['Paid'], cumulative=False)
Initialize the DevelopmentML model with a Poisson Regressor
model = DevelopmentML(
estimator_ml=PoissonRegressor(),
y_ml='Paid',
autoregressive=[('Paid', -1, 'Paid'), ('Paid', -2, 'Paid')],
fit_incrementals=True
)
Fit the model to the triangle data
model.fit(triangle)
Get the estimated loss development patterns
ldf = model.ldf_
Display the estimated patterns
print(ldf)
Beta Was this translation helpful? Give feedback.
All reactions