lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yakob <>
Subject Re: precision and recall in lucene
Date Tue, 30 Nov 2010 15:46:28 GMT
On 11/30/10, Robert Muir <> wrote:

> Have a look at contrib/benchmark under the
> org.apache.lucene.benchmark.quality package.
> There is code (for example
> org.apache.lucene.benchmark.quality.trec.QueryDriver) that can run an
> experiment and output what you need for trec_eval.exe
> I think there is some additional documentation on how to use this in
> Lucene in Action 2.
> ---------------------------------------------------------------------

yes you're right.I just realize it.I did find the sample source code
of precision and recall in that ebook such as here.

public class PrecisionRecall {
        public static void main(String[] args) throws Throwable {
                File topicsFile = new
                File qrelsFile = new
                Directory dir =
                Searcher searcher = new IndexSearcher(dir, true);

                String docNameField = "filename";

                PrintWriter logger = new PrintWriter(System.out, true);

                TrecTopicsReader qReader = new TrecTopicsReader();
                QualityQuery qqs[] = qReader.readQueries(new BufferedReader(
                                new FileReader(topicsFile)));

                Judge judge = new TrecJudge(new BufferedReader(
                                new FileReader(qrelsFile)));

                judge.validateData(qqs, logger);

                QualityQueryParser qqParser = new SimpleQQParser(
                                "title", "contents");

                QualityBenchmark qrun = new QualityBenchmark(qqs,
                                qqParser, searcher, docNameField);

                SubmissionReport submitLog = null;
                QualityStats stats[] = qrun.execute(judge,
                submitLog, logger);

                QualityStats avg =
                        avg.log("SUMMARY",2,logger, " ");


or in a more friendly format you can see it in this link

but when I run that code in lucene,the computation of precision and
recall that I get is is the result

WARNING: 5 judgments match no query! -

 Search Seconds:         0.000
 DocName Seconds:        0.000
 Num Points:             0.000
 Num Good Points:        0.000
 Max Good Points:        0.000
 Average Precision:      0.000
 MRR:                    0.000
 Recall:                 0.000

can you tell me what went wrong? what is the difference between
topicsFile and qrelsFile anyway?

thanks though. :-)

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message