oraclesai.weights.KernelBasedWeightsDefinition
- class KernelBasedWeightsDefinition(bandwidth=None, fixed=True, k=2, function='triangular')
Defines a spatial relationship based on a kernel function, a decay function where closer neighbors have larger values while further neighbors have smaller ones.
- Parameters:
bandwidth – The distance used for the kernel function.
fixed – If True, the same bandwidth is used across all the records. Otherwise, the bandwidth is adaptive across observations.
k – Number of nearest neighbors used to calculate bandwidth. If
fixed=True
, the bandwidth is the maximum distance that guarantees that all observations have at least k neighbors; otherwise, the bandwidth is adaptive, so all observations have exactly k neighbors.function – Name of the kernel function to be used. Available options are: triangular, uniform, quadratic, gaussian.
Methods
__init__
([bandwidth, fixed, k, function])from_dict
(w_dict)from_json
(json_str)Attributes
index_allowed
Returns true if the spatial weights may be calculated by passing a spatial index of the data.