Tree-based models (C API)

typedef struct _EmlTrees EmlTrees

Tree-ensemble.

Normally the model initialization is generated by emlearn.

A decision tree is just a special case of an ensemble/forest, with only 1 tree.

int32_t eml_trees_predict(const EmlTrees *forest, const int16_t *features, int8_t features_length)

Run inference and return most probable class.

Parameters:
  • forest – EmlTrees instance

  • features – Input data values

  • features_length – Length of input data

Returns:

The class number, or -EmlTreesError on failure

float eml_trees_regress1(const EmlTrees *forest, const int16_t *features, int8_t features_length)

Run inference and return single regression value.

Parameters:
  • forest – EmlTrees instance

  • features – Input data values

  • features_length – Length of input data

Returns:

The output value on success, or NAN on failure

EmlError eml_trees_regress(const EmlTrees *forest, const int16_t *features, int8_t features_length, float *out, int8_t out_length)

Run inference and return regression values.

Parameters:
  • forest – EmlTrees instance

  • features – Input data values

  • features_length – Length of input data

  • out – Buffer to store output

  • out_length – Length of output buffer

Returns:

EmlOk on success, or error on failure