Distance-based models (C API)

typedef struct _EmlEllipticEnvelope EmlEllipticEnvelope

Model.

Normally the initialization code is generated by emlearn.

float eml_elliptic_envelope_predict(const EmlEllipticEnvelope *self, const float *features, int n_features, float *out_dist)

Run inference and return outlier score

Parameters:
  • self – EmlEllipticEnvelope instance

  • features – The input data values

  • features – Length of input data array

  • out_dist – Return location for the continious outlier score (Mahalanobis distance)

Returns:

1 for outlier, 0 for inlier

float eml_mahalanobis_distance_squared(const float *x1, const float *x2, const float *precision, int n_features)

Compute Mahalanobis distance between two arrays.

Computes (x1 - x2).T * VI * (x1 - x2) where VI is the precision matrix (inverse of the covariance matrix)

Parameters:
  • x1 – First set of input values

  • x2 – Second set of input values

  • precision – The precision matrix. Inverse of covariance matrix

  • n_features – Length of the input values arrays