Expand description
§score-set
A Rust library for building static weighted scoring operator sets.
It does not prescribe a unified input or context type. Instead it declares, stores, normalizes, and combines a set of weighted operators — scoring is done via a user-provided closure that can inject arbitrary runtime data.
§Quick example
ⓘ
use score_set::*;
let gc = metric("gc")
.measure().by(|dna: &&str| gc_ratio(dna))
.map01().by(|raw: &f64, _: &&str| Value01::witness(*raw).unwrap());
let len = metric("len")
.measure().by(|len: &usize| *len)
.map01().by(|raw: &usize, _: &usize| {
Value01::witness((*raw as f64 / 100.0).min(1.0)).unwrap()
});
let ms = score_set! {
2.0 => gc,
3.0 => len,
}?;
let dna = "ACGTACGT";
let score = ms.score().by(|(gc, len)| {
gc.contribute(gc.metric().eval(&dna))
+ len.contribute(len.metric().eval(&dna.len()))
});Macros§
- score_
set - Declare a set of
weight => metricpairs.
Structs§
- GtZero
- Witness credential for a value validated to be finite and strictly > 0.
- Member
- A member of a
MetricSet: a normalized weight paired with its metric. - Metric
- A scoring operator built via the
measure().by() → map01().by()pipeline. - Normalized
Container - Witness credential for a container validated as a complete set of
normalized weights (each in
[0, 1], sum to 1). - Normalized
Weight - Witness credential for a single normalized weight.
- Score
Set - A static weighted set of scoring operators with normalized weights.
- Score
Stage - The scoring stage, created by
ScoreSet::score. - Value01
- Witness credential for a value validated to be finite and in
[0, 1]. - Witnessed
Traits§
- Float
- Public trait bound for floating-point types used throughout
score-set. - Witness
Ext - Extension trait for starting a witnessing pipeline.
Functions§
- metric
- Entry point:
metric("name").