oraclesai.preprocessing.CategoricalLagTransformer

class CategoricalLagTransformer(spatial_weights_definition=None)

The categorical lag is used for categorical variables and represents the most common value in the neighborhood. For example, given a feature representing the property type; the categorical lag is the most common property in the surroundings

Parameters:

spatial_weights_definition – SpatialWeightsDefinition, default=None. Spatial relationship specification.

Methods

__init__([spatial_weights_definition])

fit(X[, y, geometries, spatial_weights])

Calculates the spatial weights of the training data using the algorithm associated with the parameter spatial_weights_definition and the geometry column.

fit_transform(X[, y, geometries])

Fit to data, then transform it.

get_params([deep])

Get parameters for this estimator.

set_params(**params)

Set the parameters of this estimator.

transform(X[, y, geometries, ...])

Returns the most common value from each location's neighbors; by defining the parameter use_fit_lag, it can use the neighbors from the training set, or the data passed into the transform method; the output is a NumPy array.