Docs · Machine learning

iso: isotonic regression.

A non-decreasing fit of y against x, the equivalent of Spark MLlib's IsotonicRegression.

Module
ml_iso
Header
clio_ml/isotonic.h

What it does

A non-decreasing fit of y against x, the equivalent of Spark MLlib's IsotonicRegression. The x range is split into bins, the bin sums are gathered in one paged pass, and the pool-adjacent-violators algorithm runs on the bins. Prediction interpolates linearly between boundaries and clamps outside them, as Spark does.

Rows

Fixed records of (x, y); the fit takes no column count.

Python

python
import numpy as np, clio_ml as cm
r = cm.fit_iso(XY, num_bins=1024, lo=0.0, hi=1.0)   # XY: rows of (x, y)
y_hat = cm.predict("iso", r, 0.25)
  • fit_iso(X, **options) accepts an in-memory array or a paged Dataset from cm.dataset(X) or cm.assimilate(...).
  • Options: num_bins (1024), lo (0.0) and hi (1.0), the feature range, threads (256).
  • Result IsotonicResult: model.boundaries (mean x of each non-empty bin, ascending), model.predictions (non-decreasing fitted values), stats.

C++

cpp
IsotonicResult FitIsotonic(Dataset &ds, const IsotonicOptions &opt);
IsotonicResult FitIsotonicPlain(const float *data, u64 n_rows, u64 elems_per_page,
                                u32 nblocks, const IsotonicOptions &opt);
float IsotonicPredict(const IsotonicModel &m, float x);

The paged call needs the runtime; the Plain call runs the same kernel over a plain copy of the data without one.

Related: linear regression. Back to the machine learning overview.