pub struct RankAggregation;Expand description
Rank aggregation methods producing a single consensus ranking.
Implementations§
Source§impl RankAggregation
impl RankAggregation
Sourcepub fn borda_count(rankings: &[Vec<usize>]) -> SklResult<Vec<usize>>
pub fn borda_count(rankings: &[Vec<usize>]) -> SklResult<Vec<usize>>
Borda count rank aggregation.
Each ranking awards n - rank points to the item at a given position
(the best item, at rank 0, receives n points; the worst receives 1).
Points are summed across all rankings and the consensus ranking lists items
in order of decreasing total score. Ties are broken by smaller item index so
the output is deterministic.
Every ranking must be a permutation of {0, ..., n-1} for the same n.
Sourcepub fn kemeny_optimal(rankings: &[Vec<usize>]) -> SklResult<Vec<usize>>
pub fn kemeny_optimal(rankings: &[Vec<usize>]) -> SklResult<Vec<usize>>
Kemeny-optimal rank aggregation.
Returns the consensus ranking that minimises the total Kendall-tau distance
(number of pairwise disagreements) to the input rankings. For n <= 8 the
optimum is found exactly by enumerating all n! permutations. For larger
n an exhaustive search is intractable, so a documented local-search
heuristic is used instead: starting from the Borda consensus, adjacent items
are repeatedly swapped whenever the swap strictly reduces the total
Kendall-tau cost, until no improving adjacent swap remains (a local Kemeny
optimum). The result is therefore exact for small n and an approximation
for large n.
Trait Implementations§
Source§impl Clone for RankAggregation
impl Clone for RankAggregation
Auto Trait Implementations§
impl Freeze for RankAggregation
impl RefUnwindSafe for RankAggregation
impl Send for RankAggregation
impl Sync for RankAggregation
impl Unpin for RankAggregation
impl UnsafeUnpin for RankAggregation
impl UnwindSafe for RankAggregation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.