mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-13 15:56:57 +08:00
Update serial.rst
This commit is contained in:
@@ -12,7 +12,7 @@ Introduction
|
|||||||
Serializable Class
|
Serializable Class
|
||||||
========================
|
========================
|
||||||
|
|
||||||
``Qlib`` provides a base class ``qlib.utils.serial.Serializable``, whose state can be dumped in or loaded from disk in `pickle` format.
|
``Qlib`` provides a base class ``qlib.utils.serial.Serializable``, whose state can be dumped into or loaded from disk in `pickle` format.
|
||||||
When users dump the state of the ``Serializable`` instance, the attributes of the instance whose name **does not** start with `_` will be saved on the disk.
|
When users dump the state of the ``Serializable`` instance, the attributes of the instance whose name **does not** start with `_` will be saved on the disk.
|
||||||
|
|
||||||
Example
|
Example
|
||||||
@@ -23,7 +23,7 @@ Specifically, ``qlib.data.dataset.DatasetH`` is one of them. Users can serialize
|
|||||||
.. code-block:: Python
|
.. code-block:: Python
|
||||||
|
|
||||||
##=============dump dataset=============
|
##=============dump dataset=============
|
||||||
dataset.to_pickle(path="dataset.pkl") # dataset is the instance of qlib.data.dataset.DatasetH
|
dataset.to_pickle(path="dataset.pkl") # dataset is an instance of qlib.data.dataset.DatasetH
|
||||||
|
|
||||||
##=============reload dataset=============
|
##=============reload dataset=============
|
||||||
with open("dataset.pkl", "rb") as file_dataset:
|
with open("dataset.pkl", "rb") as file_dataset:
|
||||||
|
|||||||
Reference in New Issue
Block a user