Clear Filters
Clear Filters

How to make precision and recall of same length?

1 view (last 30 days)
Hello experts. I am working on information retrieval. After searching I have computed the precision (P) and recall (R) for five queries. Every query have different number of TPs so the length of every P and R for five queries is different. How can I make of same internval. For example.
r1 = [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0];
p1 = [1 1 1 1 1 1 1 1 1 1 ]; % just exmple
r2 = [0.2 0.4 0.6 0.8 1];
p2 = [1.0 0.5 0.5 0.6 0.3];
now can I make both r1 and r2 from 0.1:0.1:1.0 ?

Answers (1)

Jos (10584)
Jos (10584) on 28 Sep 2018
You want to do some kind of interpolation, for instance, using:
r12_adjusted = 0.1:0.1:1.0 % take care (##)
p1_adjusted = interp1(r1, p1, r12_adjusted)
p2_adjusted = interp1(r2, p2, r12_adjusted)
However, you could run into problems when you're trying to extrapolate ...
(##) Note, this line might not return what you expect it to return. For instance, this array does not contain 0.3 exactly:
x = 0.1:0.1:1.0
any(x == 0.3) % false!
min(abs(x-0.3)) % very small but not exactly 0!

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!