From 8c7c246d6bc6355997583520a8ecb10e6c40150f Mon Sep 17 00:00:00 2001 From: Justin Wozniak Date: Mon, 2 Oct 2023 16:26:58 -0500 Subject: [PATCH 1/7] Add required packages --- docs/NOTES.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/NOTES.txt b/docs/NOTES.txt index d15fa83..31e39f9 100644 --- a/docs/NOTES.txt +++ b/docs/NOTES.txt @@ -9,11 +9,21 @@ sphinx pip: +( candle myst_nb sphinx_design sphinx_book_theme +astropy +matplotlib nbsphinx +numpy +pandas +patsy +scipy +scikit-learn +statsmodels +) Then run: From d8c215db531478486a21ec23db07a1a5300284ef Mon Sep 17 00:00:00 2001 From: Justin Wozniak Date: Tue, 3 Oct 2023 15:02:09 -0500 Subject: [PATCH 2/7] More notes --- docs/NOTES.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/NOTES.txt b/docs/NOTES.txt index 31e39f9..762a76e 100644 --- a/docs/NOTES.txt +++ b/docs/NOTES.txt @@ -23,12 +23,18 @@ patsy scipy scikit-learn statsmodels +tensorflow +torch ) Then run: make html +NOTE: +You must make clean before every make, and re-pip-install candle_lib! +Sphinx will not update automatically. + Adding a new example: 1. Add a 00.ipynb file to the docs/examples folder From 79fe51bef167fe5e213a1e944a130a444605bfee Mon Sep 17 00:00:00 2001 From: Justin Wozniak Date: Tue, 3 Oct 2023 15:04:20 -0500 Subject: [PATCH 3/7] Initial working numpydoc --- candle/ckpt_utils.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/candle/ckpt_utils.py b/candle/ckpt_utils.py index b051411..24cac0d 100644 --- a/candle/ckpt_utils.py +++ b/candle/ckpt_utils.py @@ -142,21 +142,28 @@ class ParamType(Enum): STRING = auto() BOOLEAN = auto() INTEGER = auto() - # integer: non-negative + #: integer, non-negative INTEGER_NN = auto() - # integer: greater-than-zero + #: integer, greater-than-zero INTEGER_GZ = auto() FLOAT = auto() + #: float, non-negative FLOAT_NN = auto() class CandleCkpt: - def __init__(self, gParameters=None, logger: str = "DEFAULT", verbose: bool = True): + def __init__(self, gParameters=None, logger: Any = "DEFAULT", verbose: bool = True): """ - :param Logger logger: The logger to use. + The superclass for the ckpt classes + + Parameters + ---------- + logger : A Logger object or None or "DEFAULT" + The logger to use. May be None to disable or "DEFAULT" to use the default. - :param boolean verbose: If True, more verbose logging - Passed to helper_utils.set_up_logger(verbose) for this logger + verbose : boolean + If True, more verbose logging + Passed to helper_utils.set_up_logger(verbose) for the given logger """ self.logger = logger if self.logger == "DEFAULT": From eeec48e3b262f2ee8f31513ece388941d1cdafa1 Mon Sep 17 00:00:00 2001 From: Justin Wozniak Date: Tue, 3 Oct 2023 15:30:56 -0500 Subject: [PATCH 4/7] Update notes to devs --- docs/NOTES.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/NOTES.txt b/docs/NOTES.txt index 762a76e..d4979b8 100644 --- a/docs/NOTES.txt +++ b/docs/NOTES.txt @@ -32,8 +32,8 @@ Then run: make html NOTE: -You must make clean before every make, and re-pip-install candle_lib! -Sphinx will not update automatically. +You must re-pip-install candle_lib before re-building the docs! +Sphinx docs are based on the pip-installed copies. Adding a new example: From d453343b88e6e6302998da354ecc5ba3d51fdf7b Mon Sep 17 00:00:00 2001 From: Justin Wozniak Date: Tue, 3 Oct 2023 15:31:27 -0500 Subject: [PATCH 5/7] More docs --- candle/ckpt_utils.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/candle/ckpt_utils.py b/candle/ckpt_utils.py index 24cac0d..4e2b95e 100644 --- a/candle/ckpt_utils.py +++ b/candle/ckpt_utils.py @@ -152,7 +152,7 @@ class ParamType(Enum): class CandleCkpt: - def __init__(self, gParameters=None, logger: Any = "DEFAULT", verbose: bool = True): + def __init__(self, gParameters=None, logger: any = "DEFAULT", verbose: bool = True): """ The superclass for the ckpt classes @@ -162,8 +162,9 @@ def __init__(self, gParameters=None, logger: Any = "DEFAULT", verbose: bool = Tr The logger to use. May be None to disable or "DEFAULT" to use the default. verbose : boolean - If True, more verbose logging - Passed to helper_utils.set_up_logger(verbose) for the given logger + If True, more verbose logging. + Passed to ``helper_utils.set_up_logger()`` + for the given logger """ self.logger = logger if self.logger == "DEFAULT": @@ -194,7 +195,14 @@ def __init__(self, gParameters=None, logger: Any = "DEFAULT", verbose: bool = Tr self.report_initial() def scan_params(self, gParams): - """Simply translate gParameters into instance fields""" + """Simply translate gParameters into instance fields + + Parameters + ---------- + gParams : dict + The CANDLE hyperparameters to apply + + """ self.gParams = gParams self.ckpt_directory = gParams["ckpt_directory"] self.epoch_max = self.param("epochs", ParamRequired(), ParamType.INTEGER_NN) From ec4f353d03c6392b8b75cd3a92fd3ecbd53fa420 Mon Sep 17 00:00:00 2001 From: Justin Wozniak Date: Tue, 3 Oct 2023 15:40:21 -0500 Subject: [PATCH 6/7] How to add new function --- docs/NOTES.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/NOTES.txt b/docs/NOTES.txt index d4979b8..500afa5 100644 --- a/docs/NOTES.txt +++ b/docs/NOTES.txt @@ -35,6 +35,9 @@ NOTE: You must re-pip-install candle_lib before re-building the docs! Sphinx docs are based on the pip-installed copies. +To add a new function: +Add it to the corresponding api_*/index.rst file + Adding a new example: 1. Add a 00.ipynb file to the docs/examples folder From d54c39a481b9509d689906f29cf0ad0ce693b79e Mon Sep 17 00:00:00 2001 From: Justin Wozniak Date: Tue, 3 Oct 2023 15:40:29 -0500 Subject: [PATCH 7/7] Add doc for scan_params() --- docs/api_ckpt_utils/index.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/api_ckpt_utils/index.rst b/docs/api_ckpt_utils/index.rst index 0ccae8e..9c5753a 100644 --- a/docs/api_ckpt_utils/index.rst +++ b/docs/api_ckpt_utils/index.rst @@ -11,6 +11,7 @@ CKPT_UTILS ckpt_utils.CandleCkptModel ckpt_utils.ParamType ckpt_utils.CandleCkpt + ckpt_utils.CandleCkpt.scan_params ckpt_utils.ParamRequired ckpt_utils.ckpt_parser ckpt_utils.ckpt_defs