View Javadoc

1   /*
2    * Copyright (C) 2004-2006 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 program is free software; you can redistribute it and/or modify
8    * it under the terms of the GNU General Public License as published by
9    * the Free Software Foundation; either version 2 of the License, or
10   * (at your option) any later version.
11   *
12   * This program 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
15   * GNU General Public License for more details.
16   *
17   * You should have received a copy of the GNU General Public License
18   * along with this program; if not, visit
19   * http://www.gnu.org/licenses/gpl.html or write to the Free Software
20   * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  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.6 $, $Date: 2006/10/21 16:04:11 $, $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  }