Build a piecewise linear fit coder with some parameters bound in.
piecewise_linear_coder(
penalty = 1,
min_n_to_chunk = 1000,
min_seg = 10,
max_k = 1000
)
per-segment cost penalty.
minimum n to subdivied problem.
positive integer, minimum segment size.
maximum segments to divide into.
a vtreat coder
coder <- piecewise_linear_coder(min_seg = 1)
coder("x", 1:8, c(1, 2, 3, 4, 4, 3, 2, 1))
#> [1] 1 2 3 4 4 3 2 1
#> attr(,"approx_table")
#> predXs predYs
#> 1 1 1
#> 2 4 4
#> 3 5 4
#> 4 8 1
#> attr(,"method")
#> [1] "linear"