Mlflow logger
MLflowLogger
Abstracts how MlFlow works
Source code in template_nlp/monitoring/mlflow_logger.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 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 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 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 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
|
artifact_uri: str
property
Experiment artifact URI. It can not be changed.
experiment_id: str
property
Experiment id. It can not be changed.
experiment_name: str
property
Experiment name. It can not be changed.
tracking_uri: str
property
writable
Current tracking uri
__init__(experiment_name, tracking_uri='', artifact_uri='')
Class initialization Args: experiment_name (str): Name of the experiment to activate Kwargs: tracking_uri (str): URI of the tracking server artifact_uri (str): URI where to store artifacts
Source code in template_nlp/monitoring/mlflow_logger.py
end_run()
log_df_stats(df_stats, label_col='Label')
Log a dataframe containing metrics from a training
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df_stats |
Dataframe
|
Dataframe containing metrics from a training |
required |
Kwargs: label_col (str): default labelc column name
Source code in template_nlp/monitoring/mlflow_logger.py
log_dict(dictionary, artifact_file)
Logs a dictionary as an artifact in MLflow
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dictionary |
dict
|
A dictionary |
required |
artifact_file |
str
|
The run-relative artifact file path in posixpath format to which the dictionary is saved |
required |
Source code in template_nlp/monitoring/mlflow_logger.py
log_figure(figure, artifact_file)
Logs a text as an artifact in MLflow
Parameters:
Name | Type | Description | Default |
---|---|---|---|
figure |
Figure
|
A matplotlib figure |
required |
artifact_file |
str
|
The run-relative artifact file path in posixpath format to which the figure is saved |
required |
Source code in template_nlp/monitoring/mlflow_logger.py
log_metric(key, value, step=None)
Logs a metric on mlflow
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
Name of the metric |
required |
value |
float, ?
|
Value of the metric |
required |
Kwargs: step (int): Step of the metric
Source code in template_nlp/monitoring/mlflow_logger.py
log_metrics(metrics, step=None)
Logs a set of metrics in mlflow
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metrics |
dict
|
Metrics to log |
required |
Kwargs: step (int): Step of the metric
Source code in template_nlp/monitoring/mlflow_logger.py
log_param(key, value)
Logs a parameter in mlflow
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
Name of the parameter |
required |
value |
str, ?
|
Value of the parameter (which will be cast to str if not already of type str) |
required |
Source code in template_nlp/monitoring/mlflow_logger.py
log_params(params)
Logs a set of parameters in mlflow
Parameters:
Name | Type | Description | Default |
---|---|---|---|
params |
dict
|
Name and value of each parameter |
required |
Source code in template_nlp/monitoring/mlflow_logger.py
log_text(text, artifact_file)
Logs a text as an artifact in MLflow
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
str
|
A text |
required |
artifact_file |
str
|
The run-relative artifact file path in posixpath format to which the dictionary is saved |
required |
Source code in template_nlp/monitoring/mlflow_logger.py
set_tag(key, value)
Logs a tag in mlflow
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
Name of the tag |
required |
value |
str, ?
|
Value of the tag (which will be cast to str if not already of type str) |
required |
Raises: ValueError: If the object value is None
Source code in template_nlp/monitoring/mlflow_logger.py
set_tags(tags)
Logs a set of tags in mlflow
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tags |
dict
|
Name and value of each tag |
required |
valid_name(key)
Validates key names
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key |
str
|
Key to check |
required |
Returns: bool: If key is a valid mlflow key