Esempio n. 1
0
 def calc_probability_hurdle_surpassing(self, party):
     seats = np.zeros(self.__sample_size)
     for idx in range(self.__sample_size):
         election_result = self.values.T[idx]
         election = Election(election_result,
                             drop_other_parties=self.__drop_other_parties)
         seats_by_party = election.calc_seats_by_party()
         seats[idx] = seats_by_party[party.idx]
     return np.count_nonzero(seats) / self.__sample_size
Esempio n. 2
0
 def calc_seats_by(self, coalition: Coalition):
     coalition_seats = np.zeros(self.__sample_size)
     for idx in range(self.__sample_size):
         election_result = self.values.T[idx]
         election = Election(election_result,
                             drop_other_parties=self.__drop_other_parties)
         seats_by_party = election.calc_seats_by_party()
         for party in coalition.parties:
             coalition_seats[idx] += seats_by_party[party.idx]
     return coalition_seats