1
$\begingroup$

I have a probability question (if it is too basic, my apologies since I am learning), I can not get my head around.

Suppose I concatenate the sentences from many books and shuffle the sentences (so we do not know the book that a sentence is from) to have a "sentence database". We assume there is no duplicated sentences, and we knew the books are written by two different writers. Now, given a phrase (sequence of words), we can find this phrase at 4 sentences in our database. And we are also given that for these 4 sentences:

sentence 1 has 20% probability is written by writer 1

sentence 2 has 60% probability is written by writer 1

sentence 3 has 50% probability is written by writer 2

sentence 4 has 40% probability is written by writer 2

The question is what is the probability of the given phrase is written by writer 1 and or writer 2?

My calculation is for the probability that the phrase is written by writer 1:

$$\frac{20\% + 60\%}{20\% + 60\% + 50\% + 40\%} = 0.470588235$$

and for writer 2:

$$1 - 0.470588235 = 0.529411765$$

My intuition tells me I am doing it wrong. But i do not where is wrong, could you please point it out.

Edit:

I thought this question is similar with calculating the probability of a outcome when flipping a coin.

So if I flip a coin 4 times, with outputs H T T H, then the probability of H is 1/2. So the formula is $$\frac{event\ occurred}{total\ number\ of\ trials}$$

Edit 2:

Where do the probabilities of the sentences come from?

It is coming from a machine learning algorithm (SVM).

What do they mean?

Because the sentences are shuffled, we lost the information about which writer wrote this sentence. However, we know the (sentence) writing styles of these two writers, so we trained a SVM by using the known writing styles as features to give each sentence a probability, the probability means this sentence has x% probability is written by writer y.

As the task is getting more difficult now. We are just given a phrase to judge (I mean assign a probability to this phrase, in case you think judge might means binary decision) which writer wrote it. (You might say can you not train another SVM to get the probability, just like what you did for sentence probabilities. Assume we can not do it.)

I had modified my question, it should be "The question is what is the probability of the given phrase is written by writer 1 or writer 2?"

$\endgroup$
  • $\begingroup$ What probability rules did you use to arrive at your first calculation? $\endgroup$ – Glen_b -Reinstate Monica May 29 '14 at 14:10
  • $\begingroup$ Hi Glen_b, it is frequentist probability. $\endgroup$ – user200340 May 29 '14 at 14:26
  • 1
    $\begingroup$ We have a failure to communicate. When you wrote "My calculation is for the probability that the phrase is written by writer 1:", and then a formula, where did that formula come from? $\endgroup$ – Glen_b -Reinstate Monica May 29 '14 at 14:35
  • $\begingroup$ Please see my edit, Glen_b $\endgroup$ – user200340 May 29 '14 at 15:05
  • $\begingroup$ Where do the probabilities of the sentences come from? What do they mean? After all, you started out knowing which writer wrote which sentence, and each sentence is unique (no duplicates), so all probabilities associated with sentences must be either 100% or 0%. If you lose the information about the writers, then all you can say is that every sentence has the same probability of being in writer 1's book. The question is ambiguous, too: do you want the chance that a phrase was written by both writers (that's what the question says!) or do you want the separate chances for each writer? $\endgroup$ – whuber May 29 '14 at 16:09
2
$\begingroup$

Yes, you have a mistake.

$$ P(writer1) = P(writer1 | sentence1) P(sentence1) + \ldots + P(writer1 | sentence4) P(sentence4) $$

We know each of the $P(writer1 | sentence)$ terms: $$ P(writer1|sentence1) = 0.2$$ $$ P(writer1|sentence2) = 0.6$$ $$ P(writer1|sentence3) = 1 - P(writer2|sentence3) = 0.5$$ $$ P(writer1|sentence4) = 1 - P(writer2|sentence4) = 0.6$$

Assuming the probability of each sentence being the one the phrase is in is the same (I think this is fair assumption) $\implies P(sentence j) = \frac{1}{4}$

Then, $$P(writer1) = (0.2 + 0.6 + 0.5 + 0.6) \cdot \frac{1}{4} = 0.475$$

Note that its just a coincidence that you happened to be close to the right answer. I suppose you could think of this in the way that you suggest too:

$$ \frac{events}{trials}$$

But in that case:

$$ events = .2 + .6 + .5 + .4 $$ (the fraction of the time the event that writer 1 is the author)

$$ trials = 1 + 1 + 1 + 1$$

You will get the same answer, but I think the conditional probability way is a bit easier to think about.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.