Hierarchy fragmentation curve
This class represents a fragmentation curve, ie the evolution of the scores of the partitions of a hierarchy with respect to the number of regions in those partitions. |
|
Quality measures usable with optimal cut assessment |
|
|
Fragmentation curve of the horizontal cuts in a hierarchy w.r.t. |
|
Fragmentation curve of the optimal cuts in a hierarchy w.r.t. |
Creates an assesser for hierarchy optimal cuts w.r.t. |
|
- class FragmentationCurve
This class represents a fragmentation curve, ie the evolution of the scores of the partitions of a hierarchy with respect to the number of regions in those partitions.
Example
plt.plot(x=fg.num_regions(), y=fg.scores())
- __init__(*args, **kwargs)
- num_regions(self: higra.higram.FragmentationCurve) numpy.ndarray[numpy.float64]
Array of number of regions in the different cuts
- num_regions_ground_truth(self: higra.higram.FragmentationCurve) int
Array of number of regions in the different cuts
- num_regions_normalized(self: higra.higram.FragmentationCurve) numpy.ndarray[numpy.float64]
Array of number of regions in the different cuts divided by the number of regions in the ground-truth
- scores(self: higra.higram.FragmentationCurve) numpy.ndarray[numpy.float64]
Array of scores of the different cuts
- class OptimalCutMeasure
Quality measures usable with optimal cut assessment
Members:
BCE
DHamming
DCovering
- BCE = <OptimalCutMeasure.BCE: 0>
- DCovering = <OptimalCutMeasure.DCovering: 2>
- DHamming = <OptimalCutMeasure.DHamming: 1>
- __eq__(self: object, other: object) bool
- __getstate__(self: object) int
- __hash__(self: object) int
- __index__(self: higra.higram.OptimalCutMeasure) int
- __init__(self: higra.higram.OptimalCutMeasure, value: int) None
- __int__(self: higra.higram.OptimalCutMeasure) int
- __members__ = {'BCE': <OptimalCutMeasure.BCE: 0>, 'DCovering': <OptimalCutMeasure.DCovering: 2>, 'DHamming': <OptimalCutMeasure.DHamming: 1>}
- __module__ = 'higra.higram'
- __ne__(self: object, other: object) bool
- __repr__(self: object) str
- __setstate__(self: higra.higram.OptimalCutMeasure, state: int) None
- __str__(self: object) str
- property name
- property value
- assess_fragmentation_horizontal_cut(tree, altitudes, ground_truth, measure, max_regions=200, vertex_map=None)[source]
Fragmentation curve of the horizontal cuts in a hierarchy w.r.t. a given measure.
The base graph of the hierarchy is:
the leaf graph of the hierarchy if it is not a region adjacency graph
the original graph of the leaf graph of the hierarchy if it is a region adjacency graph
- Parameters:
tree – input hierarchy (Concept
CptHierarchy)altitudes – altitudes of the nodes of the input hierarchy
ground_truth – labelisation of base graph vertices
measure – evaluation measure to use (see enumeration
PartitionMeasure)max_regions – maximum number of regions in the cuts
vertex_map – optional, vertex mapping if the hierarchy is build on a region adjacency graph (deduced from
CptRegionAdjacencyGraphon the leaf graph of tree)
- Returns:
an object of type
FragmentationCurve
- assess_fragmentation_optimal_cut(tree, ground_truth, measure, max_regions=200, vertex_map=None)[source]
Fragmentation curve of the optimal cuts in a hierarchy w.r.t. a given measure.
The base graph of the hierarchy is:
the leaf graph of the hierarchy if it is not a region adjacency graph
the original graph of the leaf graph of the hierarchy if it is a region adjacency graph
- Parameters:
tree – input hierarchy (Concept
CptHierarchy)ground_truth – labelisation of base graph vertices
measure – evaluation measure to use (see enumeration
OptimalCutMeasure)max_regions – maximum number of regions in the cuts
vertex_map – optional, vertex mapping if the hierarchy is build on a region adjacency graph (deduced from
CptRegionAdjacencyGraphon the leaf graph of tree)
- Returns:
an object of type
FragmentationCurve
- make_assesser_fragmentation_optimal_cut(tree, ground_truth, measure, max_regions=200, vertex_map=None)[source]
Creates an assesser for hierarchy optimal cuts w.r.t. a given ground-truth partition of the base graph vertices and the given optimal cut measure (see
OptimalCutMeasure). The algorithms will explore optimal cuts containing at most max_regions regions.The base graph of the hierarchy is:
the leaf graph of the hierarchy if it is not a region adjacency graph
the original graph of the leaf graph of the hierarchy if it is a region adjacency graph
- Parameters:
tree – input hierarchy (Concept
CptHierarchy)ground_truth – labelisation of base graph vertices
measure – evaluation measure to use (see enumeration
OptimalCutMeasure)max_regions – maximum number of regions in the cuts
vertex_map – optional, vertex mapping if the hierarchy is build on a region adjacency graph (deduced from
CptRegionAdjacencyGraphon the leaf graph of tree)
- Returns:
an object of type
AssesserFragmentationOptimalCut
- class AssesserFragmentationOptimalCut
- fragmentation_curve(self: higra.higram.AssesserFragmentationOptimalCut) higra.higram.FragmentationCurve
Fragmentation curve, i.e. for each number of region k between 1 and max_regions, the score of the optimal cut with k regions.
- optimal_number_of_regions(self: higra.higram.AssesserFragmentationOptimalCut) int
Number of regions in the optimal cut.
- optimal_partition(self: higra.higram.AssesserFragmentationOptimalCut, num_regions: int = 0) numpy.ndarray[numpy.uint64]
Labelisation of the tree vertices that corresponds to the optimal cut withthe given number of regions. If the number of regions is equal to 0 (default), the global optimal cut it returned (it will contain get_optimal_number_of_regions regions).
- optimal_score(self: higra.higram.AssesserFragmentationOptimalCut) float
Score of the optimal cut.