TTK
Loading...
Searching...
No Matches
DimensionReductionMetrics.h
Go to the documentation of this file.
1
13
14#pragma once
15
16// ttk common includes
17#include <Debug.h>
18
19namespace ttk {
20
21 class DimensionReductionMetrics : virtual public Debug {
22
23 public:
25
32 void execute(std::vector<std::vector<double>> const &input,
33 std::vector<std::vector<double>> const &latent);
34
35 struct Metrics {
36 double w0, w1, ta, lc, rmse, trust, cont, lcmc, mrreh, mrrel;
37 };
38 Metrics get() const {
39 return {w0_, w1_, ta_, lc_, rmse_, trust_, cont_, lcmc_, mrreh_, mrrel_};
40 }
41
42 protected:
44 double Wasserstein{2.};
45
48 int SampleSize{-1};
49
52 unsigned NeighborhoodSize{10};
53
56 double w0_{0.};
57
60 double w1_{0.};
61
65 double ta_{0.};
66
69 double lc_{0.};
70
73 double rmse_{0.};
74
77 double trust_{0.};
78
81 double cont_{0.};
82
85 double lcmc_{0.};
86
89 double mrreh_{0.};
90
92 double mrrel_{0.};
93
94 private:
95 unsigned n_;
96 unsigned dimHigh_;
97 unsigned dimLow_;
98 std::vector<double> inputCompressedDistanceMatrix_;
99 std::vector<double> latentCompressedDistanceMatrix_;
100
101 inline double inputDM(unsigned i, unsigned j) const {
102 if(i == j)
103 return 0.;
104 else
105 return inputCompressedDistanceMatrix_[std::max(i, j)
106 * (std::max(i, j) - 1) / 2
107 + std::min(i, j)];
108 }
109
110 inline double latentDM(unsigned i, unsigned j) const {
111 if(i == j)
112 return 0.;
113 else
114 return latentCompressedDistanceMatrix_[std::max(i, j)
115 * (std::max(i, j) - 1) / 2
116 + std::min(i, j)];
117 }
118
119 void computeTopologicalMetrics();
120 void computeTripletAccuracy();
121 void computePairwiseDistanceBasedMetrics();
122 void computeRankBasedMetrics();
123
124 bool tripletOrderPreserved(int i, int j, int k) const;
125
126 }; // DimensionReductionMetrics class
127
128} // namespace ttk
void execute(std::vector< std::vector< double > > const &input, std::vector< std::vector< double > > const &latent)
Main entry point.
TTK base package defining the standard types.