Skip to contents

f(x) = beta0 + beta' x; sign(f) is the side and |f| / |beta| the Euclidean distance to the hyperplane (ESL eq 4.40; the signed distance is f(x) / |beta|).

Usage

hyperplane_side(X, beta, beta0 = 0)

Arguments

X

Points, one per row (or a single vector).

beta

Normal vector (not all zero).

beta0

Intercept.

Value

Named list: value, side, distance, on_plane, n.

References

Hastie, Tibshirani & Friedman (2009), sec. 4.5.

Examples

hyperplane_side(rbind(c(1, 2), c(0, -1)), c(3, 4), -2)$distance
#> [1] 1.8 1.2