Writing Functions for Regression
Writing the functions needed to create a custom regression metric.
Sample Dataset
import pandas as pd
import nannyml as nml
reference = pd.read_parquet("https://github.com/NannyML/sample_datasets/raw/main/synthetic_pure_covariate_shift_datasets/regression/synthetic_custom_metrics_regression_reference.pq")
monitored = pd.read_parquet("https://github.com/NannyML/sample_datasets/raw/main/synthetic_pure_covariate_shift_datasets/regression/synthetic_custom_metrics_regression_monitored.pq")
reference.head(5)+----+------------+------------+------------+------------+------------+------------+------------+----------+----------+----------------------------+
| | feature1 | feature2 | feature3 | feature4 | feature5 | feature6 | feature7 | y_true | y_pred | timestamp |
+====+============+============+============+============+============+============+============+==========+==========+============================+
| 0 | 0.899145 | -2.64707 | 2.80074 | 2.02636 | -2.53157 | -2.12171 | -0.360711 | 7.97047 | 3.15523 | 2020-03-11 00:00:00 |
+----+------------+------------+------------+------------+------------+------------+------------+----------+----------+----------------------------+
| 1 | -1.09015 | -0.442365 | 1.94911 | -0.378131 | 0.517571 | 2.67345 | -1.71358 | -13.5075 | -13.1339 | 2020-03-11 00:01:40.800000 |
+----+------------+------------+------------+------------+------------+------------+------------+----------+----------+----------------------------+
| 2 | 0.619741 | 0.924163 | 1.30714 | 2.60199 | -0.776712 | 1.41447 | -0.848892 | -6.39705 | -5.324 | 2020-03-11 00:03:21.600000 |
+----+------------+------------+------------+------------+------------+------------+------------+----------+----------+----------------------------+
| 3 | -1.7384 | -0.54207 | 1.58942 | 4.12909 | -1.78157 | -0.275194 | -1.82792 | -11.8357 | -3.20461 | 2020-03-11 00:05:02.400000 |
+----+------------+------------+------------+------------+------------+------------+------------+----------+----------+----------------------------+
| 4 | -4.78688 | 0.330358 | -2.56052 | -2.32385 | 1.19089 | -2.58183 | -1.68192 | 4.17999 | 5.68762 | 2020-03-11 00:06:43.200000 |
+----+------------+------------+------------+------------+------------+------------+------------+----------+----------+----------------------------+Developing custom regression metric functions
Custom Functions API
Custom Pinball metric
Testing a Custom Metric in the Cloud product


