正在載入此比較的其餘部分。

CPUvsCUDA

建立於 差異永不過期
29 刪除
950 行
48 新增
958 行
"""The main Space in the :mod:`~basiclife.BasicTerm_ME` model.
"""The main Space in the :mod:`~basiclife.BasicTerm_ME` model.


:mod:`~basiclife.BasicTerm_ME.Projection` is the only Space defined
:mod:`~basiclife.BasicTerm_ME.Projection` is the only Space defined
in the :mod:`~basiclife.BasicTerm_ME` model, and it contains
in the :mod:`~basiclife.BasicTerm_ME` model, and it contains
all the logic and data used in the model.
all the logic and data used in the model.


.. rubric:: Parameters and References
.. rubric:: Parameters and References


(In all the sample code below,
(In all the sample code below,
the global variable ``Projection`` refers to the
the global variable ``Projection`` refers to the
:mod:`~basiclife.BasicTerm_ME.Projection` Space.)
:mod:`~basiclife.BasicTerm_ME.Projection` Space.)


Attributes:
Attributes:


model_point_table: All model points as a DataFrame.
model_point_table: All model points as a DataFrame.
The sample model point data was generated by
The sample model point data was generated by
*generate_model_points_with_duration.ipynb* included in the library.
*generate_model_points_with_duration.ipynb* included in the library.
By default, :func:`model_point` returns this
By default, :func:`model_point` returns this
entire :attr:`model_point_table`.
entire :attr:`model_point_table`.
The DataFrame has an index named ``point_id``,
The DataFrame has an index named ``point_id``,
and has the following columns:
and has the following columns:


* ``age_at_entry``
* ``age_at_entry``
* ``sex``
* ``sex``
* ``policy_term``
* ``policy_term``
* ``policy_count``
* ``policy_count``
* ``sum_assured``
* ``sum_assured``
* ``duration_mth``
* ``duration_mth``


Cells defined in :mod:`~basiclife.BasicTerm_SE.Projection`
Cells defined in :mod:`~basiclife.BasicTerm_SE.Projection`
with the same names as these columns return
with the same names as these columns return
the corresponding columns.
the corresponding columns.




.. code-block::
.. code-block::


>>> Projection.model_poit_table
>>> Projection.model_poit_table
age_at_entry sex ... sum_assured duration_mth
age_at_entry sex ... sum_assured duration_mth
policy_id ...
policy_id ...
1 47 M ... 622000 1
1 47 M ... 622000 1
2 29 M ... 752000 210
2 29 M ... 752000 210
3 51 F ... 799000 15
3 51 F ... 799000 15
4 32 F ... 422000 125
4 32 F ... 422000 125
5 28 M ... 605000 55
5 28 M ... 605000 55
... .. ... ... ...
... .. ... ... ...
9996 47 M ... 827000 157
9996 47 M ... 827000 157
9997 30 M ... 826000 168
9997 30 M ... 826000 168
9998 45 F ... 783000 146
9998 45 F ... 783000 146
9999 39 M ... 302000 11
9999 39 M ... 302000 11
10000 22 F ... 576000 166
10000 22 F ... 576000 166


[10000 rows x 6 columns]
[10000 rows x 6 columns]


The DataFrame is saved in the Excel file *model_point_table.xlsx*
The DataFrame is saved in the Excel file *model_point_table.xlsx*
placed in the model folder.
placed in the model folder.
:attr:`model_point_table` is created by
:attr:`model_point_table` is created by
Projection's `new_pandas`_ method,
Projection's `new_pandas`_ method,
so that the DataFrame is saved in the separate file.
so that the DataFrame is saved in the separate file.
The DataFrame has the injected attribute
The DataFrame has the injected attribute
of ``_mx_dataclident``::
of ``_mx_dataclident``::


>>> Projection.model_point_table._mx_dataclient
>>> Projection.model_point_table._mx_dataclient
<PandasData path='model_point_table.xlsx' filetype='excel'>
<PandasData path='model_point_table.xlsx' filetype='excel'>


.. seealso::
.. seealso::


* :func:`model_point`
* :func:`model_point`
* :func:`age_at_entry`
* :func:`age_at_entry`
* :func:`sex`
* :func:`sex`
* :func:`policy_term`
* :func:`policy_term`
* :func:`pols_if_init`
* :func:`pols_if_init`
* :func:`sum_assured`
* :func:`sum_assured`
* :func:`duration_mth`
* :func:`duration_mth`


premium_table: Premium rate table by entry age and duration as a Series.
premium_table: Premium rate table by entry age and duration as a Series.
The table is created using :mod:`~basiclife.BasicTerm_M`
The table is created using :mod:`~basiclife.BasicTerm_M`
as demonstrated in *create_premium_table.ipynb*.
as demonstrated in *create_premium_table.ipynb*.
The table is stored in *premium_table.xlsx* in the model folder.
The table is stored in *premium_table.xlsx* in the model folder.


.. code-block::
.. code-block::


>>> Projection.premium_table
>>> Projection.premium_table
age_at_entry policy_term
age_at_entry policy_term
20 10 0.000046
20 10 0.000046
15 0.000052
15 0.000052
20 0.000057
20 0.000057
21 10 0.000048
21 10 0.000048
15 0.000054
15 0.000054
...
...
58 15 0.000433
58 15 0.000433
20 0.000557
20 0.000557
59 10 0.000362
59 10 0.000362
15 0.000471
15 0.000471
20 0.000609
20 0.000609
Name: premium_rate, Length: 120, dtype: float64
Name: premium_rate, Length: 120, dtype: float64


disc_rate_ann: Annual discount rates by duration as a pandas Series.
disc_rate_ann: Annual discount rates by duration as a pandas Series.


.. code-block::
.. code-block::