Author |
Topic: Comparison of fractions (Read 1364 times) |
|
howard roark
Full Member
Posts: 241
|
|
Comparison of fractions
« on: Nov 29th, 2008, 11:32pm » |
Quote Modify
|
You are supposed to compare two a/b and c/d. (a<=b and c<=d) Think of fractions in this way, numerator is the number of good reviews received for a movie and denominator is the total number of reviews received. However, do not compare the exact values of fractions. Ex:Though 6/7 is less than 1/1 our comparison function should return 6/7 as a greater fraction because 6 out of 7 rated the movie as a good one. I have a solution but I don't know if it is a good one: . Every fraction a/b is transformed to ab/(b-a) (for b!=a) and that value is compared . This gives importance to both the value of fraction and denominator also Can anyone think of other function to compare the fractions. Any help would be appreciated
|
« Last Edit: Nov 29th, 2008, 11:35pm by howard roark » |
IP Logged |
|
|
|
Grimbal
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 7527
|
|
Re: Comparison of fractions
« Reply #1 on: Nov 30th, 2008, 1:12pm » |
Quote Modify
|
It does not seem good at all. The fact that it doesn't give a reply for a=b should raise suspicion. 8/10 should be better than 30/100. But ab/(b-a) is 40 in the first case and 42 in the second. I would say that comparing the numerical value of the fraction is a good measure for comparison. Maybe if scores start at 1 (as worst score), then (a-1)/(b-1) could be a better measure. 2/3 and 3/5 would both mean the score in the middle and evaluate to 1/2. edit: that would be if we have one evaluation rated between 1 and 5 for instance.
|
« Last Edit: Nov 30th, 2008, 2:28pm by Grimbal » |
IP Logged |
|
|
|
howard roark
Full Member
Posts: 241
|
|
Re: Comparison of fractions
« Reply #2 on: Nov 30th, 2008, 1:18pm » |
Quote Modify
|
Quote:I would say that comparing the numerical value of the fraction is a good measure for comparison. |
| The problem with this approach is 1/1 will be given more weightage than 8/9 or something similar. That is the reason I want to give some importance to denominator also....That is the reason I came up with that solution ab/(b-a). This gives importance to numerator and denomiator(a*b) and also it wants difference between them to be minimum(b-a) ab/(b-a).... May be we can raise power of a in the numerator to solve the problem that occurs with the cases like 8/10 and 30/100.... Main point here is to give importance to denominator also
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Comparison of fractions
« Reply #3 on: Nov 30th, 2008, 1:18pm » |
Quote Modify
|
Maybe subtract the standard deviation from the mean (fraction) Of course that presumes that 2/4 is different (and better) than 1/2; 2 out of 4 positive votes is better than 1 out of 2 positive votes. At least if you're risk-averse. So we get a/b - (1-a/b) (a/(b-1)) [edit]Maybe a bit pessimistic, since it can give a score below 0, and b=1 is problematic. But the statistical approach is nice, imo.[/edit]
|
« Last Edit: Nov 30th, 2008, 1:24pm by towr » |
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
howard roark
Full Member
Posts: 241
|
|
Re: Comparison of fractions
« Reply #4 on: Nov 30th, 2008, 1:28pm » |
Quote Modify
|
@towr I can understand that this works by substituting numbers for a and b. Can you give an explanation why your approach works better than ordinary comparison of fractions' values?
|
|
IP Logged |
|
|
|
howard roark
Full Member
Posts: 241
|
|
Re: Comparison of fractions
« Reply #5 on: Nov 30th, 2008, 1:30pm » |
Quote Modify
|
@towr What is standard deviation and mean of a fraction?
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Comparison of fractions
« Reply #6 on: Nov 30th, 2008, 1:36pm » |
Quote Modify
|
on Nov 30th, 2008, 1:28pm, hoogle wrote:I can understand that this works by substituting numbers for a and b. Can you give an explanation why your approach works better than ordinary comparison of fractions' values? |
| I'm not certain it does work better. However, it has the advantage of meaning something; there is an interpretation to what you're doing. One problem however is that 1/1 and 2/2 still compare equal, while the latter (I feel) should rate higher. on Nov 30th, 2008, 1:30pm, hoogle wrote:What is standard deviation and mean of a fraction? |
| There isn't one. But if you consider the fraction as the result of sampling, where a/b means that you have a times the value of 1 and (b-a) times the value of 0; then you can just apply statistics. The mean then becomes [a*1+(b-a)*0]/[a+(b-a)]=a/b And the standard deviation is ( [a*(1-a/b)^2 +(b-a)*(0-a/b)^2]/[a+(b-a)-1]) = a/b - [(a-a2/b)/(b-1)] Which actually doesn't correspond to what I did before, so there's an error in my previous post.
|
« Last Edit: Nov 30th, 2008, 1:45pm by towr » |
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
howard roark
Full Member
Posts: 241
|
|
Re: Comparison of fractions
« Reply #7 on: Nov 30th, 2008, 1:43pm » |
Quote Modify
|
According to the formula 3/3 will have higher value than 2/2 because of the term sqrt(a/(b-1)). SO the formula seems to work well
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Comparison of fractions
« Reply #8 on: Nov 30th, 2008, 1:46pm » |
Quote Modify
|
on Nov 30th, 2008, 1:43pm, hoogle wrote:According to the formula 3/3 will have higher value than 2/2 because of the term sqrt(a/(b-1)). |
| No it won't because you multiply that term by 0.
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
howard roark
Full Member
Posts: 241
|
|
Re: Comparison of fractions
« Reply #9 on: Nov 30th, 2008, 1:47pm » |
Quote Modify
|
I dont quite understand why is the denominator, while calculating standard deviation,a+(b-a)-1 instead of a+(b-a)
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Comparison of fractions
« Reply #10 on: Nov 30th, 2008, 1:54pm » |
Quote Modify
|
on Nov 30th, 2008, 1:47pm, hoogle wrote:I dont quite understand why is the denominator, while calculating standard deviation,a+(b-a)-1 instead of a+(b-a) |
| To make it an unbiased estimator. Anyway, looking at how the function works out, it has very bad properties. It rates 1/(5+) higher that 1/4, to name one of the worse properties. You might be better off simply taking a/(b+1)
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
Grimbal
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 7527
|
|
Re: Comparison of fractions
« Reply #11 on: Nov 30th, 2008, 2:38pm » |
Quote Modify
|
What about (a+1)/(b+2)? It gives 0.5 for 0 reviews, makes 0/n decrease with n and n/n increase with n.
|
« Last Edit: Nov 30th, 2008, 2:40pm by Grimbal » |
IP Logged |
|
|
|
Eigenray
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 1948
|
|
Re: Comparison of fractions
« Reply #12 on: Nov 30th, 2008, 5:12pm » |
Quote Modify
|
on Nov 30th, 2008, 2:38pm, Grimbal wrote:What about (a+1)/(b+2)? It gives 0.5 for 0 reviews, makes 0/n decrease with n and n/n increase with n. |
| I was going to suggest the following: think of a/b as representing a occurrences out of b trials of an event with probability p. If p has a uniform [0,1] prior distribution, then the posterior distribution of p has density P(p=x | a/b) = (b+1) C(b,a) * xa(1-x)b-a, and then take the expected value E(p | a/b). But I see you've beaten me to it
|
« Last Edit: Nov 30th, 2008, 5:14pm by Eigenray » |
IP Logged |
|
|
|
howard roark
Full Member
Posts: 241
|
|
Re: Comparison of fractions
« Reply #13 on: Nov 30th, 2008, 10:16pm » |
Quote Modify
|
What is the difference between a/(b+1) and (a+1)/b+2)......... So can we generalize it to (a+i)/(b+i), where i>=1 Choosing i is dependent on how much do you want to stress on denominator? Any more comments on this
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: Comparison of fractions
« Reply #14 on: Dec 1st, 2008, 12:30am » |
Quote Modify
|
on Nov 30th, 2008, 10:16pm, hoogle wrote:What is the difference between a/(b+1) and (a+1)/b+2)......... |
| Well, for one thing, n/(2n) stays 1/2. And a/b remains equal to 1-(b-a)/b.
|
|
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
Grimbal
wu::riddles Moderator Uberpuzzler
Gender:
Posts: 7527
|
|
Re: Comparison of fractions
« Reply #15 on: Dec 1st, 2008, 12:33am » |
Quote Modify
|
on Nov 30th, 2008, 10:16pm, hoogle wrote:What is the difference between a/(b+1) and (a+1)/b+2)......... |
| It makes a difference especially when a=0. 0/1 is not as bad as 0/10. With a/(b+1) it doesn't show a difference. With (a+1)/(b+2), it does.
|
|
IP Logged |
|
|
|
rmsgrey
Uberpuzzler
Gender:
Posts: 2873
|
|
Re: Comparison of fractions
« Reply #16 on: Dec 1st, 2008, 10:21am » |
Quote Modify
|
But is 15/20 any better or worse than 3/4 ? Both are 75%, and, while 3/4 could be as low as 5/8 (or 25/40), while 15/20 only goes down to 29/40, but 3/4 also goes up to 7/8 (35/40), while 15/20 only goes up to 31/40. It's only with 0/n or n/n that higher n is obviously better - the ranges are bounded by 0 and 1.
|
|
IP Logged |
|
|
|
|