ApprovalElection#

class ApprovalElection(experiment_id=None, election_id=None, culture_id=None, num_candidates=None, fast_import=False, params=None, **kwargs)[source]#

Approval Election class.

compute_distances(object_type: str | None = None, distance_id: str = 'hamming') ndarray[source]#

Computes distances between the votes or candidates.

compute_reverse_approvals() None[source]#

Computes reverse approvals: for each candidate, the set of voters who approve them.

get_reverse_approvals() List[Set[int]][source]#

Returns the reverse approvals, computing them if necessary.

import_approval_election() None[source]#

Imports approval elections from a file.

prepare_instance(is_exported: bool = False, is_aggregated: bool = True) None[source]#

Prepares all the instances within the experiment.

set_microscope(radius: float | None = None, alpha: float = 0.1, s=30, object_type: str | None = None, double_gradient: bool = False, color: str = 'blue', marker: str = 'o', annotate: bool = False) Microscope[source]#

Print a map of the election (i.e., microscope) using matplotlib’s OO API.

votes_to_approvalwise_vector() None[source]#

Converts votes to an approval-wise frequency vector (fraction of voters approving each candidate). The resulting vector is sorted (ascending) to match prior behavior.