square_window: Build a square windows variable, numeric target.

View source: R/square_window.R

square_windowR Documentation

Build a square windows variable, numeric target.

Description

Build a square moving average window (KNN in 1d). This is a high-frequency feature.

Usage

square_window(varName, x, y, w = NULL)

Arguments

varName

character, name of variable

x

numeric input (not empty, no NAs).

y

numeric or castable to such (same length as x no NAs), output to match

w

numeric positive, same length as x (weights, can be NULL) IGNORED

Value

segmented y prediction

Examples


d <- data.frame(x = c(NA, 1:6), y = c(0, 0, 0, 1, 1, 0, 0))
square_window("v", d$x, d$y)



vtreat documentation built on Aug. 20, 2023, 1:08 a.m.