Functions library

The following article contains a categorized list of UDF (user-defined functions).

The user-defined functions code is given in the articles. It can be used within a let statement embedded in a query or can be persisted in a database using .create function.

Machine learning functions

Function Name Description
kmeans_fl() Clusterize using the k-means algorithm.
predict_fl() Predict using an existing trained machine learning model.
predict_onnx_fl() Predict using an existing trained machine learning model in ONNX format.

PromQL functions

The following section contains common PromQL functions. These functions can be used for analysis of metrics ingested to Azure Data Explorer by the Prometheus monitoring system. All functions assume that metrics in Azure Data Explorer are structured using the Prometheus data model.

Function Name Description
series_metric_fl() Select and retrieve time series stored with the Prometheus data model.
series_rate_fl() Calculate the average rate of counter metric increase per second.

Series processing functions

Function Name Description
quantize_fl() Quantize metric columns.
series_dbl_exp_smoothing_fl() Apply a double exponential smoothing filter on a series.
series_dot_product_fl() Calculate the dot product of two numerical vectors.
series_downsample_fl() Downsample a time series by an integer factor.
series_exp_smoothing_fl() Apply a basic exponential smoothing filter on a series.
series_fit_lowess_fl() Fit a local polynomial to series using LOWESS method.
series_fit_poly_fl() Fit a polynomial to series using regression analysis.
series_fbprophet_forecast_fl() Forecast time series values using the Prophet algorithm.
series_lag_fl() Apply a lag filter on a series.
series_moving_avg_fl() Apply a moving average filter on a series.
series_rolling_fl() Apply a rolling aggregation function on a series.
series_uv_anomalies_fl() Detect anomalies in time series using the Univariate Anomaly Detection Cognitive Service API.
series_uv_change_points_fl() Detect change points in time series using the Univariate Anomaly Detection Cognitive Service API.
time_weighted_avg_fl() Calculates the time weighted average of a metric.
time_window_rolling_avg_fl() Calculates the rolling average of a metric over a constant duration time window.

Statistical and probability functions

Function Name Description
bartlett_test_fl() Perform the Bartlett test.
binomial_test_fl() Perform the binomial test.
comb_fl() Calculate C(n, k), the number of combinations for selection of k items out of n.
factorial_fl() Calculate n!, the factorial of n.
ks_test_fl() Perform a Kolmogorov Smirnov test.
levene_test_fl()n Perform a Levene test.
normality_test_fl() Performs the Normality Test.
mann_whitney_u_test_fl() Perform a Mann-Whitney U Test.
pair_probabilities_fl() Calculate various probabilities and related metrics for a pair of categorical variables.
pairwise_dist_fl() Calculate pairwise distances between entities based on multiple nominal and numerical variables.
perm_fl() Calculate P(n, k), the number of permutations for selection of k items out of n.
two_sample_t_test_fl() Perform the two sample t-test.
wilcoxon_test_fl() Perform the Wilcoxon Test.