重模型精算模型
heavymodel-lewisfogden的Python项目详细描述
重型模型
heavymodel是一个基于类的库,它使精算师(和其他建模专业人员)能够使用Python构建精算模型,使用类似于其他精算建模软件的基于函数的语法,再加上用Python编写代码的简单性。在
安装
通过pip安装:
pip install heavymodel-lewisfogden
简单模型创建
导入heavymodel,然后从Model
中子类化您自己的模型:
fromheavymodelimportModelimportpandasaspdclassDemographicModel(Model):defnum_policies(self,t):ift==0:return1else:returnself.num_policies(t-1)-self.num_lapses(t-1)defnum_lapses(self,t):return0.1*self.num_policies(t)demo=DemographicModel()demo._run(20)df=pd.DataFrame({"num_lapses":demo.num_lapses.values,"num_policies":demo.num_policies.values})print(df)
有关更多文档,请参见https://www.digitalactuary.co.uk/。在
- 项目
标签: