Voting Problems and Computer Science Applications Fred Roberts, Rutgers University 1 What do Mathematics and Computer Science have to do with Voting? 2 Have you used Google lately? 3 4 Have you used Google lately? Did you know that Google has something to do with voting? 5 Have you tried buying a book on online lately? 6 7 8 Have you tried buying a book on online lately? Did you get a message saying: If you are interested in this book, you might want to look at the following books as well? Did you know that has something to do with voting? 9 Have you ever heard of v-sis? 10 Have you ever heard of v-sis? •It’s a cancer-causing gene. Cancer cell •Computer scientists helped discover how it works? •How did they do it? •The answer also has something to do with voting. 11 •Some connections between Computer Science and Voting are clearly visible. •Some people are working on plans to allow us to vote from home – over the Internet. 12 Electronic Voting Security Risks in Electronic Voting • Could someone put on a “denial of service attack?” • That is, could someone flood your computer and those of other likely voters with so much spam that you couldn’t succeed in voting? 13 Electronic Voting Security Risks in Electronic Voting • How can we prevent random loss of connectivity that would prevent you from voting? • How can your vote be kept private? • How can you be sure your vote is counted? • What will prevent you from selling your vote to someone else? 14 Electronic Voting Security Risks in Electronic Voting • These are all issues in modern computer science research. • However, they are not what I want to talk about. • I want to talk about how ideas about voting systems can solve problems of computer science. 15 How do Elections Work? • Typically, everyone votes for their first choice candidate. • The votes are counted. • The person with the most votes wins. • Or, sometimes, if no one has more than half the votes, there is a runoff. 16 But do we necessarily get the best candidate that way? 17 Sometimes Having More Information about Voters’ Preferences is Very Helpful •Sometimes it is helpful to have voters rank order all the candidates •From their top choice to their bottom choice. 18 Rankings Dennis Kucinich Bill Richardson John Edwards Ties are allowed Barack Obama Hillary Clinton 19 Rankings • What if we have four voters and they give us the following rankings? Who should win? Voter 1 Clinton Richardson Edwards Kucinich Obama Voter 2 Voter 3 Voter 4 Clinton Obama Obama Kucinich Edwards Richardson Edwards Richardson Kucinich Richardson Kucinich Edwards Obama Clinton Clinton 20 Rankings • What if we have four voters and they give us the following rankings? • There is one added candidate. • Who should win? Voter 1 Clinton Gore Richardson Edwards Kucinich Obama Voter 2 Voter 3 Voter 4 Clinton Obama Obama Gore Gore Gore Kucinich Edwards Richardson Edwards Richardson Kucinich Richardson Kucinich Edwards Obama Clinton Clinton 21 Rankings Voter 1 Clinton Gore Richardson Edwards Kucinich Obama Voter 2 Voter 3 Voter 4 Clinton Obama Obama Gore Gore Gore Kucinich Edwards Richardson Edwards Richardson Kucinich Richardson Kucinich Edwards Obama Clinton Clinton Maybe someone who is everyone’s second choice is the best choice for winner. Point: We can learn something from ranking candidates. 22 Consensus Rankings •How should we reach a decision in an election if every voter ranks the candidates? •What decision do we want? − A winner − A ranking of all the candidates that is in some sense a consensus ranking •This would be useful in some applications • Job candidates are ranked by each interviewer • Consensus ranking of candidates • Make offers in order of ranking •How do we find a consensus ranking? 23 Consensus Rankings These two rankings are very close: Clinton Obama Edwards Kucinich Richardson Obama Clinton Edwards Kucinich Richardson 24 Consensus Rankings These two rankings are very far apart: Clinton Richardson Edwards Kucinich Obama Obama Kucinich Edwards Richardson Clinton 25 Consensus Rankings •This suggests we may be able to make precise how far apart two rankings are. •How do we measure the distance between two rankings? 26 Consensus Rankings • Kemeny-Snell distance between rankings: twice the number of pairs of candidates i and j for which i is ranked above j in one ranking and below j in the other + the number of pairs that are ranked in one ranking and tied in another. a b x y-z y x z On {x,y}: +2 On {x,z}: +2 On {y,z}: +1 d(a,b) = 5. 27 Consensus Rankings • One well-known consensus method: “Kemeny-Snell medians”: Given set of rankings, find ranking minimizing sum of distances to other rankings. • Kemeny-Snell medians are having surprising new applications in CS. John Kemeny, pioneer in time sharing in CS 28 Consensus Rankings • Kemeny-Snell median: Given rankings a1, a2, …, ap, find a ranking x so that d(a1,x) + d(a2,x) + … + d(ap,x) is as small as possible. • x can be a ranking other than a1, a2, …, ap. • Sometimes just called Kemeny median. 29 Consensus Rankings a1 Fish Chicken Beef a2 Fish Chicken Beef a3 Chicken Fish Beef • Median = a1. • If x = a1: d(a1,x) + d(a2,x) + d(a3,x) = 0 + 0 + 2 = 2 is minimized. • If x = a3, the sum is 4. • For any other x, the sum is at least 1 + 1 + 1 = 3. 30 Consensus Rankings a1 Fish Chicken Beef a2 Chicken Beef Fish a3 Beef Fish Chicken • Three medians = a1, a2, a3. • This is the “voter’s paradox” situation. 31 Consensus Rankings a1 Fish Chicken Beef a2 Chicken Beef Fish a3 Beef Fish Chicken • Note that sometimes we wish to minimize d(a1,x)2 + d(a2,x)2 + … + d(ap,x)2 • A ranking x that minimizes this is called a Kemeny-Snell mean. • In this example, there is one mean: the ranking declaring all three alternatives tied. 32 Consensus Rankings a1 Fish Chicken Beef a2 Chicken Beef Fish a3 Beef Fish Chicken • If x is the ranking declaring Fish, Chicken and Beef tied, then d(a1,x)2 + d(a2,x)2 + … + d(ap,x)2 = 32 + 32 + 32 = 27. • Not hard to show this is minimum. 33 Consensus Rankings Theorem (Bartholdi, Tovey, and Trick, 1989; Wakabayashi, 1986): Computing the KemenySnell median of a set of rankings is an NPcomplete problem. 34 Consensus Rankings Okay, so what does this have to do with practical computer science questions? 35 Consensus Rankings I mean really practical computer science questions. 36 37 Google Example • Google is a “search engine” • It searches through web pages and rank orders them. • That is, it gives us a ranking of web pages from most relevant to our query to least relevant. 38 Meta-search • There are other search engines besides Google. • Wouldn’t it be helpful to use several of them and combine the results? • This is meta-search. • It is a voting problem • Combine page rankings from several search engines to produce one consensus ranking • Dwork, Kumar, Naor, Sivakumar (2000): KemenySnell medians good in spam resistance in meta-search (spam by a page if it causes meta-search to rank it too highly) • Approximation methods make this computationally 39 tractable 40 Collaborative Filtering • Recommending books or movies • Combine book or movie ratings by various people • This too is voting • Produce a consensus ordered list of books or movies to recommend • Freund, Iyer, Schapire, Singer (2003): “Boosting” algorithm for combining rankings. • Related topic: Recommender Systems 41 Meta-search and Collaborative Filtering A major difference from the election situation • In elections, the number of voters is large, number of candidates is small. • In CS applications, number of voters (search engines) is small, number of candidates (pages) is large. • This makes for major new complications and research challenges. 42 Have you ever heard of v-sis? •It’s a cancer-causing gene. •Computer scientists helped discover how it works? •How did they do it? •The answer also has something to do with voting. 43 Large Databases and Inference • Decision makers consult massive data sets. • The study of large databases and gathering of information from them is a major topic in modern computer science. • We will give an example from the field of Bioinformatics. • This lies at the interface between Computer Science and Molecular Biology 44 Large Databases and Inference • Real biological data often in form of sequences. • GenBank has over 7 million sequences comprising 8.6 billion “bases.” • The search for similarity or patterns has extended from pairs of sequences to finding patterns that appear in common in a large number of sequences or throughout the database: “consensus sequences” • Emerging field of “Bioconsensus”: applies consensus methods to biological databases. 45 Large Databases and Inference Why look for such patterns? Similarities between sequences or parts of sequences lead to the discovery of shared phenomena. For example, it was discovered that the sequence for platelet derived factor, which causes growth in the body, is 87% identical to the sequence for v-sis, that cancer-causing gene. This led to the discovery that v-sis works by stimulating growth. 46 Large Databases and Inference DNA Sequences A DNA sequence is a sequence of “bases”: A = Adenine, G = Guanine, C = Cytosine, T = Thymine Example: ACTCCCTATAATGCGCCA 47 Large Databases and Inference Example Bacterial Promoter Sequences studied by Waterman (1989): RRNABP1: TNAA: UVRBP2: SFC: ACTCCCTATAATGCGCCA GAGTGTAATAATGTAGCC TTATCCAGTATAATTTGT AAGCGGTGTTATAATGCC Notice that if we are looking for patterns of length 4, each sequence has the pattern TAAT. 48 Large Databases and Inference Example Bacterial Promoter Sequences studied by Waterman (1989): RRNABP1: TNAA: UVRBP2: SFC: ACTCCCTATAATGCGCCA GAGTGTAATAATGTAGCC TTATCCAGTATAATTTGT AAGCGGTGTTATAATGCC Notice that if we are looking for patterns of length 4, each sequence has the pattern TAAT. 49 Large Databases and Inference Example However, suppose that we add another sequence: M1 RNA: AACCCTCTATACTGCGCG The pattern TAAT does not appear here. However, it almost appears, since the pattern TACT appears, and this has only one mismatch from the pattern TAAT. 50 Large Databases and Inference Example However, suppose that we add another sequence: M1 RNA: AACCCTCTATACTGCGCG The pattern TAAT does not appear here. However, it almost appears, since the pattern TACT appears, and this has only one mismatch from the pattern TAAT. So, in some sense, the pattern TAAT is a good consensus pattern. 51 Large Databases and Inference Example We make this precise using best mismatch distance. Consider two sequences a and b with b longer than a. Then d(a,b) is the smallest number of mismatches in all possible alignments of a as a consecutive subsequence of b. 52 Large Databases and Inference Example a = 0011, b = 111010 Possible Alignments: 111010 111010 111010 0011 0011 0011 The best-mismatch distance is 2, which is achieved in the third alignment. 53 Large Databases and Inference Smith-Waterman Method from Bioinformatics •Let S be a finite alphabet of size at least 2 and be a finite collection of sequences of length L with entries from S. •Let F() be the set of sequences of length k 2 that are our consensus patterns. (Assume L k.) •Let = {a1, a2, …, an}. •One way to define F() is as follows. •Let d(a,b) be the best-mismatch distance. •Then let F() consist of all those sequences x for which the sum of the distances to elements of is as small as possible. •That is, find x so that d(a1,x) + d(a2,x) + … + d(an,x) is as small as possible. 54 Large Databases and Inference •We call such an F a Smith-Waterman consensus. •(This is a special case of a more general Smith-Waterman consensus method.) •Notice that this consensus is the same as the consensus we used in voting. Example: •An alphabet used frequently is the purine/pyrimidine alphabet {R,Y}, where R = A (adenine) or G (guanine) and Y = C (cytosine) or T (thymine). •For simplicity, it is easier to use the digits 0,1 rather than the letters R,Y. •Thus, let S = {0,1}, let k = 2. Then the possible pattern 55 sequences are 00, 01, 10, 11. Large Databases and Inference •Suppose a1 = 111010, a2 = 111111. How do we find F(a1,a2)? •We have: d(a1,00) = 1, d(a2,00) = 2 d(a1,01) = 0, d(a2,01) = 1 d(a1,10) = 0, d(a2,10) = 1 d(a1,11) = 0, d(a2,11) = 0 •It follows that 11 is the consensus pattern, according to Smith-Waterman’s consensus. 56 Example: •Let S ={0,1}, k = 3, and consider F(a1,a2,a3) where a1 = 000000, a2 = 100000, a3 = 111110. Possible pattern sequences are: 000, 001, 010, 011, 100, 101, 110, 111. d(a1,000) = 0, d(a2,000) = 0, d(a3,000) = 2, d(a1,001) = 1, d(a2,001) = 1, d(a3,001) = 2, d(a1,100) = 1, d(a2,100) = 0, d(a3,100) = 1, etc. •The sum of distances from 000 is smaller than the sum of distances from 001 and the same as the sum of distances from 100. So, 001 is not a consensus. •It is easy to check that 000 and 100 minimize the sum of distances. •Thus, these are the two “Smith-Waterman” consensus 57 sequences. Large Databases and Inference Other Topics in “Bioconsensus” • Alternative phylogenies (evolutionary trees) are produced using different methods and we need to choose a consensus tree. • Alternative taxonomies (classifications) are produced using different models and we need to choose a consensus taxonomy. • Alternative molecular sequences are produced using different criteria or different algorithms and we need to choose a consensus sequence. • Alternative sequence alignments are produced and we need to choose a consensus alignment. 58 Large Databases and Inference Other Topics in “Bioconsensus” • Several recent books on bioconsensus. • Day and McMorris [2003] • Janowitz, et al. [2003] • Bibliography compiled by Bill Day: In molecular biology alone, hundreds of papers using consensus methods in biology. • Large database problems in CS are being approached using methods of “bioconsensus” having their origin in the theory of voting and elections. 59 Software & Hardware Measurement • A statement involving scales of measurement is considered meaningful if its truth or falsity is unchanged under acceptable transformations of all scales involved. • Example: It is meaningful to say that I weigh more than my daughter. • That is because if it is true in kilograms, then it is also true in pounds, in grams, etc. • Even meaningful to say I weigh twice as much as my daughter. • Not meaningful to say the temperature today is twice as much as it was yesterday. • Could be true in Fahrenheit, false in Centigrade. 60 Software & Hardware Measurement • Measurement theory has studied what statements you can make after averaging scores. • Think of averaging as a consensus method. • One general principle: To say that the average score of one set of tests is greater than the average score of another set of tests is not meaningful (it is meaningless) under certain conditions. • This is often the case if the averaging procedure is to take the arithmetic mean: If s(xi) is score of xi, i = 1, 2, …, n, then arithmetic mean is is(xi)/n = [s(x1) + s(x2) + … + s(xn)]/n • Long literature on what averaging methods lead to meaningful conclusions. 61 Software & Hardware Measurement A widely used method in hardware measurement: Score a computer system on different benchmarks. Normalize score relative to performance of one base system Average normalized scores Pick system with highest average. Fleming and Wallace (1986): Outcome can depend on choice of base system. Meaningless in sense of measurement theory Leads to theory of merging normalized scores 62 Software & Hardware Measurement Hardware Measurement P R R O C M E S S O Z R E 417 BENCHMARK F G H 83 66 39,449 I 772 244 70 153 33,527 368 134 70 135 66,000 369 63 Data from Heath, Comput. Archit. News (1984) Software & Hardware Measurement Normalize Relative to Processor R P R R O C M E S S O Z R E 417 1.00 BENCHMARK F G H I 83 66 39,449 772 1.00 1.00 1.00 1.00 244 .59 70 .84 153 2.32 33,527 .85 368 .48 134 .32 70 .85 135 2.05 66,000 1.67 369 .45 64 Software & Hardware Measurement Take Arithmetic Mean of Normalized Scores P R R O C M E S S O Z R E 417 1.00 Arithmetic BENCHMARK Mean F G H I 83 66 39,449 772 1.00 1.00 1.00 1.00 1.00 244 .59 70 .84 153 2.32 33,527 .85 368 .48 1.01 134 .32 70 .85 135 2.05 66,000 1.67 369 .45 1.07 65 Software & Hardware Measurement Take Arithmetic Mean of Normalized Scores P R R O C M E S S O Z R E 417 1.00 Arithmetic BENCHMARK Mean F G H I 83 66 39,449 772 1.00 1.00 1.00 1.00 1.00 244 .59 70 .84 153 2.32 33,527 .85 368 .48 1.01 134 .32 70 .85 135 2.05 66,000 1.67 369 .45 1.07 Conclude that processor Z is best 66 Software & Hardware Measurement Now Normalize Relative to Processor M P R R O C M E S S O Z R E 417 1.71 BENCHMARK F G H I 83 66 39,449 772 1.19 .43 1.18 2.10 244 1.00 70 1.00 153 1.00 33,527 368 1.00 1.00 134 .55 70 1.00 135 .88 66,000 369 1.97 1.00 67 Software & Hardware Measurement Take Arithmetic Mean of Normalized Scores P R R O C M E S S O Z R E 417 1.71 Arithmetic BENCHMARK Mean F G H I 83 66 39,449 772 1.32 1.19 .43 1.18 2.10 244 1.00 70 1.00 153 1.00 33,527 368 1.00 1.00 1.00 134 .55 70 1.00 135 .88 66,000 369 1.97 1.00 1.08 68 Software & Hardware Measurement Take Arithmetic Mean of Normalized Scores P R R O C M E S S O Z R E 417 1.71 Arithmetic BENCHMARK Mean F G H I 83 66 39,449 772 1.32 1.19 .43 1.18 2.10 244 1.00 70 1.00 153 1.00 33,527 368 1.00 1.00 1.00 134 .55 70 1.00 135 .88 66,000 369 1.97 1.00 1.08 69 Conclude that processor R is best Software and Hardware Measurement • So, the conclusion that a given machine is best by taking arithmetic mean of normalized scores is meaningless in this case. • Above example from Fleming and Wallace (1986), data from Heath (1984) • Sometimes, geometric mean is helpful. • Geometric mean is n is(xi) 70 Software & Hardware Measurement Normalize Relative to Processor R P R R O C M E S S O Z R E 417 1.00 Geometric BENCHMARK Mean F G H I 83 66 39,449 772 1.00 1.00 1.00 1.00 1.00 244 .59 70 .84 153 2.32 33,527 .85 368 .48 .86 134 .32 70 .85 135 2.05 66,000 1.67 369 .45 .84 Conclude that processor R is best 71 Software & Hardware Measurement Now Normalize Relative to Processor M P R R O C M E S S O Z R E 417 1.71 Geometric BENCHMARK Mean F G H I 83 66 39,449 772 1.17 1.19 .43 1.18 2.10 244 1.00 70 1.00 153 1.00 33,527 368 1.00 1.00 1.00 134 .55 70 1.00 135 .88 66,000 369 1.97 1.00 .99 Still conclude that processor R is best 72 Software and Hardware Measurement • In this situation, it is easy to show that the conclusion that a given machine has highest geometric mean normalized score is a meaningful conclusion. • Even meaningful: A given machine has geometric mean normalized score 20% higher than another machine. • Fleming and Wallace give general conditions under which comparing geometric means of normalized scores is meaningful. • Research area: what averaging procedures make sense in what situations? Large literature. • Note: There are situations where comparing arithmetic means is meaningful but comparing geometric means is 73 not. Software and Hardware Measurement • Message from measurement theory to computer science (and DM): Do not perform arithmetic operations on data without paying attention to whether the conclusions you get are meaningful. 74 Concluding Comment • In recent years, interplay between computer science/mathematics and biology has transformed major parts of biology into an information science. • Led to major scientific breakthroughs in biology such as sequencing of human genome. • Led to significant new developments in CS, such as database search. • The interplay between CS and methods of the social sciences such as the theory of voting and elections is not nearly as far along. 75 Concluding Comment • However, the interplay between computer science/mathematics and the social sciences has already developed a unique momentum of its own. • One can expect many more exciting outcomes as partnerships between computer scientists/ mathematicians and social scientists expand and mature. 76 77