NFOutput
Output class to store the results of the overfit lambda feedback process.
Source code in wt_ml/negative_feedback/overfit_lambda_evaluator.py
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 |
|
add_outputs(key, current_hyperparam, change_ratio, cr_additive, cr_frac, new_value)
Updates the output class attribute dictionaries with respective key-value pairs.
Source code in wt_ml/negative_feedback/overfit_lambda_evaluator.py
117 118 119 120 121 122 123 |
|
to_dict()
Converts the output class attributes to an ordered dictionary.
Source code in wt_ml/negative_feedback/overfit_lambda_evaluator.py
125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
get_new_impacts_and_fracs(model, dataset)
Calculates the impacts and fractions of impacts for each factor in the model. Returns the factors, their additive impacts, and their impact fractions.Filters out the factors that are not relevant for the overfit lambda feedback.
Source code in wt_ml/negative_feedback/overfit_lambda_evaluator.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
overfit_lambda_feedback(model, dataset, feedback_dir, iter_num, use_abs_target=True)
Evaluates the model's overfit lambda hyperparameters based on the pre-defined desired states(additive impacts or their fractions) and updates the hyperparameters accordingly. Appends the feedback data to a CSV file and saves the country-level impact plots. Returns the updates to the hyperparameters and the feedback data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
ModType
|
Trained model |
required |
dataset |
EconomicDataset
|
Dataset used for training to calculate the impacts |
required |
feedback_dir |
Path
|
Dir to save the feedback data |
required |
iter_num |
int
|
NF iteration number |
required |
use_abs_target |
bool
|
If True, updates hyperparameters based on desired additive impacts, else based on desired impact fractions. Defaults to True. |
True
|
Returns: tuple[Mapping[Sequence[str], Any], Any]: Updates to hyperparameters and feedback data
Source code in wt_ml/negative_feedback/overfit_lambda_evaluator.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
|