View Javadoc

1   /*
2    * Copyright (C) 2004 Christian Siefkes <christian@siefkes.net>.
3    * Development of this software is supported by the German Research Society,
4    * Berlin-Brandenburg Graduate School in Distributed Information Systems
5    * (DFG grant no. GRK 316).
6    *
7    * This library is free software; you can redistribute it and/or
8    * modify it under the terms of the GNU Lesser General Public
9    * License as published by the Free Software Foundation; either
10   * version 2.1 of the License, or (at your option) any later version.
11   *
12   * This library is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this library; if not, visit
19   * http://www.gnu.org/licenses/lgpl.html or write to the Free Software
20   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
21   */
22  package de.fu_berlin.ties.eval;
23  
24  import de.fu_berlin.ties.io.Storable;
25  
26  /***
27   * A read-only view of the evaluation results calculated by the
28   * {@link de.fu_berlin.ties.eval.FMetrics} class and the underlying raw counts.
29   *
30   * @author Christian Siefkes
31   * @version $Revision: 1.3 $, $Date: 2004/10/11 15:30:41 $, $Author: siefkes $
32   */
33  public interface FMetricsView extends EvalInput, Storable {
34  
35      /***
36       * Returns the F-measure, setting <em>alpha</em> = 0.5 so <em>P</em> and
37       * <em>R</em> are weighted equal ("F1 measure").
38       * F1 = (2 * <em>P</em> * <em>R</em>) / (<em>P</em> + <em>R</em>).
39       *
40       * @return the F1 measure; a value in the range from 0.0 to 1.0
41       */
42      double getF1Measure();
43  
44      /***
45       * Returns the F-measure: F = 1 / (<em>alpha</em> * (1/<em>P</em>)
46       * + (1-<em>alpha</em>) * (1/<em>R</em>)). <br>
47       * <em>F</em> is defined to be 0 if <em>P</em> = 0 or <em>R</em> = 0.
48       *
49       * @param alpha a factor in the range from 0.0 to 1.0 defining the weighting
50       * of precision and recall
51       * @return the F-measure; a value in the range from 0.0 to 1.0
52       * @throws IllegalArgumentException if <code>alpha</code> is smaller than
53       * 0.0 or larger than 1.0
54       */
55      double getFMeasure(final double alpha) throws IllegalArgumentException;
56  
57      /***
58       * Returns the precision: <em>P</em> =
59       * <em>tp</em> / (<em>tp</em> + <em>fp</em>).
60       * @return the precision; a value in the range from 0.0 to 1.0
61       */
62      double getPrecision();
63  
64      /***
65       * Returns the recall: <em>R</em> =
66       * <em>tp</em> / (<em>tp</em> + <em>fn</em>).
67       * @return the precision; a value in the range from 0.0 to 1.0
68       */
69      double getRecall();
70  
71  }