001 /**
002 * Copyright (C) 2007-2011, Jens Lehmann
003 *
004 * This file is part of DL-Learner.
005 *
006 * DL-Learner is free software; you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation; either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * DL-Learner is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014 * GNU General Public License for more details.
015 *
016 * You should have received a copy of the GNU General Public License
017 * along with this program. If not, see <http://www.gnu.org/licenses/>.
018 */
019
020 package org.dllearner.learningproblems;
021
022 import java.util.Set;
023
024 import org.dllearner.core.Score;
025 import org.dllearner.core.owl.Individual;
026
027 /**
028 * @author Jens Lehmann
029 *
030 */
031 public class ScorePosOnly extends Score {
032
033 private static final long serialVersionUID = 2191608162129054464L;
034
035 private Set<Individual> coveredInstances;
036 private Set<Individual> notCoveredPositives;
037 private Set<Individual> additionalInstances;
038
039 private double coverage;
040 private double addition;
041 private double accuracy;
042
043 public ScorePosOnly(Set<Individual> coveredInstances, Set<Individual> notCoveredPositives, double coverage, Set<Individual> additionalInstances, double protusion, double accuracy) {
044 this.coveredInstances = coveredInstances;
045 this.notCoveredPositives = notCoveredPositives;
046 this.additionalInstances = additionalInstances;
047 this.coverage = coverage;
048 this.addition = protusion;
049 this.accuracy = accuracy;
050 }
051
052 /**
053 * @return Coverage of the class description.
054 */
055 public double getCoverage() {
056 return coverage;
057 }
058
059 /**
060 * Let C be the considered class description and A the class to learn.
061 * The addition number is calculated as the number of instances of C which are also
062 * instances of A divided by the number of instances of C.
063 * @return Additional instances of the class description.
064 */
065 public double getAddition() {
066 return addition;
067 }
068
069 /* (non-Javadoc)
070 * @see org.dllearner.core.Score#getAccuracy()
071 */
072 @Override
073 public double getAccuracy() {
074 // return 0.5 * (coverage + addition);
075 return accuracy;
076 }
077
078 /**
079 * @return the coveredInstances
080 */
081 public Set<Individual> getCoveredInstances() {
082 return coveredInstances;
083 }
084
085 /**
086 * @return the coveredInstances
087 */
088 public Set<Individual> getNotCoveredPositives() {
089 return notCoveredPositives;
090 }
091
092 /**
093 * @return the additionalInstances
094 */
095 public Set<Individual> getAdditionalInstances() {
096 return additionalInstances;
097 }
098
099 }