On 11/30/10, Robert Muir <rcm...@gmail.com> 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("C:/Users/Raden/Documents/lucene/LuceneHibernate/adi/50.txt");
                File qrelsFile = new
File("C:/Users/Raden/Documents/lucene/LuceneHibernate/adi/51.txt");
                Directory dir = FSDirectory.open(new
File("C:/Users/Raden/Documents/lucene/LuceneHibernate/adi"));
                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 =
                        QualityStats.average(stats);
                        avg.log("SUMMARY",2,logger, " ");
                        dir.close();
        }

        }

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

http://pastebin.ca/2006780

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

WARNING: 5 judgments match no query! -
   potentialities
   an
   on
   the
   and


SUMMARY
 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. :-)
-- 
http://jacobian.web.id

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to