pulsatrix 1.1.0
Loading...
Searching...
No Matches
fitness_metrics.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <vector>
9
10namespace pulsatrix {
11
14[[nodiscard]] double SpearmanCorrelation(const std::vector<double>& x, const std::vector<double>& y);
15
18[[nodiscard]] double RocAuc(const std::vector<int>& labels, const std::vector<double>& scores);
19
22[[nodiscard]] double MatthewsCorrelation(const std::vector<int>& labels, const std::vector<int>& predicted);
23
25[[nodiscard]] double MedianSplitMcc(const std::vector<int>& labels, const std::vector<double>& scores);
26
34[[nodiscard]] double Ndcg(const std::vector<double>& true_scores, const std::vector<double>& predicted, double top_percent = 10.0);
35
39[[nodiscard]] double TopRecall(const std::vector<double>& true_scores, const std::vector<double>& predicted, double top_true = 10.0,
40 double top_model = 10.0);
41
43[[nodiscard]] double Percentile(std::vector<double> values, double q);
44
47 double spearman = 0;
48 double auc = 0;
49 double mcc = 0;
50 double ndcg = 0;
51 double top_recall = 0;
52};
53
55[[nodiscard]] FitnessMetrics EvaluateFitness(const std::vector<double>& dms_scores, const std::vector<int>& dms_bins,
56 const std::vector<double>& predicted);
57
58} // namespace pulsatrix
Definition acquisition_functions.hpp:16
double Ndcg(const std::vector< double > &true_scores, const std::vector< double > &predicted, double top_percent=10.0)
ProteinGym's NDCG: gains are the true scores min-max scaled to [0, 1]; the variants the model ranks i...
double MedianSplitMcc(const std::vector< int > &labels, const std::vector< double > &scores)
ProteinGym's MCC: scores at or above their median predict 1.
double MatthewsCorrelation(const std::vector< int > &labels, const std::vector< int > &predicted)
Matthews correlation of binary labels and predicted (sklearn's matthews_corrcoef); 0 when a row or co...
FitnessMetrics EvaluateFitness(const std::vector< double > &dms_scores, const std::vector< int > &dms_bins, const std::vector< double > &predicted)
FitnessMetrics for one assay: measured scores and their binarized labels, and predictions.
double SpearmanCorrelation(const std::vector< double > &x, const std::vector< double > &y)
Spearman's rank correlation, ties given their average rank (scipy's spearmanr). NaN if either input i...
double TopRecall(const std::vector< double > &true_scores, const std::vector< double > &predicted, double top_true=10.0, double top_model=10.0)
ProteinGym's top recall: of the variants at or above the true scores' (100 - top) percentile,...
double RocAuc(const std::vector< int > &labels, const std::vector< double > &scores)
Area under the ROC curve of scores for labels (0 or 1), ties counted half (sklearn's roc_auc_score)....
double Percentile(std::vector< double > values, double q)
The q-th percentile (0 to 100) with linear interpolation (numpy's default).
All five, as ProteinGym reports them.
Definition fitness_metrics.hpp:46
double ndcg
Definition fitness_metrics.hpp:50
double mcc
Definition fitness_metrics.hpp:49
double spearman
Definition fitness_metrics.hpp:47
double auc
Definition fitness_metrics.hpp:48
double top_recall
Definition fitness_metrics.hpp:51