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.OWLIndividual; 025 026/** 027 * @author Lorenz Buehmann 028 * 029 */ 030public class QueryTreeScore extends Score { 031 032 private double score; 033 034 private double accuracy; 035 036 private double distancePenalty; 037 038 private double specifityScore; 039 private int nrOfSpecificNodes; 040 041 private Set<OWLIndividual> posAsPos; 042 private Set<OWLIndividual> posAsNeg; 043 private Set<OWLIndividual> negAsPos; 044 private Set<OWLIndividual> negAsNeg; 045 046 public QueryTreeScore(double score, double accuracy, 047 Set<OWLIndividual> posAsPos, Set<OWLIndividual> posAsNeg, Set<OWLIndividual> negAsPos, Set<OWLIndividual> negAsNeg, 048 double specifityScore, int nrOfSpecificNodes) { 049 super(); 050 this.score = score; 051 this.accuracy = accuracy; 052 this.posAsPos = posAsPos; 053 this.posAsNeg = posAsNeg; 054 this.negAsPos = negAsPos; 055 this.negAsNeg = negAsNeg; 056 this.specifityScore = specifityScore; 057 this.nrOfSpecificNodes = nrOfSpecificNodes; 058 } 059 060 /** 061 * @return the score 062 */ 063 public double getScore() { 064 return score; 065 } 066 067 /** 068 * @param score the score to set 069 */ 070 public void setScore(double score) { 071 this.score = score; 072 } 073 074 /** 075 * @param distancePenalty the distancePenalty to set 076 */ 077 public void setDistancePenalty(double distancePenalty) { 078 this.distancePenalty = distancePenalty; 079 } 080 081 /** 082 * @return the distancePenalty 083 */ 084 public double getDistancePenalty() { 085 return distancePenalty; 086 } 087 088 /* (non-Javadoc) 089 * @see org.dllearner.core.Score#getAccuracy() 090 */ 091 @Override 092 public double getAccuracy() { 093 return accuracy; 094 } 095 096 /** 097 * @param accuracy the accuracy to set 098 */ 099 public void setAccuracy(double accuracy) { 100 this.accuracy = accuracy; 101 } 102 103 public Set<OWLIndividual> getCoveredNegatives() { 104 return negAsPos; 105 } 106 107 public Set<OWLIndividual> getCoveredPositives() { 108 return posAsPos; 109 } 110 111 public Set<OWLIndividual> getNotCoveredPositives() { 112 return posAsNeg; 113 } 114 115 public Set<OWLIndividual> getNotCoveredNegatives() { 116 return negAsNeg; 117 } 118 119 /* (non-Javadoc) 120 * @see java.lang.Object#toString() 121 */ 122 @Override 123 public String toString() { 124 return score 125 + "(accuracy=" + accuracy 126 + "(+" + posAsPos.size() + "/" + (posAsPos.size() + posAsNeg.size()) 127 + "|-" + negAsPos.size() + "/" + (negAsPos.size() + negAsNeg.size()) + ")|" 128 + "specifity=" + specifityScore + "(" + nrOfSpecificNodes + ")|" 129 + "penalty=" + distancePenalty + ")"; 130 } 131 132}