3
$\begingroup$

Maybe this is a noob question and maybe it should be on CrossValidated ...

Suppose I have two classes {class1, class2} and have their two associated EmpiricalDistribution[]s, pdf1(x) and pdf2(x).

Then, given an x value, what is the appropriate way to classify x (i.e. calculate the probability of each class) ?

$\endgroup$
2
$\begingroup$
dist1 = EmpiricalDistribution[Range[11] -> Range[1, 0, -.1]];
dist2 = EmpiricalDistribution[Range[11] -> Range[0, 1, .1]];
DiscretePlot[PDF[dist1, x], {x, 0, 1, .1}]

enter image description here

DiscretePlot[PDF[dist2, x], {x, 0, 1, .1}]

enter image description here

With[{x = 0.3}, {#1, #2}/(#1 + #2) & @@ {PDF[dist1, x], PDF[dist2, x]}]

(* class1_prob, class2_prob *)

{0.666667, 0.333333}

$\endgroup$
  • $\begingroup$ sure, but is this really the correct answer ? $\endgroup$ – Abel Brown Oct 19 '16 at 12:27
  • $\begingroup$ @AbelBrown Why not? $\endgroup$ – Alexey Golyshev Oct 19 '16 at 15:20

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.