001/** 002 * Copyright (C) 2007 - 2016, 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 */ 019package org.dllearner.learningproblems; 020 021import java.util.Set; 022 023import org.dllearner.core.Score; 024import org.semanticweb.owlapi.model.OWLEntity; 025 026/** 027 * @author Jens Lehmann 028 * 029 */ 030public class ScorePosOnly<T extends OWLEntity> extends Score { 031 032 private static final long serialVersionUID = 2191608162129054464L; 033 034 private Set<T> coveredInstances; 035 private Set<T> notCoveredPositives; 036 private Set<T> additionalInstances; 037 038 private double coverage; 039 private double addition; 040 private double accuracy; 041 042 public ScorePosOnly(Set<T> coveredInstances, Set<T> notCoveredPositives, double coverage, Set<T> additionalInstances, double protusion, double accuracy) { 043 this.coveredInstances = coveredInstances; 044 this.notCoveredPositives = notCoveredPositives; 045 this.additionalInstances = additionalInstances; 046 this.coverage = coverage; 047 this.addition = protusion; 048 this.accuracy = accuracy; 049 } 050 051 /** 052 * @return Coverage of the class description. 053 */ 054 public double getCoverage() { 055 return coverage; 056 } 057 058 /** 059 * Let C be the considered class expression and A the class to learn. 060 * The addition number is calculated as the number of instances of C which are also 061 * instances of A divided by the number of instances of C. 062 * @return Additional instances of the class description. 063 */ 064 public double getAddition() { 065 return addition; 066 } 067 068 /* (non-Javadoc) 069 * @see org.dllearner.core.Score#getAccuracy() 070 */ 071 @Override 072 public double getAccuracy() { 073// return 0.5 * (coverage + addition); 074 return accuracy; 075 } 076 077 /** 078 * @return the coveredInstances 079 */ 080 public Set<T> getCoveredInstances() { 081 return coveredInstances; 082 } 083 084 /** 085 * @return the coveredInstances 086 */ 087 public Set<T> getNotCoveredPositives() { 088 return notCoveredPositives; 089 } 090 091 /** 092 * @return the additionalInstances 093 */ 094 public Set<T> getAdditionalInstances() { 095 return additionalInstances; 096 } 097 098}