segmentation_algorithms
segment_a_node_using_attribute Link
segment_a_node_using_attribute(quotientgraph, quotient_node_to_work, attribute_to_work_with='direction_gradient', method='OPTICS')
Perform clustering on a specified node of the QuotientGraph, updating the associated nodes of the PointCloudGraph accordingly.
Parameters:
-
quotientgraph
(QuotientGraph
) –The QuotientGraph object containing the graph data.
-
quotient_node_to_work
(int
) –The node in the QuotientGraph to cluster.
-
attribute_to_work_with
(str
, default:'direction_gradient'
) –The attribute of the PointCloudGraph nodes to use for clustering. Default is 'direction_gradient'.
-
method
(str
, default:'OPTICS'
) –The clustering method to use. Supported methods are 'KMEANS' and 'OPTICS'. Default is 'OPTICS'.
Notes
- The function clusters the nodes of the PointCloudGraph that are part of the given 'quotient_node_to_work'.
- Updates the
quotient_graph_node
attribute of each PointCloudGraph node to reflect the new clustering.
See Also
sklearn.cluster.KMeans : K-means clustering algorithm. sklearn.cluster.OPTICS : OPTICS clustering algorithm for density-based clustering.
Source code in spectral_clustering/segmentation_algorithms.py
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
segment_each_cluster_by_optics Link
segment_each_cluster_by_optics(quotientgraph, list_leaves=[], leaves_out=True, attribute_to_work='direction_gradient')
Perform clustering on the nodes of the QuotientGraph, updating the corresponding nodes in the associated PointCloudGraph based on the specified attribute.
Each node of the QuotientGraph is processed and re-clustered based on the values of a specified
attribute in the associated PointCloudGraph. The clustering is performed using an external
function, which updates the quotient_graph_node
attribute for those nodes. The QuotientGraph
is updated accordingly after the clustering.
Parameters:
-
quotientgraph
(QuotientGraph
) –The QuotientGraph object containing the graph structure and associated PointCloudGraph data.
-
list_leaves
(list of int
, default:[]
) –A list of node indices in the QuotientGraph to be excluded from clustering when
leaves_out
is True. -
leaves_out
(bool
, default:True
) –If True, end nodes (or leaves) of the QuotientGraph in
list_leaves
are excluded from the clustering process. If False, all nodes are included regardless oflist_leaves
. -
attribute_to_work
(str
, default:'direction_gradient'
) –The attribute in the PointCloudGraph associated with the QuotientGraph to be used for re-clustering the nodes.
Notes
- The function updates the
quotient_graph_node
attribute for each node in the PointCloudGraph to reflect the new clustering results. - The QuotientGraph structure to align with the updated clustering.
- Only nodes in the QuotientGraph with an
intra_class_node_number
greater than 100 are processed for clustering. - The function delegates the clustering task to
segment_several_nodes_using_attribute
, which performs clustering using the specified attribute and method.
See Also
segment_several_nodes_using_attribute : Perform clustering on multiple specified nodes of the QuotientGraph.
Source code in spectral_clustering/segmentation_algorithms.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
|
segment_several_nodes_using_attribute Link
segment_several_nodes_using_attribute(quotientgraph, list_quotient_node_to_work=[], algo='OPTICS', para_clustering_meth=100, attribute='direction_gradient')
Perform clustering on multiple specified nodes of the QuotientGraph, updating the class of the underlying nodes in the associated PointCloudGraph.
Parameters:
-
quotientgraph
(QuotientGraph
) –The QuotientGraph object containing the graph data.
-
list_quotient_node_to_work
(list of int
, default:[]
) –A list of node indices in the QuotientGraph to be clustered. Default is an empty list, which means no nodes are clustered.
-
algo
((kmeans, OPTICS)
, default:'kmeans'
) –The clustering algorithm to use. Supported values are: - 'kmeans': K-means clustering, - 'OPTICS': Density-based clustering. Default is 'OPTICS'.
-
para_clustering_meth
(int
, default:100
) –The parameter needed for the chosen clustering algorithm: - For 'OPTICS', it specifies the minimum sample size (
min_samples
) to form a cluster. - For 'kmeans', it specifies the number of clusters (n_clusters
) to generate. Default is 100. -
attribute
(str
, default:'direction_gradient'
) –The node attribute from the PointCloudGraph to be used for clustering. Default is 'direction_gradient'.
Notes
- The function selects the nodes from the PointCloudGraph corresponding to the specified nodes in
list_quotient_node_to_work
from the QuotientGraph. - The clustering results are assigned as new values for the
quotient_graph_node
attribute of the PointCloudGraph nodes. - The updated clustering is applied to the PointCloudGraph associated with the QuotientGraph. Only the PointCloudGraph is directly modified.
Source code in spectral_clustering/segmentation_algorithms.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|