TTK
Loading...
Searching...
No Matches
PersistenceDiagramClustering.h
Go to the documentation of this file.
1
32
33#pragma once
34
35// base code includes
36#include <PDClustering.h>
38
39namespace ttk {
40
41 class PersistenceDiagramClustering : virtual public Debug {
42
43 public:
45 this->setDebugMsgPrefix("PersistenceDiagramClustering");
46 }
47
48 ~PersistenceDiagramClustering() override = default;
49
50 std::vector<int> execute(
51 std::vector<DiagramType> &intermediateDiagrams,
52 std::vector<DiagramType> &centroids,
53 std::vector<std::vector<std::vector<MatchingType>>> &all_matchings);
54
55 std::array<double, 3> getDistances() const {
56 return this->distances;
57 }
58
59 void setTimeLimit(double timeLimit) {
60 this->TimeLimit = timeLimit;
61 }
62
63 void setForceUseOfAlgorithm(bool forceUseOfAlgorithm) {
64 this->ForceUseOfAlgorithm = forceUseOfAlgorithm;
65 }
66
67 void setDeltaLim(double DeltaLimNew) {
68 this->DeltaLim = DeltaLimNew;
69 }
70
71 void setUseAdditionalPrecision(bool Precision) {
72 this->UseAdditionalPrecision = Precision;
73 }
74
75 void setUseProgressive(bool UseProgressive_) {
76 this->UseProgressive = UseProgressive_;
77 }
78
79 void setUseInterruptible(bool UseInterruptible_) {
80 this->UseInterruptible = UseInterruptible_;
81 }
82
83 void setDeterministic(bool Deterministic_) {
84 this->Deterministic = Deterministic_;
85 }
86
87 void setAlpha(double Alpha_) {
88 this->Alpha = Alpha_;
89 }
90
91 void setUseAccelerated(bool UseAccelerated_) {
92 this->UseAccelerated = UseAccelerated_;
93 }
94
95 void setUseKmeansppInit(bool UseKmeansppInit_) {
96 this->UseKmeansppInit = UseKmeansppInit_;
97 }
98
99 inline void setUseCustomWeights(bool data) {
100 UseCustomWeights = data;
101 }
102 inline void setCustomWeights(std::vector<double> *pdata) {
103 CustomWeights = pdata;
104 }
105
106 protected:
107 // Critical pairs used for clustering
108 // 0:min-saddles ; 1:saddles-saddles ; 2:sad-max ; else : all
109
110 // distance results per pair type
111 std::array<double, 3> distances{};
112
115 bool Deterministic{true};
117
118 bool UseProgressive{true};
119
122 double Alpha{1.0};
124 double DeltaLim{0.01};
125 double Lambda{1.0};
126 double TimeLimit{999999};
127 double NonMatchingWeight = 1.0;
128
130 bool UseAccelerated{false};
131 bool UseKmeansppInit{false};
132
135
136 std::vector<double> *CustomWeights{};
137 bool UseCustomWeights{false};
138 };
139
140 void
141 computeWeightedBarycenter(std::vector<DiagramType> &intermediateDiagrams,
142 std::vector<double> &weights,
143 DiagramType &barycenter,
144 std::vector<std::vector<MatchingType>> &matchings,
145 const ttk::Debug &dbg,
146 const bool ProgBarycenter);
147
148} // namespace ttk
Minimalist debugging class.
Definition Debug.h:88
void setDebugMsgPrefix(const std::string &prefix)
Definition Debug.h:364
void setUseInterruptible(bool UseInterruptible_)
std::array< double, 3 > getDistances() const
std::vector< int > execute(std::vector< DiagramType > &intermediateDiagrams, std::vector< DiagramType > &centroids, std::vector< std::vector< std::vector< MatchingType > > > &all_matchings)
void setForceUseOfAlgorithm(bool forceUseOfAlgorithm)
~PersistenceDiagramClustering() override=default
void setCustomWeights(std::vector< double > *pdata)
TTK base package defining the standard types.
void computeWeightedBarycenter(std::vector< DiagramType > &intermediateDiagrams, std::vector< double > &weights, DiagramType &barycenter, std::vector< std::vector< MatchingType > > &matchings, const ttk::Debug &dbg, const bool ProgBarycenter)
std::vector< PersistencePair > DiagramType
Persistence Diagram type as a vector of Persistence pairs.