Classification kriging, after pykrige.ck.ClassificationKriging (PyKrige): simplicial
indicator kriging of a classifier's residuals.
fit/4 fits a classifier of the labels on predictors observed at the points, then takes the
isometric log-ratio (ILR) coordinates of the one-hot labels and of the classifier's
probabilities, and krige each coordinate of their difference over the points
(Geostatex.Kriging). predict_proba/3 adds the kriged residual to the ILR of the
classifier's probabilities at new points and transforms back; predict/3 gives the most
probable class.
Options of fit/4
:classification(required) -{fit, predict_proba}, two functions:fit.(predictors, labels)returns a model andpredict_proba.(model, predictors)a list of rows, one probability per class in the order of the sorted classes (Scholar, Axon, ...).:method-:ordinary(default) or:universalkriging of the residuals.:n_closest_points- the moving window at prediction (default10, as PyKrige;niluses every point; universal kriging uses every point).- Any option of
Geostatex.Kriging.ordinary/3(oruniversal/3), with PyKrige's defaultsvariogram_model: :linear,nlags: 6;:variogram_parametersmay also be a list with one set per ILR coordinate (one fewer than the classes).
ilr/1 and inverse_ilr/1 are PyKrige's transforms: log(max(p, eps)) times the negated
Helmert contrasts (scipy's helmert without its first row), and back by exp and closure.
PyKrige's predict returns the index of the most probable class; Geostatex returns the class.
iex> points = for x <- 0..3, y <- 0..3, do: {x * 10.0, y * 10.0}
iex> labels = for {x, _} <- points, do: if(x < 20, do: :a, else: :b)
iex> classifier = {fn _p, _l -> nil end, fn nil, rows -> for _ <- rows, do: [0.5, 0.5] end}
iex> ck = Geostatex.ClassificationKriging.fit(Enum.map(points, &[elem(&1, 0)]), points, labels,
...> classification: classifier,
...> variogram_model: :spherical,
...> variogram_parameters: %{psill: 1.0, range: 25.0, nugget: 0.0})
iex> Geostatex.ClassificationKriging.predict(ck, [[0.0], [30.0]], [{0.0, 0.0}, {30.0, 30.0}])
[:a, :b]
Summary
Functions
Fits the classifier and krige the ILR residuals. See the module documentation.
PyKrige's isometric log-ratio transform of compositions (rows of D parts).
PyKrige's inverse isometric log-ratio transform (rows of D - 1 coordinates).
The kriged ILR residuals at points: one row per point, one value per ILR coordinate.
The most probable class at points.
The class probabilities at points: the classifier's corrected by the kriged residuals.
The share of labels that predict/3 gets right.
Types
Functions
Fits the classifier and krige the ILR residuals. See the module documentation.
PyKrige's isometric log-ratio transform of compositions (rows of D parts).
PyKrige's inverse isometric log-ratio transform (rows of D - 1 coordinates).
The kriged ILR residuals at points: one row per point, one value per ILR coordinate.
The most probable class at points.
The class probabilities at points: the classifier's corrected by the kriged residuals.
The share of labels that predict/3 gets right.