ModErn Text Analysis
META Enumerates Textual Applications
rank_correlation.h
Go to the documentation of this file.
1 
10 #ifndef META_INDEX_RANK_CORRELATION_H_
11 #define META_INDEX_RANK_CORRELATION_H_
12 
13 #include <cmath>
14 #include <cstdint>
15 #include <stdexcept>
16 #include <vector>
17 
18 namespace meta
19 {
20 namespace index
21 {
22 
26 class rank_correlation_exception : public std::runtime_error
27 {
28  public:
29  using std::runtime_error::runtime_error;
30 };
31 
43 {
44  public:
46 
59  rank_correlation(const std::vector<double>& x,
60  const std::vector<double>& y);
61 
73  double gamma() const;
74 
86  double tau_a() const;
87 
101  double tau_b() const;
102 
131  double ndpm() const;
132 
133  private:
134  double nc() const
135  {
136  return static_cast<double>(num_concordant_);
137  }
138 
139  double nd() const
140  {
141  return static_cast<double>(num_discordant_);
142  }
143 
144  uint64_t num_concordant_;
145  uint64_t num_discordant_;
146  uint64_t num_ties_x_;
147  uint64_t num_ties_y_;
148  uint64_t n_;
149 };
150 }
151 }
152 #endif
Evaluates two different lists of ranks for correlation with various measures.
Definition: rank_correlation.h:42
The ModErn Text Analysis toolkit is a suite of natural language processing, classification, information retrieval, data mining, and other applications of text processing.
Definition: analyzer.h:25
Exception thrown when interacting with rank_correlation instances.
Definition: rank_correlation.h:26