![]() |
pyclustering
0.10.1
pyclustring is a Python, C++ data mining library.
|
Represents balanced static KD-tree that does not provide services to add and remove nodes after initialization. More...
Inheritance diagram for pyclustering.container.kdtree.kdtree_balanced:Public Member Functions | |
| def | __init__ (self, points, payloads=None) |
| Initializes balanced static KD-tree. More... | |
| def | __len__ (self) |
| Returns amount of nodes in the KD-tree. More... | |
| def | get_root (self) |
| Returns root of the tree. More... | |
| def | find_node_with_payload (self, point, point_payload, cur_node=None) |
| Find node with specified coordinates and payload. More... | |
| def | find_node (self, point, cur_node=None) |
| Find node with coordinates that are defined by specified point. More... | |
| def | find_nearest_dist_node (self, point, distance, retdistance=False) |
| Find nearest neighbor in area with radius = distance. More... | |
| def | find_nearest_dist_nodes (self, point, distance) |
| Find neighbors that are located in area that is covered by specified distance. More... | |
Represents balanced static KD-tree that does not provide services to add and remove nodes after initialization.
In the term KD tree, k denotes the dimensionality of the space being represented. Each data point is represented as a node in the k-d tree in the form of a record of type node.
There is an example how to create KD-tree:
Output result of the example above - figure 1.
| def pyclustering.container.kdtree.kdtree_balanced.__init__ | ( | self, | |
| points, | |||
payloads = None |
|||
| ) |
Initializes balanced static KD-tree.
| [in] | points | (array_like): Points that should be used to build KD-tree. |
| [in] | payloads | (array_like): Payload of each point in points. |
Reimplemented in pyclustering.container.kdtree.kdtree.
| def pyclustering.container.kdtree.kdtree_balanced.__len__ | ( | self | ) |
| def pyclustering.container.kdtree.kdtree_balanced.find_nearest_dist_node | ( | self, | |
| point, | |||
| distance, | |||
retdistance = False |
|||
| ) |
Find nearest neighbor in area with radius = distance.
| [in] | point | (list): Maximum distance where neighbors are searched. |
| [in] | distance | (double): Maximum distance where neighbors are searched. |
| [in] | retdistance | (bool): If True - returns neighbors with distances to them, otherwise only neighbors is returned. |
| def pyclustering.container.kdtree.kdtree_balanced.find_nearest_dist_nodes | ( | self, | |
| point, | |||
| distance | |||
| ) |
Find neighbors that are located in area that is covered by specified distance.
| [in] | point | (list): Coordinates that is considered as centroid for searching. |
| [in] | distance | (double): Distance from the center where searching is performed. |
Definition at line 458 of file kdtree.py.
Referenced by pyclustering.container.kdtree.kdtree_balanced.find_nearest_dist_node().
| def pyclustering.container.kdtree.kdtree_balanced.find_node | ( | self, | |
| point, | |||
cur_node = None |
|||
| ) |
Find node with coordinates that are defined by specified point.
If node with specified parameters does not exist then None will be returned, otherwise required node will be returned.
| [in] | point | (list): Coordinates of the point whose node should be found. |
| [in] | cur_node | (node): Node from which search should be started. |
Definition at line 415 of file kdtree.py.
Referenced by pyclustering.container.kdtree.kdtree.remove().
| def pyclustering.container.kdtree.kdtree_balanced.find_node_with_payload | ( | self, | |
| point, | |||
| point_payload, | |||
cur_node = None |
|||
| ) |
Find node with specified coordinates and payload.
If node with specified parameters does not exist then None will be returned, otherwise required node will be returned.
| [in] | point | (list): Coordinates of the point whose node should be found. |
| [in] | point_payload | (any): Payload of the node that is searched in the tree. |
| [in] | cur_node | (node): Node from which search should be started. |
Definition at line 397 of file kdtree.py.
Referenced by pyclustering.container.kdtree.kdtree.remove().
| def pyclustering.container.kdtree.kdtree_balanced.get_root | ( | self | ) |