24 #include "cheetah/rfim/Metrics.h" 32 Metrics::Metrics(TimeFrequencyFlagsType
const& expected, TimeFrequencyFlagsType
const& actual)
54 return (100.0*_correct_num)/_rfi_num;
60 return 100.0*((double)(_false_positives.data_size() - (_false_positives_num + _false_negatives_num))/_false_positives.data_size());
63 float Metrics::false_positives_percentage()
const 65 return (100.0*_false_positives_num)/_false_positives.data_size();
68 float Metrics::false_negatives_percentage()
const 70 return (100.0*_false_negatives_num)/_false_negatives.data_size();
75 return _false_positives;
80 return _false_positives_num;
85 return _false_negatives;
90 return _false_negatives_num;
95 _false_positives_num = 0;
96 _false_negatives_num = 0;
104 PANDA_LOG_DEBUG <<
"max_spectra=" << max_spectra <<
" max_channels=" << max_channels;
105 if(expected.data_size() != actual.data_size())
107 panda::Error e(
"unmatched flag size: samples(");
108 e << max_spectra <<
" vs " << min_samples;
109 e <<
") channels(" << max_channels <<
" vs " << min_channels;
112 _false_positives.resize(max_spectra, max_channels);
113 _false_negatives.resize(max_spectra, max_channels);
116 auto it = expected.begin();
117 auto actual_it = actual.begin();
118 auto fp_it = _false_positives.begin();
119 auto fn_it = _false_negatives.begin();
120 while(it != expected.end())
123 if(*it == *actual_it) {
126 if(*it) ++_correct_num;
132 ++_false_negatives_num;
136 ++_false_positives_num;
146 return _false_positives_num + _false_negatives_num;
float correct_percentage() const
return the total of any correct flags as a percentage
float rfi_detected_percentage() const
return the total of any correct flags as a percentage
TimeFrequencyFlagsType const & false_negatives() const
returnn a set of flags indicating each false negative found
std::size_t num_correct() const
return the total of any correctly identified flags found
Some limits and constants for FLDO.
std::size_t num_false_positives() const
return the total of any false positives detected
std::size_t compare(TimeFrequencyFlagsType const &expected, TimeFrequencyFlagsType const &actual)
calculate the metrics by comparing the two sets of flags
std::size_t number_of_spectra() const
std::size_t num_false_negatives() const
return the number of any false negatives detected
std::size_t number_of_channels() const
std::size_t num_rfi() const
return the number of rfi flags in the expected data
TimeFrequencyFlagsType const & false_positives() const
returnn a set of flags indicating each false positive fopund