flexcv.fold_logging
This module contains functions for logging results to Neptune.ai. The functions are called during performing cross validation and are used to construct the results metrics dict.
flexcv.fold_logging.CustomNeptuneCallback
Bases: NeptuneCallback
This class inherits from NeptuneCallback and overrides the call method. The call method is called after each trial and logs the best trial and the plots. The override is necessary because logging each trial is not feasible for multiple models, folds and trials. It would hit Neptune's namespace limits.
Source code in flexcv/fold_logging.py
flexcv.fold_logging.CustomNeptuneCallback.__call__(study, trial)
Logs only the best trial and the plots. Args: study (optuna.study): Optuna study object. trial (optuna.trial): Optuna trial object.
Returns:
Type | Description |
---|---|
(None) |
Source code in flexcv/fold_logging.py
flexcv.fold_logging.log_diagnostics(X_train, X_test, y_train, y_test, run, effects, cluster_train=None, cluster_test=None, namestring='out')
Logs histograms of the features and target for diagnostic purposes to neptune.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
X_train |
DataFrame
|
Training features. |
required |
X_test |
DataFrame
|
Testing features. |
required |
y_train |
Series
|
Training target. |
required |
y_test |
Series
|
Testing target. |
required |
run |
Neptune run object. |
required | |
effects |
str
|
Type of effects to be used. Either "fixed" or "mixed". |
required |
cluster_train |
Series
|
Training clustering or grouping variable. Defaults to None. |
None
|
cluster_test |
Series
|
Testing clustering or grouping variable. Defaults to None. |
None
|
namestring |
str
|
A string to pass to logging. Use to separate folds: use "in" or "out". Defaults to "out". |
'out'
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in flexcv/fold_logging.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|