How to make precision and recall of same length?

1 次查看(过去 30 天)
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 ?

回答(1 个)

Jos (10584)
Jos (10584) 2018-9-28
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!

类别

Help CenterFile Exchange 中查找有关 Descriptive Statistics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by