chainladder.read_json

Contents

chainladder.read_json#

chainladder.read_json(json_str, array_backend=None)[source]#

Deserialize JSON produced by to_json (triangle, estimator, or pipeline).

Examples

to_json serializes an estimator’s parameters as a JSON string that can be stored in a database, config file, or REST API. read_json reconstructs the estimator with all parameters intact.

dev = cl.Development(average="simple", n_periods=4)
json_str = dev.to_json()
print(json_str)
dev2 = cl.read_json(json_str)
print(dev2.get_params()["average"])
print(dev2.get_params()["n_periods"])
{"params": {"average": "simple", "drop": null, "drop_above": Infinity, "drop_below": 0.0, "drop_high": null, "drop_low": null, "drop_valuation": null, "fillna": null, "groupby": null, "n_periods": 4, "preserve": 1, "sigma_interpolation": "log-linear"}, "__class__": "Development"}
simple
4