oraclesai.weights.DistanceBandWeightsDefinition

class DistanceBandWeightsDefinition(threshold, p=2, alpha=-1.0, binary=True)

Defines a spatial relationship based on a given distance. It uses the distance between two nodes as the weight for the edge connecting them.

Parameters:
  • threshold – A distance.

  • p – float, default=2. Minkowski p-norm, where p=2 refers to the Euclidean distance, and p=1 refers to the Manhattan distance.

  • alpha – float, default=-1.0. Distance decay, if alpha is positive the weights won’t decline with distance. If binary is True, alpha is ignored.

  • binary – bool, default=True. If true, the weight \(w_{ij}=1\) if \(d_{ij}<=threshold\); otherwise, \(w_{ij}=0\). If false, \(w_{ij}=d_{ij}^{alpha}\).

Methods

__init__(threshold[, p, alpha, binary])

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.