Ratings table over named alternatives for one (wrt node, dest cluster).
More...
#include <ratings.hpp>
|
| enum class | Mode |
| | How alternative ratings are stored.
|
| |
|
|
| RatingsPrioritizer ()=default |
| | Default-constructs an empty numeric ratings table.
|
| |
| | RatingsPrioritizer (std::vector< std::string > alternatives) |
| | Constructs a table with the given alternative names.
|
| |
| std::size_t | size () const noexcept |
| |
| bool | empty () const noexcept |
| |
| const std::vector< std::string > & | alternatives () const noexcept |
| |
| bool | has_alternative (const std::string &name) const |
| |
| std::size_t | index_of (const std::string &name) const |
| |
| void | add_alternative (const std::string &name, bool ignore_existing=false) |
| | Appends an alternative with a missing rating.
|
| |
| void | remove_alternative (const std::string &name, bool ignore_missing=false) |
| | Removes an alternative and its rating.
|
| |
| Mode | mode () const noexcept |
| |
|
void | set_mode (Mode mode) |
| | Sets storage mode (does not clear the other mode's data).
|
| |
| const std::vector< RatingCategory > & | categories () const noexcept |
| |
| void | set_categories (std::vector< RatingCategory > categories) |
| | Replaces the category list.
|
| |
| const ScoreInterpreter & | interpreter () const noexcept |
| |
|
void | set_interpreter (ScoreInterpreter interpreter) |
| | Sets the numeric score interpreter.
|
| |
| void | set_rating (const std::string &alt, const std::string &category_id) |
| | Sets a categorical rating for alt.
|
| |
|
void | clear_rating (const std::string &alt) |
| | Clears the categorical rating for alt.
|
| |
| std::optional< std::string > | rating (const std::string &alt) const |
| |
| void | set_value (const std::string &alt, double raw) |
| | Sets a numeric raw value for alt.
|
| |
|
void | clear_value (const std::string &alt) |
| | Clears the numeric value for alt.
|
| |
| std::optional< double > | value (const std::string &alt) const |
| |
| Vector | scores () const |
| | Intensity scores in [0, 1] (missing → 0).
|
| |
| Vector | priorities () const |
| | L1-normalized priorities over present (non-missing) scores.
|
| |
Ratings table over named alternatives for one (wrt node, dest cluster).
Produces intensity scores and L1-normalized priorities for the unscaled supermatrix column (same contract as pairwise priorities).
◆ RatingsPrioritizer()
| anpcpp::RatingsPrioritizer::RatingsPrioritizer |
( |
std::vector< std::string > |
alternatives | ) |
|
|
explicit |
Constructs a table with the given alternative names.
- Parameters
-
| alternatives | Ordered alternative names. |
◆ add_alternative()
| void anpcpp::RatingsPrioritizer::add_alternative |
( |
const std::string & |
name, |
|
|
bool |
ignore_existing = false |
|
) |
| |
Appends an alternative with a missing rating.
- Parameters
-
| name | Alternative name to append. |
| ignore_existing | If true, no-op when already present; else throws. |
◆ alternatives()
| const std::vector< std::string > & anpcpp::RatingsPrioritizer::alternatives |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- Ordered alternative names.
◆ categories()
| const std::vector< RatingCategory > & anpcpp::RatingsPrioritizer::categories |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- Category definitions (categorical mode).
◆ empty()
| bool anpcpp::RatingsPrioritizer::empty |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- True if there are no alternatives.
◆ has_alternative()
| bool anpcpp::RatingsPrioritizer::has_alternative |
( |
const std::string & |
name | ) |
const |
- Returns
- True if
name is in the alternative list.
◆ index_of()
| std::size_t anpcpp::RatingsPrioritizer::index_of |
( |
const std::string & |
name | ) |
const |
- Returns
- Index of
name.
- Exceptions
-
| std::invalid_argument | if not found. |
◆ interpreter()
- Returns
- Score interpreter (numeric mode).
◆ mode()
| Mode anpcpp::RatingsPrioritizer::mode |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- Current storage mode.
◆ priorities()
| Vector anpcpp::RatingsPrioritizer::priorities |
( |
| ) |
const |
L1-normalized priorities over present (non-missing) scores.
Missing alternatives contribute 0. Empty / all-missing → zero vector.
◆ rating()
| std::optional< std::string > anpcpp::RatingsPrioritizer::rating |
( |
const std::string & |
alt | ) |
const |
- Returns
- Category id for
alt, if set.
◆ remove_alternative()
| void anpcpp::RatingsPrioritizer::remove_alternative |
( |
const std::string & |
name, |
|
|
bool |
ignore_missing = false |
|
) |
| |
Removes an alternative and its rating.
- Parameters
-
| name | Alternative name to remove. |
| ignore_missing | If true, no-op when absent; else throws. |
◆ scores()
| Vector anpcpp::RatingsPrioritizer::scores |
( |
| ) |
const |
Intensity scores in [0, 1] (missing → 0).
Categorical: category values. Numeric: interpreter applied to raw values.
◆ set_categories()
| void anpcpp::RatingsPrioritizer::set_categories |
( |
std::vector< RatingCategory > |
categories | ) |
|
Replaces the category list.
- Exceptions
-
| std::invalid_argument | if any value is outside [0, 1] or ids clash. |
◆ set_rating()
| void anpcpp::RatingsPrioritizer::set_rating |
( |
const std::string & |
alt, |
|
|
const std::string & |
category_id |
|
) |
| |
Sets a categorical rating for alt.
- Parameters
-
| alt | Alternative name. |
| category_id | Must match a category id, or empty to clear. |
- Exceptions
-
| std::invalid_argument | if alt or category id is unknown. |
◆ set_value()
| void anpcpp::RatingsPrioritizer::set_value |
( |
const std::string & |
alt, |
|
|
double |
raw |
|
) |
| |
Sets a numeric raw value for alt.
- Exceptions
-
| std::invalid_argument | if alt is unknown. |
◆ size()
| std::size_t anpcpp::RatingsPrioritizer::size |
( |
| ) |
const |
|
inlinenoexcept |
- Returns
- Number of alternatives.
◆ value()
| std::optional< double > anpcpp::RatingsPrioritizer::value |
( |
const std::string & |
alt | ) |
const |
- Returns
- Raw numeric value for
alt, if set.
The documentation for this class was generated from the following file: