ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vjapa...@apache.org
Subject svn commit: r1551254 [22/26] - in /ctakes/branches/ytex: ctakes-ytex-res/ ctakes-ytex-res/.settings/ ctakes-ytex-res/src/ ctakes-ytex-res/src/main/ ctakes-ytex-res/src/main/resources/ ctakes-ytex-res/src/main/resources/org/ ctakes-ytex-res/src/main/res...
Date Mon, 16 Dec 2013 16:30:40 GMT
Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/LCSPath.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/LCSPath.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/LCSPath.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/LCSPath.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,78 @@
+package org.apache.ctakes.ytex.kernel.metric;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "LCSPath")
+public class LCSPath implements Serializable {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	private List<String> concept1Path;
+
+	private List<String> concept2Path;
+	
+	private String lcs;
+
+	public LCSPath() {
+		super();
+	}
+
+	@XmlAttribute 
+	public List<String> getConcept1Path() {
+		return concept1Path;
+	}
+
+	@XmlAttribute 
+	public List<String> getConcept2Path() {
+		return concept2Path;
+	}
+
+	@XmlAttribute
+	public String getLcs() {
+		return lcs;
+	}
+
+	public void setConcept1Path(List<String> concept1Path) {
+		this.concept1Path = concept1Path;
+	}
+
+	public void setConcept2Path(List<String> concept2Path) {
+		this.concept2Path = concept2Path;
+	}
+
+	public void setLcs(String lcs) {
+		this.lcs = lcs;
+	}
+
+	public String toString() {
+		StringBuilder b = new StringBuilder();
+		if (getConcept1Path() != null && this.getConcept1Path().size() > 0) {
+			formatPath(b, "->", getConcept1Path().iterator());
+			b.append("->*");
+		}
+		b.append(this.getLcs());
+		if (getConcept2Path() != null && this.getConcept2Path().size() > 0) {
+			b.append("*<-");
+			formatPath(b, "<-", getConcept2Path().iterator());
+		}
+		return b.toString();
+
+	}
+
+	private void formatPath(StringBuilder b, String link,
+			Iterator<String> pathIter) {
+		while (pathIter.hasNext()) {
+			b.append(pathIter.next());
+			if (pathIter.hasNext()) {
+				b.append(link);
+			}
+		}
+	}
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/LinMetric.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/LinMetric.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/LinMetric.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/LinMetric.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,64 @@
+package org.apache.ctakes.ytex.kernel.metric;
+
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * compute corpus-ic or intrinsic-ic based lin measure.
+ * 
+ * @author vijay
+ * 
+ */
+public class LinMetric extends BaseSimilarityMetric {
+	private static final Log log = LogFactory.getLog(LinMetric.class);
+	private boolean intrinsicIC = true;
+	private boolean validCG = false;
+	private String rootConcept = simSvc.getConceptGraph().getRoot();
+
+	public boolean isIntrinsicIC() {
+		return intrinsicIC;
+	}
+
+	public void setIntrinsicIC(boolean intrinsicIC) {
+		this.intrinsicIC = intrinsicIC;
+	}
+
+	@Override
+	public double similarity(String concept1, String concept2,
+			Map<String, Double> conceptFilter, SimilarityInfo simInfo) {
+		// don't bother if the concept graph is null
+		if (!validCG)
+			return 0d;
+		// get lcs
+		double lcsIC = initLcsIC(concept1, concept2, conceptFilter, simInfo,
+				this.intrinsicIC);
+		if (lcsIC == 0d) {
+			return 0d;
+		}
+		// get ic of concepts
+		double ic1 = simSvc.getIC(concept1, this.intrinsicIC);
+		double ic2 = simSvc.getIC(concept2, this.intrinsicIC);
+		// if the corpus IC is 0 and the concept is not the root, then we don't
+		// have any IC on the concept and can't measure similarity - return 0
+		if (!intrinsicIC && ic1 == 0 && !rootConcept.equals(concept1))
+			return 0d;
+		if (!intrinsicIC && ic2 == 0 && !rootConcept.equals(concept2))
+			return 0d;
+		double denom = ic1 + ic2;
+		if (denom == 0)
+			return 0d;
+		return 2 * lcsIC / denom;
+	}
+
+	public LinMetric(ConceptSimilarityService simSvc, boolean intrinsicIC) {
+		super(simSvc);
+		this.intrinsicIC = intrinsicIC;
+		this.validCG = simSvc.getConceptGraph() != null;
+		if (!this.intrinsicIC && validCG) {
+			rootConcept = simSvc.getConceptGraph().getRoot();
+		}
+	}
+
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/PageRankMetric.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/PageRankMetric.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/PageRankMetric.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/PageRankMetric.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,24 @@
+package org.apache.ctakes.ytex.kernel.metric;
+
+import java.util.Map;
+
+import org.apache.ctakes.ytex.kernel.pagerank.PageRankService;
+
+
+public class PageRankMetric extends BaseSimilarityMetric {
+	PageRankService pageRankService;
+
+	public PageRankMetric(ConceptSimilarityService simSvc,
+			PageRankService pageRankService) {
+		super(simSvc);
+		this.pageRankService = pageRankService;
+	}
+
+	@Override
+	public double similarity(String concept1, String concept2,
+			Map<String, Double> conceptFilter, SimilarityInfo simInfo) {
+		return pageRankService.sim(concept1, concept2,
+				this.simSvc.getConceptGraph(), 30, 1e-3, 0.85);
+	}
+
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/PathMetric.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/PathMetric.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/PathMetric.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/PathMetric.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,23 @@
+package org.apache.ctakes.ytex.kernel.metric;
+
+import java.util.Map;
+
+
+public class PathMetric extends BaseSimilarityMetric {
+
+	public PathMetric(ConceptSimilarityService simSvc) {
+		super(simSvc);
+	}
+
+	@Override
+	public double similarity(String concept1, String concept2,
+			Map<String, Double> conceptFilter, SimilarityInfo simInfo) {
+		this.initLCSes(concept1, concept2, simInfo);
+		if (simInfo.getLcsDist() > 0) {
+			return 1 / ((double) simInfo.getLcsDist());
+		} else {
+			return 0;
+		}
+	}
+
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/RadaMetric.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/RadaMetric.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/RadaMetric.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/RadaMetric.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,34 @@
+package org.apache.ctakes.ytex.kernel.metric;
+
+import java.util.Map;
+
+/**
+ * 1 - path / (2*maxDepth)
+ * 
+ * @author vijay
+ * 
+ */
+public class RadaMetric extends BaseSimilarityMetric {
+
+	double depthMax = 0d;
+
+	public RadaMetric(ConceptSimilarityService simSvc, Integer depthMax) {
+		super(simSvc);
+		if (depthMax != null)
+			this.depthMax = depthMax.doubleValue();
+	}
+
+	@Override
+	public double similarity(String concept1, String concept2,
+			Map<String, Double> conceptFilter, SimilarityInfo simInfo) {
+		if (depthMax == 0d)
+			return 0d;
+		this.initLCSes(concept1, concept2, simInfo);
+		if (simInfo.getLcsDist() > 0) {
+			return 1 - (((double) simInfo.getLcsDist() - 1) / (double) (2 * depthMax));
+		} else {
+			return 0;
+		}
+	}
+
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/SimilarityInfo.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/SimilarityInfo.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/SimilarityInfo.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/SimilarityInfo.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,117 @@
+package org.apache.ctakes.ytex.kernel.metric;
+
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlTransient;
+
+/**
+ * Data structure to hold information on the lcs's, paths, and final selected
+ * LCS for a similarity measure. This is used by all the SimilarityMetrics
+ * called for a pair of concepts - we load the lcs info only once for each
+ * concept pair we are comparing.
+ * <p/>
+ * lcses - set of lcses.
+ * <p/>
+ * lcsDist - distance between concepts through lcs
+ * <p/>
+ * lcsPathMap - map of lcs to paths through the lcs between concept pairs. If
+ * this is non-null, then we fill this in. else we ignore this.
+ * <p/>
+ * corpusLcs, corpusLcsIC - the lcs selected for computing the similarity
+ * (relevant only to Information Content based measures)
+ * <p/>
+ * intrinsincLcs, intrinsicLcsIC - the lcs selected for computing the similarity
+ * (relevant only to Intrinsic Information Content based measures)
+ * 
+ * @author vijay
+ * 
+ */
+public class SimilarityInfo implements Serializable {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	private String corpusLcs;
+
+	private Double corpusLcsIC;
+
+	private String intrinsicLcs;
+
+	private Double intrinsicLcsIC;
+
+	private Integer lcsDist;
+	
+	private List<LCSPath> lcsPaths;
+
+	@XmlTransient
+	private Set<String> lcses = new HashSet<String>(1);
+
+	public Set<String> getLcses() {
+		return lcses;
+	}
+
+	public SimilarityInfo() {
+		super();
+	}
+
+	@XmlAttribute 
+	public String getCorpusLcs() {
+		return corpusLcs;
+	}
+
+	@XmlAttribute 
+	public Double getCorpusLcsIC() {
+		return corpusLcsIC;
+	}
+
+	@XmlAttribute 
+	public String getIntrinsicLcs() {
+		return intrinsicLcs;
+	}
+
+	@XmlAttribute 
+	public Double getIntrinsicLcsIC() {
+		return intrinsicLcsIC;
+	}
+
+	@XmlAttribute 
+	public Integer getLcsDist() {
+		return lcsDist;
+	}
+
+	@XmlElement
+	public List<LCSPath> getLcsPaths() {
+		return lcsPaths;
+	}
+
+	public void setCorpusLcs(String corpusLcs) {
+		this.corpusLcs = corpusLcs;
+	}
+
+	public void setCorpusLcsIC(Double corpusLcsIC) {
+		this.corpusLcsIC = corpusLcsIC;
+	}
+
+	public void setIntrinsicLcs(String intrinsicLcs) {
+		this.intrinsicLcs = intrinsicLcs;
+	}
+
+	public void setIntrinsicLcsIC(Double intrinsicLcsIC) {
+		this.intrinsicLcsIC = intrinsicLcsIC;
+	}
+
+	public void setLcsDist(Integer lcsDist) {
+		this.lcsDist = lcsDist;
+	}
+
+	public void setLcsPaths(List<LCSPath> lcsPaths) {
+		this.lcsPaths = lcsPaths;
+	}
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/SimilarityMetric.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/SimilarityMetric.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/SimilarityMetric.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/SimilarityMetric.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,24 @@
+package org.apache.ctakes.ytex.kernel.metric;
+
+import java.util.Map;
+
+public interface SimilarityMetric {
+	/**
+	 * 
+	 * @param concept1
+	 *            required - concept id
+	 * @param concept2
+	 *            required - concept id
+	 * @param conceptFilter
+	 *            optional. map of concept id to relevance (infogain) for all
+	 *            concepts. Only lcses from this map will be considered.
+	 * @param simInfo
+	 *            optional. if provided, we will fill in the path information
+	 *            and lcs of simInfo
+	 * @return similarity
+	 */
+	public double similarity(String concept1, String concept2,
+			Map<String, Double> conceptFilter, SimilarityInfo simInfo);
+
+
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/SokalSneathMetric.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/SokalSneathMetric.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/SokalSneathMetric.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/SokalSneathMetric.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,31 @@
+package org.apache.ctakes.ytex.kernel.metric;
+
+import java.util.Map;
+
+
+/**
+ * Sokal and Sneath metric as in eqn 18 from
+ * http://dx.doi.org/10.1016/j.jbi.2011.03.013
+ * 
+ * @author vijay
+ * 
+ */
+public class SokalSneathMetric extends BaseSimilarityMetric {
+
+	public SokalSneathMetric(ConceptSimilarityService simSvc) {
+		super(simSvc);
+	}
+
+	@Override
+	public double similarity(String concept1, String concept2,
+			Map<String, Double> conceptFilter, SimilarityInfo simInfo) {
+		double lcsIC = this.initLcsIC(concept1, concept2, conceptFilter,
+				simInfo, true);
+		if (lcsIC == 0d)
+			return 0d;
+		double ic1 = simSvc.getIC(concept1, true);
+		double ic2 = simSvc.getIC(concept2, true);
+		return lcsIC / (2 * (ic1 + ic2) - 3 * lcsIC);
+	}
+
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/WuPalmerMetric.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/WuPalmerMetric.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/WuPalmerMetric.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/metric/WuPalmerMetric.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,27 @@
+package org.apache.ctakes.ytex.kernel.metric;
+
+import java.util.Map;
+
+public class WuPalmerMetric extends BaseSimilarityMetric {
+	@Override
+	public double similarity(String concept1, String concept2,
+			Map<String, Double> conceptFilter, SimilarityInfo simInfo) {
+		initLCSes(concept1, concept2, simInfo);
+		if (simInfo.getLcses().size() > 0) {
+			int lcsDepth = 0;
+			for (String lcs : simInfo.getLcses()) {
+				int d = simSvc.getDepth(lcs);
+				if (d > lcsDepth)
+					lcsDepth = d;
+			}
+			double lcsDepth2 = (double) (lcsDepth * 2);
+			return lcsDepth2 / (lcsDepth2 + (double) (simInfo.getLcsDist()-1));
+		}
+		return 0d;
+	}
+
+	public WuPalmerMetric(ConceptSimilarityService simSvc) {
+		super(simSvc);
+	}
+
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ClassifierEvaluation.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ClassifierEvaluation.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ClassifierEvaluation.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ClassifierEvaluation.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,101 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ClassifierEvaluation implements Serializable {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	int classifierEvaluationId;
+	String name;
+	String experiment;
+	int fold;
+	int run;
+	String algorithm;
+	String label;
+	String options;
+	byte[] model;
+	Double param1;
+	String param2;
+	
+	public Double getParam1() {
+		return param1;
+	}
+	public void setParam1(Double param1) {
+		this.param1 = param1;
+	}
+	public String getParam2() {
+		return param2;
+	}
+	public void setParam2(String param2) {
+		this.param2 = param2;
+	}
+	Map<Long, ClassifierInstanceEvaluation> classifierInstanceEvaluations = new HashMap<Long, ClassifierInstanceEvaluation>();
+
+	public String getExperiment() {
+		return experiment;
+	}
+	public void setExperiment(String experiment) {
+		this.experiment = experiment;
+	}	
+	public byte[] getModel() {
+		return model;
+	}
+	public void setModel(byte[] model) {
+		this.model = model;
+	}
+	public int getClassifierEvaluationId() {
+		return classifierEvaluationId;
+	}
+	public void setClassifierEvaluationId(int classifierEvaluationId) {
+		this.classifierEvaluationId = classifierEvaluationId;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public int getFold() {
+		return fold;
+	}
+	public void setFold(int fold) {
+		this.fold = fold;
+	}
+	public int getRun() {
+		return run;
+	}
+	public void setRun(int run) {
+		this.run = run;
+	}
+	public String getAlgorithm() {
+		return algorithm;
+	}
+	public void setAlgorithm(String algorithm) {
+		this.algorithm = algorithm;
+	}
+	public String getLabel() {
+		return label;
+	}
+	public void setLabel(String label) {
+		this.label = label;
+	}
+	public String getOptions() {
+		return options;
+	}
+	public void setOptions(String options) {
+		this.options = options;
+	}
+	public Map<Long, ClassifierInstanceEvaluation> getClassifierInstanceEvaluations() {
+		return classifierInstanceEvaluations;
+	}
+	public void setClassifierInstanceEvaluations(
+			Map<Long, ClassifierInstanceEvaluation> classifierInstanceEvaluations) {
+		this.classifierInstanceEvaluations = classifierInstanceEvaluations;
+	}
+	
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ClassifierEvaluationIRStat.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ClassifierEvaluationIRStat.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ClassifierEvaluationIRStat.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ClassifierEvaluationIRStat.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,168 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+import java.io.Serializable;
+
+import org.apache.ctakes.ytex.dao.DBUtil;
+
+
+/**
+ * summary IR statistics. useful especially for lame databases like mysql.
+ * 
+ * @author vijay
+ * 
+ */
+public class ClassifierEvaluationIRStat implements Serializable {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	ClassifierEvaluation classifierEvaluation;
+	int classifierEvaluationIRStatId;
+	double f1;
+	int fn;
+	int fp;
+	String irClass;
+	int irClassId;
+	double npv;
+
+	double ppv;
+
+	double sensitivity;
+	double specificity;
+	int tn;
+	int tp;
+	String type = DBUtil.getEmptyString();
+	public ClassifierEvaluationIRStat() {
+		super();
+	}
+	public ClassifierEvaluationIRStat(
+			ClassifierEvaluation classifierEvaluation, String type, String irClass, Integer irClassId,
+			int tp, int tn, int fp, int fn) {
+		super();
+		this.classifierEvaluation = classifierEvaluation;
+		this.type = DBUtil.nullToEmptyString(type);
+		this.irClass = irClass;
+		this.irClassId = irClassId;
+		this.tp = tp;
+		this.tn = tn;
+		this.fp = fp;
+		this.fn = fn;
+		this.ppv = tp + fp > 0 ? ((double) tp) / (double) (tp + fp) : 0;
+		this.npv = tn + fn > 0 ? ((double) tn) / (double) (tn + fn) : 0;
+		this.sensitivity = tp + fn > 0 ? ((double) tp) / (double) (tp + fn) : 0;
+		this.specificity = tn + fp > 0 ? ((double) tn) / (double) (tn + fp) : 0;
+		this.f1 = ppv + sensitivity > 0 ? 2 * ppv * sensitivity
+				/ (ppv + sensitivity) : 0;
+	}
+
+	public ClassifierEvaluation getClassifierEvaluation() {
+		return classifierEvaluation;
+	}
+
+	public int getClassifierEvaluationIRStatId() {
+		return classifierEvaluationIRStatId;
+	}
+
+	public double getF1() {
+		return f1;
+	}
+
+	public int getFn() {
+		return fn;
+	}
+
+	public int getFp() {
+		return fp;
+	}
+
+	public String getIrClass() {
+		return irClass;
+	}
+
+	public int getIrClassId() {
+		return irClassId;
+	}
+
+	public double getNpv() {
+		return npv;
+	}
+
+	public double getPpv() {
+		return ppv;
+	}
+
+	public double getSensitivity() {
+		return sensitivity;
+	}
+
+	public double getSpecificity() {
+		return specificity;
+	}
+
+	public int getTn() {
+		return tn;
+	}
+
+	public int getTp() {
+		return tp;
+	}
+
+	public String getType() {
+		return type;
+	}
+	public void setClassifierEvaluation(
+			ClassifierEvaluation classifierEvaluation) {
+		this.classifierEvaluation = classifierEvaluation;
+	}
+	public void setClassifierEvaluationIRStatId(int classifierEvaluationIRStatId) {
+		this.classifierEvaluationIRStatId = classifierEvaluationIRStatId;
+	}
+
+	public void setF1(double f1) {
+		this.f1 = f1;
+	}
+
+	public void setFn(int fn) {
+		this.fn = fn;
+	}
+
+	public void setFp(int fp) {
+		this.fp = fp;
+	}
+
+	public void setIrClass(String irClass) {
+		this.irClass = irClass;
+	}
+
+	public void setIrClassId(int ir_classId) {
+		this.irClassId = ir_classId;
+	}
+
+	public void setNpv(double npv) {
+		this.npv = npv;
+	}
+
+	public void setPpv(double ppv) {
+		this.ppv = ppv;
+	}
+
+	public void setSensitivity(double sensitivity) {
+		this.sensitivity = sensitivity;
+	}
+
+	public void setSpecificity(double specificity) {
+		this.specificity = specificity;
+	}
+
+	public void setTn(int tn) {
+		this.tn = tn;
+	}
+
+	public void setTp(int tp) {
+		this.tp = tp;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ClassifierInstanceEvaluation.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ClassifierInstanceEvaluation.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ClassifierInstanceEvaluation.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ClassifierInstanceEvaluation.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,55 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+public class ClassifierInstanceEvaluation implements Serializable {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	int predictedClassId;
+	Integer targetClassId;
+	ClassifierEvaluation classifierEvaluation;
+	int classifierInstanceEvaluationId;
+	Map<Integer, Double> classifierInstanceProbabilities = new HashMap<Integer, Double>();
+	long instanceId;
+	public int getPredictedClassId() {
+		return predictedClassId;
+	}
+	public ClassifierEvaluation getClassifierEvaluation() {
+		return classifierEvaluation;
+	}
+	public int getClassifierInstanceEvaluationId() {
+		return classifierInstanceEvaluationId;
+	}
+	public Map<Integer, Double> getClassifierInstanceProbabilities() {
+		return classifierInstanceProbabilities;
+	}
+	public long getInstanceId() {
+		return instanceId;
+	}
+	public void setPredictedClassId(int classId) {
+		this.predictedClassId = classId;
+	}
+	public void setClassifierEvaluation(ClassifierEvaluation classifierEvaluation) {
+		this.classifierEvaluation = classifierEvaluation;
+	}
+	public void setClassifierInstanceEvaluationId(int classifierInstanceEvaluationId) {
+		this.classifierInstanceEvaluationId = classifierInstanceEvaluationId;
+	}
+	public void setClassifierInstanceProbabilities(
+			Map<Integer, Double> classifierInstanceProbabilities) {
+		this.classifierInstanceProbabilities = classifierInstanceProbabilities;
+	}
+	public void setInstanceId(long instanceId) {
+		this.instanceId = instanceId;
+	}
+	public Integer getTargetClassId() {
+		return targetClassId;
+	}
+	public void setTargetClassId(Integer targetClassId) {
+		this.targetClassId = targetClassId;
+	}
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ConcRel.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ConcRel.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ConcRel.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ConcRel.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,661 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.ctakes.ytex.kernel.metric.LCSPath;
+
+
+import com.google.common.collect.ImmutableSet;
+
+public class ConcRel implements java.io.Serializable {
+	private static final Logger log = Logger.getLogger(ConcRel.class.getName());
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public static List<String> crListToString(List<ConcRel> crList) {
+		if (crList != null) {
+			List<String> path = new ArrayList<String>(crList.size());
+			for (ConcRel cr : crList)
+				path.add(cr.getConceptID());
+			return path;
+		} else {
+			return null;
+		}
+	}
+
+	/**
+	 * get least common subsumer of the specified concepts and its distance from
+	 * root.
+	 * 
+	 * @deprecated
+	 * 
+	 * @param c1
+	 * @param c2
+	 * @return
+	 */
+	public static ObjPair<ConcRel, Integer> getLeastCommonConcept(ConcRel c1,
+			ConcRel c2) {
+		if (log.isLoggable(Level.FINE)) {
+			log.fine("getLeastCommonConcept(" + c1 + "," + c2 + ")");
+		}
+		// result
+		ObjPair<ConcRel, Integer> res = new ObjPair<ConcRel, Integer>(null,
+				Integer.MAX_VALUE);
+		// concept 1's parent distance map
+		Map<ConcRel, Integer> cand1 = new HashMap<ConcRel, Integer>();
+		// concept 2's parent distance map
+		Map<ConcRel, Integer> cand2 = new HashMap<ConcRel, Integer>();
+
+		// parents of concept 1
+		HashSet<ConcRel> parC1 = new HashSet<ConcRel>();
+		parC1.add(c1);
+		// parents of concept 2
+		HashSet<ConcRel> parC2 = new HashSet<ConcRel>();
+		parC2.add(c2);
+		HashSet<ConcRel> tmp = new HashSet<ConcRel>();
+		HashSet<ConcRel> tmp2;
+
+		int dist = 0;
+		// changed to start distance with 1 - we increment at the end of the
+		// loop
+		// we always look at the parents, so the distance has to start with 1
+		// if one concept is the parent of the other, this would return 0 if
+		// dist starts with 0
+		// int dist = 1;
+		// while there are parents
+		// this does a dual-breadth first search
+		// parC1 are the dist'th ancestors of concept 1
+		// parC2 are the dist'th ancestors of concept 2
+		while (!parC1.isEmpty() || !parC2.isEmpty()) {
+			// grandparents
+			tmp.clear();
+			// go through parents of concept1
+			for (Iterator<ConcRel> it = parC1.iterator(); it.hasNext();) {
+				ConcRel cr = it.next();
+				// checkif it's in the map concept2's parent distance map
+				// - map of distances from concept 1
+				if (cand2.containsKey(cr)) {
+					res.v1 = cr;
+					res.v2 = dist + cand2.get(cr).intValue();
+					// return
+					return res;
+				}
+				// not in the map - add it to the concept-distance map
+				cand1.put(cr, dist);
+				// add the grandparents to the tmp set
+				tmp.addAll(cr.parents);
+			}
+			// remove concepts already in concept1's parent distance map from
+			// the grandparent map
+			tmp.removeAll(cand1.keySet());
+			// tmp2 becomes the parents of c1
+			tmp2 = parC1;
+			// par c1 becomes grandparents minus parents
+			parC1 = tmp;
+			// tmp becomes tmp2, which is going to be killed in the next line
+			tmp = tmp2;
+
+			tmp.clear();
+			// repeat everything for concept2 - go up one level
+			for (Iterator<ConcRel> it = parC2.iterator(); it.hasNext();) {
+				ConcRel cr = it.next();
+				if (cand1.containsKey(cr)) {
+					res.v1 = cr;
+					res.v2 = dist + cand1.get(cr).intValue();
+					return res;
+				}
+				cand2.put(cr, dist);
+				tmp.addAll(cr.parents);
+			}
+			tmp.removeAll(cand2.keySet());
+			tmp2 = parC2;
+			parC2 = tmp;
+			tmp = tmp2;
+
+			++dist;
+		}
+
+		return res;
+	}
+
+	/**
+	 * 
+	 * @param c1
+	 *            concept1
+	 * @param c2
+	 *            concept2
+	 * @param lcses
+	 *            least common subsumers, required
+	 * @param paths
+	 *            paths between concepts via lcses, optional. Key - lcs. Value -
+	 *            2 element list corresponding to paths to lcs from c1 and c2
+	 * @return path length, -1 if no lcs
+	 */
+	public static int getLeastCommonConcept(ConcRel c1, ConcRel c2,
+			Set<ConcRel> lcses, Map<ConcRel, LCSPath> paths) {
+		if (log.isLoggable(Level.FINE)) {
+			log.fine("getLeastCommonConcept(" + c1 + "," + c2 + ")");
+		}
+		// concept 1's parent distance map
+		Map<ConcRel, Integer> cand1 = new HashMap<ConcRel, Integer>();
+		// concept 2's parent distance map
+		Map<ConcRel, Integer> cand2 = new HashMap<ConcRel, Integer>();
+		// paths corresponding to parents
+		// we only calculate these if they are asked of us
+		Map<ConcRel, List<ConcRel>> paths1 = paths != null ? new HashMap<ConcRel, List<ConcRel>>()
+				: null;
+		Map<ConcRel, List<ConcRel>> paths2 = paths != null ? new HashMap<ConcRel, List<ConcRel>>()
+				: null;
+
+		// parents of concept 1
+		HashSet<ConcRel> parC1 = new HashSet<ConcRel>();
+		parC1.add(c1);
+		// parents of concept 2
+		HashSet<ConcRel> parC2 = new HashSet<ConcRel>();
+		parC2.add(c2);
+		// temporary hashset for scratch work
+		// not clear if this really reduces memory overhead
+		HashSet<ConcRel> tmp = new HashSet<ConcRel>();
+		HashSet<ConcRel> candidateLCSes = new HashSet<ConcRel>();
+
+		int maxIter = -1;
+		int dist = 0;
+		int minDist = Integer.MAX_VALUE - 1;
+		// continue the search while there are parents left
+		// check maxIter - if this is some non-negative number
+		// then it must be greater than 0
+		while ((!parC1.isEmpty() || !parC2.isEmpty())
+				&& (maxIter < 0 || maxIter != 0)) {
+			// get next iteration of ancestors, save them
+			updateParent(cand1, parC1, tmp, dist, paths1);
+			updateParent(cand2, parC2, tmp, dist, paths2);
+			// get the intersection across the ancestors
+			tmp.clear();
+			tmp.addAll(cand1.keySet());
+			tmp.retainAll(cand2.keySet());
+			tmp.removeAll(candidateLCSes);
+			// if there is something in the intersection, we have a potential
+			// winner. however, we can't stop here
+			// example: ascites/hepatoma in snomed C2239176 C0003962
+			// e.g. one path could be 3-3, but a shorter path could be 4-1
+			// we would only find the 4-1 path after 4 iterations
+			if (!tmp.isEmpty()) {
+				// add candidates so we don't have to look at them in future
+				// iterations
+				candidateLCSes.addAll(tmp);
+				// remove candidates' parents from the parent collections for
+				// the next iterations
+				removeParents(tmp, parC1);
+				removeParents(tmp, parC2);
+				// add the lcs candidates and their path length
+				// even though we have a hit, we can't stop here
+				// there could be uneven path lengths.
+				// to account for this, the 1st time we find an lcs
+				// we set maxIter to the minimum path length to either concept
+				// from the lcs. if we can't find a match after maxIter
+				// iterations, then we know that what we've found is a winner
+				for (ConcRel lcs : tmp) {
+					// path length for current lcs
+					int distTmp = cand1.get(lcs) + cand2.get(lcs) + 1;
+					// only add it to the list of lcses if it is less than or
+					// equal to the current minimal path length
+					if (distTmp <= minDist) {
+						if (distTmp < minDist) {
+							// we have a new best minimal path length
+							// clear the current lcses
+							lcses.clear();
+						}
+						minDist = distTmp;
+						lcses.add(lcs);
+					}
+					// all additional lcses must be found within maxIter
+					// iterations. maxIter is the shortest path between
+					// the lcs and a concept
+					int minLcsToConceptLen = Math.min(cand1.get(lcs),
+							cand2.get(lcs));
+					if (maxIter < 0 || maxIter > minLcsToConceptLen) {
+						maxIter = minLcsToConceptLen;
+					}
+				}
+			}
+			// reduce maximum number of iterations left
+			maxIter--;
+			++dist;
+		}
+		if (lcses.isEmpty())
+			return -1;
+		else {
+			if (paths != null) {
+				for (ConcRel lcs : lcses) {
+					LCSPath lcsPath = new LCSPath();
+					lcsPath.setLcs(lcs.getConceptID());
+					lcsPath.setConcept1Path(crListToString(paths1.get(lcs)));
+					lcsPath.setConcept2Path(crListToString(paths2.get(lcs)));
+					paths.put(lcs, lcsPath);
+				}
+			}
+			return minDist;
+		}
+	}
+
+	/**
+	 * remove the parents of candidate lcses from the list of parents we were
+	 * planning on looking at in the next iteration
+	 * 
+	 * @param lcses
+	 * @param parents
+	 */
+	private static void removeParents(HashSet<ConcRel> lcses,
+			HashSet<ConcRel> parents) {
+		for (ConcRel lcs : lcses) {
+			parents.removeAll(lcs.parents);
+		}
+	}
+
+	/**
+	 * perform 1 iteration of breadth-first search on lcs. update the various
+	 * collections with the next iteration of ancestors.
+	 * 
+	 * @param cand1
+	 * @param parC1
+	 * @param tmp
+	 * @param dist
+	 */
+	private static void updateParent(Map<ConcRel, Integer> cand1,
+			HashSet<ConcRel> parC1, HashSet<ConcRel> tmp, int dist,
+			Map<ConcRel, List<ConcRel>> paths) {
+		tmp.clear();
+		// go through parents of concept1
+		for (Iterator<ConcRel> it = parC1.iterator(); it.hasNext();) {
+			ConcRel cr = it.next();
+			if (!cand1.containsKey(cr)) {
+				// not in the map - add it to the concept-distance map
+				cand1.put(cr, dist);
+				// add the grandparents to the tmp set
+				tmp.addAll(cr.parents);
+				if (paths != null) {
+					// add the path to the parent to the map of paths
+					List<ConcRel> pathCR = paths.get(cr);
+					for (ConcRel parent : cr.parents) {
+						if (!paths.containsKey(parent)) {
+							// path to parent = path to child + child
+							List<ConcRel> path = new ArrayList<ConcRel>(
+									pathCR != null ? pathCR.size() + 1 : 1);
+							if (pathCR != null)
+								path.addAll(pathCR);
+							path.add(cr);
+							paths.put(parent, path);
+						}
+					}
+				}
+			}
+		}
+		// remove concepts already in concept1's parent distance map from
+		// the grandparent map
+		tmp.removeAll(cand1.keySet());
+		// parents for the next iteration
+		parC1.clear();
+		parC1.addAll(tmp);
+	}
+
+	/**
+	 * children of this concept
+	 */
+	private Set<ConcRel> children;
+	private int[] childrenArray;
+	
+	private short depth;
+
+	private double intrinsicInfoContent;
+
+	/**
+	 * id of this concept
+	 */
+	private String nodeCUI;
+
+	private int nodeIndex;
+
+	/**
+	 * parents of this concept
+	 */
+	private Set<ConcRel> parents;
+
+	/**
+	 * for java object serialization, need to avoid default serializer behavior
+	 * of writing out entire object graph. just write the parent/children object
+	 * ids and resolve the connections after loading this object.
+	 */
+	private int[] parentsArray;
+
+	public ConcRel(String cui, int nodeIndex) {
+		nodeCUI = cui;
+		parents = new HashSet<ConcRel>();
+		children = new HashSet<ConcRel>();
+		parentsArray = null;
+		childrenArray = null;
+		this.nodeIndex = nodeIndex;
+	}
+
+	/**
+	 * reconstruct the relationships to other ConcRel objects
+	 * 
+	 * @param db
+	 */
+	public void constructRel(List<ConcRel> db) {
+		ImmutableSet.Builder<ConcRel> pBuilder = new ImmutableSet.Builder<ConcRel>(); 
+		for (int c : parentsArray)
+			pBuilder.add(db.get(c));
+		parents = pBuilder.build();
+		parentsArray = null;
+
+		ImmutableSet.Builder<ConcRel> cBuilder = new ImmutableSet.Builder<ConcRel>(); 
+		for (int c : childrenArray)
+			cBuilder.add(db.get(c));
+		children = cBuilder.build();
+		childrenArray = null;
+	}
+
+	public int depthMax() {
+		int d = 0;
+		for (Iterator<ConcRel> it = children.iterator(); it.hasNext();) {
+			ConcRel child = it.next();
+			int dm = child.depthMax() + 1;
+			if (dm > d)
+				d = dm;
+		}
+		return d;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		ConcRel other = (ConcRel) obj;
+		if (nodeIndex != other.nodeIndex)
+			return false;
+		return true;
+	}
+
+	public Set<ConcRel> getChildren() {
+		return children;
+	}
+	public int[] getChildrenArray() {
+		return childrenArray;
+	}
+	public String getConceptID() {
+		return nodeCUI;
+	}
+
+	public short getDepth() {
+		return depth;
+	}
+
+	public double getIntrinsicInfoContent() {
+		return intrinsicInfoContent;
+	}
+
+	public int getNodeIndex() {
+		return nodeIndex;
+	}
+
+	public Set<ConcRel> getParents() {
+		return parents;
+	}
+
+	public int[] getParentsArray() {
+		return parentsArray;
+	}
+
+	/**
+	 * recursively build all paths to root from a concept - add elements from
+	 * set of parents.
+	 * 
+	 * @param lpath
+	 *            current path from children to this concept
+	 * @param allPaths
+	 *            list of all paths
+	 * @param depth
+	 *            current depth
+	 * @param depthMax
+	 */
+	public void getPath(List<ConcRel> lpath, List<List<ConcRel>> allPaths,
+			int depth, int depthMax) {
+		if (depth >= depthMax)
+			return;
+		if (lpath == null)
+			lpath = new ArrayList<ConcRel>();
+
+		lpath.add(this);
+
+		if (isRoot()) {
+			// add a copy to the list of all paths
+			allPaths.add(new ArrayList<ConcRel>(lpath));
+		} else {
+			// recurse
+			for (ConcRel p : parents) {
+				p.getPath(lpath, allPaths, depth + 1, depthMax);
+			}
+		}
+		lpath.remove(lpath.size() - 1);
+	}
+
+	/**
+	 * is the specified concept an ancestor of this concept?
+	 * 
+	 * @param cui
+	 * @return
+	 */
+	public boolean hasAncestor(String cui) {
+		if (nodeCUI.equals(cui))
+			return true;
+		for (ConcRel c : parents) {
+			if (c.hasAncestor(cui))
+				return true;
+		}
+		return false;
+	}
+
+	@Override
+	public int hashCode() {
+		return nodeIndex;
+	}
+
+	public boolean isLeaf() {
+		return children.isEmpty();
+	}
+
+	public boolean isRoot() {
+		return parents.isEmpty();
+	}
+
+	/**
+	 * read parent/children concept ids, not the objects
+	 */
+	private void readObject(java.io.ObjectInputStream in)
+			throws java.io.IOException, ClassNotFoundException {
+		nodeCUI = (String) in.readObject();
+		this.nodeIndex = in.readInt();
+		this.intrinsicInfoContent = in.readDouble();
+		this.depth = in.readShort();
+		parentsArray = (int[]) in.readObject();
+		childrenArray = (int[]) in.readObject();
+		parents = new HashSet<ConcRel>(parentsArray.length);
+		children = new HashSet<ConcRel>(childrenArray.length);
+	}
+
+	// public static ObjPair<ConcRel, Integer> getLeastCommonConcept(
+	// Vector<Vector<ConcRel>> allPaths1, Vector<Vector<ConcRel>> allPaths2) {
+	// ObjPair<ConcRel, Integer> res = new ObjPair<ConcRel, Integer>(null,
+	// Integer.MAX_VALUE);
+	// ObjPair<ConcRel, Integer> tmp = new ObjPair<ConcRel, Integer>(null,
+	// Integer.MAX_VALUE);
+	//
+	// int n = 0;
+	// for (Vector<ConcRel> path1 : allPaths1) {
+	// // if(n++>200)
+	// // break;
+	// int n2 = 0;
+	// for (Vector<ConcRel> path2 : allPaths2) {
+	// // if(n2++>200)
+	// // break;
+	// if (getCommonConcept(path1, path2, tmp) != null) {
+	// if (tmp.v2.intValue() < res.v2.intValue()) {
+	// res.v1 = tmp.v1;
+	// res.v2 = tmp.v2;
+	// }
+	// }
+	// }
+	// }
+	//
+	// return res;
+	// }
+
+	// public static ConcRel getCommonConcept(Vector<ConcRel> path1,
+	// Vector<ConcRel> path2, ObjPair<ConcRel, Integer> oVals) {
+	// ConcRel common = null;
+	// int dist = Integer.MAX_VALUE;
+	// int index1 = path1.size() - 1;
+	// int index2 = path2.size() - 1;
+	// while (index1 >= 0 && index2 >= 0) {
+	// ConcRel r1 = path1.get(index1);
+	// if (r1.equals(path2.get(index2))) {
+	// common = r1;
+	// dist = index1 + index2;
+	// --index1;
+	// --index2;
+	// } else
+	// break;
+	// }
+	//
+	// oVals.v1 = common;
+	// oVals.v2 = dist;
+	//
+	// return common;
+	// }
+
+	public void setChildrenArray(int[] childrenArray) {
+		this.childrenArray = childrenArray;
+	}
+
+	public void setConceptID(String nodeCUI) {
+		this.nodeCUI = nodeCUI;
+	}
+
+	public void setDepth(short depth) {
+		this.depth = depth;
+	}
+
+	public void setIntrinsicInfoContent(double intrinsicInfoContent) {
+		this.intrinsicInfoContent = intrinsicInfoContent;
+	}
+
+	public void setNodeIndex(int nodeIndex) {
+		this.nodeIndex = nodeIndex;
+	}
+
+	public void setParentsArray(int[] parentsArray) {
+		this.parentsArray = parentsArray;
+	}
+
+	@Override
+	public String toString() {
+		return "ConcRel [nodeCUI=" + nodeCUI + "]";
+	}
+
+	/**
+	 * serialize parent/children concept ids, not the objects
+	 */
+	private void writeObject(java.io.ObjectOutputStream out)
+			throws java.io.IOException {
+		out.writeObject(nodeCUI);
+		out.writeInt(this.nodeIndex);
+		out.writeDouble(this.intrinsicInfoContent);
+		out.writeShort(this.depth);
+		if (parentsArray == null) {
+			parentsArray = new int[parents.size()];
+			int i = 0;
+			for (ConcRel c : parents)
+				parentsArray[i++] = c.getNodeIndex();
+		}
+		if (childrenArray == null) {
+			childrenArray = new int[children.size()];
+			int i = 0;
+			for (ConcRel c : children)
+				childrenArray[i++] = c.getNodeIndex();
+		}
+
+		out.writeObject(parentsArray);
+		out.writeObject(childrenArray);
+		parentsArray = null;
+		childrenArray = null;
+	}
+
+	// public static void main(String[] args) {
+	// int c1 = 18563; // 4903;
+	// int c2 = 18670; // 175695;
+	//
+	// ConcRel r1 = MetaDB.concRelDB.cuiRelDB.get(c1);
+	// ConcRel r2 = MetaDB.concRelDB.cuiRelDB.get(c2);
+	// if (r1 == null)
+	// System.out.println("No rel for " + c1);
+	// if (r2 == null)
+	// System.out.println("No rel for " + c2);
+	//
+	// if (r1 == null || r2 == null)
+	// return;
+	//
+	// Vector<Vector<ConcRel>> allPaths1 = new Vector<Vector<ConcRel>>();
+	// Vector<Vector<ConcRel>> allPaths2 = new Vector<Vector<ConcRel>>();
+	//
+	// r1.getPath(null, allPaths1, 0, 1000);
+	// r2.getPath(null, allPaths2, 0, 1000);
+	//
+	// int i = 0;
+	// System.out.println("***Paths for " + c1);
+	// i = 0;
+	// for (Vector<ConcRel> vc : allPaths1) {
+	// System.out.print("#P" + (i++) + ": ");
+	// i++;
+	// for (ConcRel cr : vc) {
+	// System.out.print("->" + cr.nodeCUI);
+	// }
+	// System.out.println("");
+	// }
+	//
+	// System.out.println("***Paths for " + c2);
+	// i = 0;
+	// for (Vector<ConcRel> vc : allPaths2) {
+	// System.out.print("##P" + (i++) + ": ");
+	// for (ConcRel cr : vc) {
+	// System.out.print("->" + cr.nodeCUI);
+	// }
+	// System.out.println("");
+	// }
+	//
+	// ObjPair<ConcRel, Integer> obp = getLeastCommonConcept(allPaths1,
+	// allPaths2);
+	// System.out.println("Common concept :"
+	// + (obp.v1 == null ? "none" : obp.v1.nodeCUI));
+	// System.out.println("dist: " + obp.v2);
+	//
+	// obp = getLeastCommonConcept(r1, r2);
+	// System.out.println("Common concept2 :"
+	// + (obp.v1 == null ? "none" : obp.v1.nodeCUI));
+	// System.out.println("dist: " + obp.v2);
+	//
+	// }
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ConceptGraph.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ConceptGraph.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ConceptGraph.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ConceptGraph.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,77 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A directed graph that spans a subset of the UMLS connecting concepts with
+ * IS-A links.
+ * 
+ * @author vijay
+ */
+public class ConceptGraph implements Serializable {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	private List<ConcRel> conceptList = new ArrayList<ConcRel>();
+	private transient Map<String, ConcRel> conceptMap = new HashMap<String, ConcRel>();
+	private short depthMax = 0;
+	private double intrinsicICMax = 0d;
+	private String root = null;
+
+	public ConcRel addConcept(String conceptID) {
+		// get position at which concept would be added to list
+		int nIndex = conceptList.size();
+		// add concept to conceptMap
+		ConcRel cr = new ConcRel(conceptID, nIndex);
+		conceptMap.put(conceptID, cr);
+		// add concept to list
+		conceptList.add(cr);
+		return cr;
+	}
+
+	public List<ConcRel> getConceptList() {
+		return conceptList;
+	}
+
+	public Map<String, ConcRel> getConceptMap() {
+		return conceptMap;
+	}
+
+	public short getDepthMax() {
+		return depthMax;
+	}
+
+	public double getIntrinsicICMax() {
+		return intrinsicICMax;
+	}
+
+	public String getRoot() {
+		return root;
+	}
+
+	public void setConceptList(List<ConcRel> conceptList) {
+		this.conceptList = conceptList;
+	}
+
+	public void setConceptMap(Map<String, ConcRel> conceptMap) {
+		this.conceptMap = conceptMap;
+	}
+
+	public void setDepthMax(short depthMax) {
+		this.depthMax = depthMax;
+	}
+
+	public void setIntrinsicICMax(double intrinsicICMax) {
+		this.intrinsicICMax = intrinsicICMax;
+	}
+
+	public void setRoot(String root) {
+		this.root = root;
+	}
+
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/CrossValidationFold.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/CrossValidationFold.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/CrossValidationFold.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/CrossValidationFold.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,107 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+import java.io.Serializable;
+import java.util.Set;
+
+import org.apache.ctakes.ytex.dao.DBUtil;
+
+
+public class CrossValidationFold implements Serializable {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	private String corpusName;
+	private int crossValidationFoldId;
+	private int fold = 0;
+	private Set<CrossValidationFoldInstance> instanceIds;
+
+	private String label = DBUtil.getEmptyString();
+
+	private int run = 0;
+	private String splitName = DBUtil.getEmptyString();
+
+	public CrossValidationFold() {
+		super();
+	}
+
+	public CrossValidationFold(String name, String splitName, String label, Integer run,
+			Integer fold, Set<CrossValidationFoldInstance> instanceIds) {
+		super();
+		this.setCorpusName(name);
+		this.setSplitName(splitName);
+		this.setLabel(label);
+		this.setRun(run);
+		this.setFold(fold);
+		this.instanceIds = instanceIds;
+	}
+
+
+	public String getCorpusName() {
+		return corpusName;
+	}
+
+	//
+	// /**
+	// * is this the training or test fold?
+	// * @return
+	// */
+	// public boolean isTrain() {
+	// return train;
+	// }
+	// public void setTrain(boolean train) {
+	// this.train = train;
+	// }
+	public int getCrossValidationFoldId() {
+		return crossValidationFoldId;
+	}
+
+	public int getFold() {
+		return fold;
+	}
+
+	public Set<CrossValidationFoldInstance> getInstanceIds() {
+		return instanceIds;
+	}
+
+	public String getLabel() {
+		return label;
+	}
+
+	public int getRun() {
+		return run;
+	}
+
+	public String getSplitName() {
+		return splitName;
+	}
+
+	public void setCorpusName(String name) {
+		this.corpusName = name;
+	}
+
+	public void setCrossValidationFoldId(int crossValidationFoldId) {
+		this.crossValidationFoldId = crossValidationFoldId;
+	}
+
+	public void setFold(int fold) {
+		this.fold = fold;
+	}
+
+	public void setInstanceIds(Set<CrossValidationFoldInstance> instanceIds) {
+		this.instanceIds = instanceIds;
+	}
+
+	public void setLabel(String label) {
+		this.label = DBUtil.nullToEmptyString(label);
+	}
+
+	public void setRun(int run) {
+		this.run = run;
+	}
+
+	public void setSplitName(String splitName) {
+		this.splitName = DBUtil.nullToEmptyString(splitName);
+	}
+
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/CrossValidationFoldInstance.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/CrossValidationFoldInstance.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/CrossValidationFoldInstance.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/CrossValidationFoldInstance.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,57 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+import java.io.Serializable;
+
+public class CrossValidationFoldInstance implements Serializable {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	private long instanceId;
+	private boolean train;
+	public long getInstanceId() {
+		return instanceId;
+	}
+	public void setInstanceId(long instanceId) {
+		this.instanceId = instanceId;
+	}
+	public boolean isTrain() {
+		return train;
+	}
+	public void setTrain(boolean train) {
+		this.train = train;
+	}
+	public CrossValidationFoldInstance(long instanceId, boolean train) {
+		super();
+		this.instanceId = instanceId;
+		this.train = train;
+	}
+	public CrossValidationFoldInstance() {
+		super();
+	}
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + (int) (instanceId ^ (instanceId >>> 32));
+		result = prime * result + (train ? 1231 : 1237);
+		return result;
+	}
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		CrossValidationFoldInstance other = (CrossValidationFoldInstance) obj;
+		if (instanceId != other.instanceId)
+			return false;
+		if (train != other.train)
+			return false;
+		return true;
+	}
+
+	
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/FeatureEvaluation.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/FeatureEvaluation.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/FeatureEvaluation.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/FeatureEvaluation.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,101 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+import java.io.Serializable;
+
+import org.apache.ctakes.ytex.dao.DBUtil;
+
+
+public class FeatureEvaluation implements Serializable {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	private String corpusName = DBUtil.getEmptyString();
+	private int crossValidationFoldId = 0;
+	private String evaluationType;
+	private int featureEvaluationId;
+	private String featureSetName = DBUtil.getEmptyString();
+	private String label = DBUtil.getEmptyString();
+	private double param1 = 0;
+	private String param2 = DBUtil.getEmptyString();
+
+	public FeatureEvaluation() {
+		super();
+	}
+
+	public FeatureEvaluation(String name, String label,
+			Integer crossValidationFoldId, String evaluationType) {
+		super();
+		this.corpusName = name;
+		this.label = label;
+		this.crossValidationFoldId = crossValidationFoldId;
+		this.evaluationType = evaluationType;
+	}
+
+	public String getCorpusName() {
+		return corpusName;
+	}
+
+	public int getCrossValidationFoldId() {
+		return crossValidationFoldId;
+	}
+
+	public String getEvaluationType() {
+		return evaluationType;
+	}
+
+	public int getFeatureEvaluationId() {
+		return featureEvaluationId;
+	}
+
+	public String getFeatureSetName() {
+		return featureSetName;
+	}
+
+	public String getLabel() {
+		return label;
+	}
+
+	public String getParam2() {
+		return param2;
+	}
+
+	public void setCorpusName(String name) {
+		this.corpusName = name;
+	}
+
+	public void setCrossValidationFoldId(int crossValidationFoldId) {
+		this.crossValidationFoldId = crossValidationFoldId;
+	}
+
+	public void setEvaluationType(String evaluationType) {
+		this.evaluationType = evaluationType;
+	}
+
+	public void setFeatureEvaluationId(int featureEvaluationId) {
+		this.featureEvaluationId = featureEvaluationId;
+	}
+
+	public void setFeatureSetName(String featureSetName) {
+		this.featureSetName = DBUtil.nullToEmptyString(featureSetName);
+	}
+
+	public void setLabel(String label) {
+		this.label = DBUtil.nullToEmptyString(label);
+	}
+
+	public void setParam2(String param2) {
+		this.param2 = DBUtil.nullToEmptyString(param2);
+	}
+
+	public double getParam1() {
+		return param1;
+	}
+
+	public void setParam1(double param1) {
+		this.param1 = param1;
+	}
+
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/FeatureParentChild.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/FeatureParentChild.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/FeatureParentChild.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/FeatureParentChild.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,31 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+import java.io.Serializable;
+
+public class FeatureParentChild implements Serializable {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	FeatureRank featureRankChild;
+	FeatureRank featureRankParent;
+	int featureParentChildId;
+	public FeatureRank getFeatureRankChild() {
+		return featureRankChild;
+	}
+	public void setFeatureRankChild(FeatureRank featureRankChild) {
+		this.featureRankChild = featureRankChild;
+	}
+	public FeatureRank getFeatureRankParent() {
+		return featureRankParent;
+	}
+	public void setFeatureRankParent(FeatureRank featureRankParent) {
+		this.featureRankParent = featureRankParent;
+	}
+	public int getFeatureParentChildId() {
+		return featureParentChildId;
+	}
+	public void setFeatureParentChildId(int featureParentChildId) {
+		this.featureParentChildId = featureParentChildId;
+	}
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/FeatureRank.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/FeatureRank.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/FeatureRank.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/FeatureRank.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,144 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+public class FeatureRank implements Serializable {
+	
+	/**
+	 * sort the features, set the rank correspondingly.  
+	 * @param featureRankList
+	 * @param comp
+	 * @return return the original list, but sorted
+	 */
+	public static List<FeatureRank> sortFeatureRankList(List<FeatureRank> featureRankList, Comparator<FeatureRank> comp) {
+		Collections.sort(featureRankList, comp);
+		for (int i = 0; i < featureRankList.size(); i++) {
+			featureRankList.get(i).setRank(i + 1);
+		}
+		return featureRankList;
+	}
+	
+	/**
+	 * Sort features by ascending evaluation score
+	 * 
+	 * @author vijay
+	 * 
+	 */
+	public static class FeatureRankAsc implements Comparator<FeatureRank> {
+
+		@Override
+		public int compare(FeatureRank o1, FeatureRank o2) {
+			if (o1.getEvaluation() > o2.getEvaluation()) {
+				return 1;
+			} else if (o1.getEvaluation() == o2.getEvaluation()) {
+				return o1.getFeatureName().compareTo(o2.getFeatureName());
+			} else {
+				return -1;
+			}
+		}
+	}
+
+	/**
+	 * Sort features by descending evaluation score if two features have the
+	 * same score, order them by name
+	 * 
+	 * @author vijay
+	 * 
+	 */
+	public static class FeatureRankDesc implements Comparator<FeatureRank> {
+
+		@Override
+		public int compare(FeatureRank o1, FeatureRank o2) {
+			if (o1.getEvaluation() > o2.getEvaluation()) {
+				return -1;
+			} else if (o1.getEvaluation() == o2.getEvaluation()) {
+				return o1.getFeatureName().compareTo(o2.getFeatureName());
+			} else {
+				return 1;
+			}
+		}
+	}
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	private double evaluation;
+
+	private FeatureEvaluation featureEval;
+	private String featureName;
+	private int rank;
+	private int featureRankId;
+
+	public int getFeatureRankId() {
+		return featureRankId;
+	}
+
+	public void setFeatureRankId(int featureRankId) {
+		this.featureRankId = featureRankId;
+	}
+
+	public FeatureRank() {
+	}
+
+	public FeatureRank(String featureName, double evaluation) {
+		this.featureName = featureName;
+		this.evaluation = evaluation;
+	}
+
+	public FeatureRank(FeatureEvaluation featureEval, String featureName,
+			double evaluation) {
+		this.featureEval = featureEval;
+		this.featureName = featureName;
+		this.evaluation = evaluation;
+	}
+	public FeatureRank(FeatureEvaluation featureEval, String featureName,
+			double evaluation, int rank) {
+		this.featureEval = featureEval;
+		this.featureName = featureName;
+		this.evaluation = evaluation;
+		this.rank = rank;
+	}	
+
+	public double getEvaluation() {
+		return evaluation;
+	}
+
+	public FeatureEvaluation getFeatureEval() {
+		return featureEval;
+	}
+
+	public String getFeatureName() {
+		return featureName;
+	}
+
+	public int getRank() {
+		return rank;
+	}
+
+	public void setEvaluation(double evaluation) {
+		this.evaluation = evaluation;
+	}
+
+	public void setFeatureEval(FeatureEvaluation featureEval) {
+		this.featureEval = featureEval;
+	}
+
+	public void setFeatureName(String featureName) {
+		this.featureName = featureName;
+	}
+
+	public void setRank(int rank) {
+		this.rank = rank;
+	}
+
+	@Override
+	public String toString() {
+		return "FeatureRank [featureName=" + featureName + ", evaluation="
+				+ evaluation + ", rank=" + rank + "]";
+	}
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/KernelEvaluation.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/KernelEvaluation.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/KernelEvaluation.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/KernelEvaluation.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,77 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+import java.io.Serializable;
+
+import org.apache.ctakes.ytex.dao.DBUtil;
+
+
+public class KernelEvaluation implements Serializable {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	private int kernelEvaluationId;
+	private String corpusName;
+	private String label = DBUtil.getEmptyString();
+	private String experiment = DBUtil.getEmptyString();
+	private int foldId;
+	private double param1 = 0;
+	private String param2 = DBUtil.getEmptyString();
+
+	public double getParam1() {
+		return param1;
+	}
+
+	public void setParam1(double param1) {
+		this.param1 = param1;
+	}
+
+	public String getParam2() {
+		return param2;
+	}
+
+	public void setParam2(String param2) {
+		this.param2 = param2;
+	}
+
+	public int getKernelEvaluationId() {
+		return kernelEvaluationId;
+	}
+
+	public void setKernelEvaluationId(int kernelEvaluationId) {
+		this.kernelEvaluationId = kernelEvaluationId;
+	}
+
+	public String getCorpusName() {
+		return corpusName;
+	}
+
+	public void setCorpusName(String name) {
+		this.corpusName = name;
+	}
+
+	public String getLabel() {
+		return label;
+	}
+
+	public void setLabel(String label) {
+		this.label = label;
+	}
+
+	public String getExperiment() {
+		return experiment;
+	}
+
+	public void setExperiment(String experiment) {
+		this.experiment = experiment;
+	}
+
+	public int getFoldId() {
+		return foldId;
+	}
+
+	public void setFoldId(int foldId) {
+		this.foldId = foldId;
+	}
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/KernelEvaluationInstance.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/KernelEvaluationInstance.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/KernelEvaluationInstance.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/KernelEvaluationInstance.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,97 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+import java.io.Serializable;
+
+/**
+ * Although there is a many-to-one relationship the KernelEvaluation, we don't
+ * model that here - we just use the id so we can batch insert the
+ * kernelEvaluations.
+ */
+public class KernelEvaluationInstance implements Serializable {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	private long instanceId1;
+	private long instanceId2;
+
+	private int kernelEvaluationId;
+
+	private double similarity;
+
+	public KernelEvaluationInstance() {
+		super();
+	}
+
+	public KernelEvaluationInstance(int kernelEvaluationId, long instanceId1,
+			long instanceId2, double similarity) {
+		super();
+		this.kernelEvaluationId = kernelEvaluationId;
+		this.instanceId1 = instanceId1;
+		this.instanceId2 = instanceId2;
+		this.similarity = similarity;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result + (int) (instanceId1 ^ (instanceId1 >>> 32));
+		result = prime * result + (int) (instanceId2 ^ (instanceId2 >>> 32));
+		result = prime * result + kernelEvaluationId;
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		KernelEvaluationInstance other = (KernelEvaluationInstance) obj;
+		if (instanceId1 != other.instanceId1)
+			return false;
+		if (instanceId2 != other.instanceId2)
+			return false;
+		if (kernelEvaluationId != other.kernelEvaluationId)
+			return false;
+		return true;
+	}
+
+	public long getInstanceId1() {
+		return instanceId1;
+	}
+
+	public long getInstanceId2() {
+		return instanceId2;
+	}
+
+	public int getKernelEvaluationId() {
+		return kernelEvaluationId;
+	}
+
+	public double getSimilarity() {
+		return similarity;
+	}
+
+	
+
+	public void setInstanceId1(long instanceId1) {
+		this.instanceId1 = instanceId1;
+	}
+
+	public void setInstanceId2(long instanceId2) {
+		this.instanceId2 = instanceId2;
+	}
+
+	public void setKernelEvaluationId(int kernelEvaluationId) {
+		this.kernelEvaluationId = kernelEvaluationId;
+	}
+
+	public void setSimilarity(double similarity) {
+		this.similarity = similarity;
+	}
+
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ObjPair.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ObjPair.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ObjPair.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/ObjPair.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,16 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+public class ObjPair<T1 extends Object, T2 extends Object> {
+	@Override
+	public String toString() {
+		return "ObjPair [v1=" + v1 + ", v2=" + v2 + "]";
+	}
+
+	public T1 v1;
+	public T2 v2;
+
+	public ObjPair(T1 v1, T2 v2) {
+		this.v1 = v1;
+		this.v2 = v2;
+	}
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/SVMClassifierEvaluation.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/SVMClassifierEvaluation.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/SVMClassifierEvaluation.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/SVMClassifierEvaluation.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,59 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+public class SVMClassifierEvaluation extends ClassifierEvaluation {
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	Double cost;
+	String weight;
+	Integer degree;
+	Double gamma;
+	Integer kernel;
+	Integer supportVectors;
+	Double vcdim;
+	
+	public Double getVcdim() {
+		return vcdim;
+	}
+	public void setVcdim(Double vcdim) {
+		this.vcdim = vcdim;
+	}
+	public Double getCost() {
+		return cost;
+	}
+	public void setCost(Double cost) {
+		this.cost = cost;
+	}
+	public String getWeight() {
+		return weight;
+	}
+	public void setWeight(String weight) {
+		this.weight = weight;
+	}
+	public Integer getDegree() {
+		return degree;
+	}
+	public void setDegree(Integer degree) {
+		this.degree = degree;
+	}
+	public Double getGamma() {
+		return gamma;
+	}
+	public void setGamma(Double gamma) {
+		this.gamma = gamma;
+	}
+	public Integer getKernel() {
+		return kernel;
+	}
+	public void setKernel(Integer kernel) {
+		this.kernel = kernel;
+	}
+	public Integer getSupportVectors() {
+		return supportVectors;
+	}
+	public void setSupportVectors(Integer supportVectors) {
+		this.supportVectors = supportVectors;
+	}
+
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/SemiLClassifierEvaluation.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/SemiLClassifierEvaluation.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/SemiLClassifierEvaluation.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/model/SemiLClassifierEvaluation.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,83 @@
+package org.apache.ctakes.ytex.kernel.model;
+
+public class SemiLClassifierEvaluation extends ClassifierEvaluation {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	String distance;
+
+	int degree;
+	boolean softLabel;
+	boolean normalizedLaplacian;
+	double mu;
+	double lambda;
+	double gamma;
+	double percentLabeled;
+
+	public String getDistance() {
+		return distance;
+	}
+
+	public void setDistance(String distance) {
+		this.distance = distance;
+	}
+
+	public int getDegree() {
+		return degree;
+	}
+
+	public void setDegree(int degree) {
+		this.degree = degree;
+	}
+
+	public boolean isSoftLabel() {
+		return softLabel;
+	}
+
+	public void setSoftLabel(boolean softLabel) {
+		this.softLabel = softLabel;
+	}
+
+	public boolean isNormalizedLaplacian() {
+		return normalizedLaplacian;
+	}
+
+	public void setNormalizedLaplacian(boolean normalizedLaplacian) {
+		this.normalizedLaplacian = normalizedLaplacian;
+	}
+
+	public double getMu() {
+		return mu;
+	}
+
+	public void setMu(double mu) {
+		this.mu = mu;
+	}
+
+	public double getLambda() {
+		return lambda;
+	}
+
+	public void setLambda(double lambda) {
+		this.lambda = lambda;
+	}
+
+	public double getGamma() {
+		return gamma;
+	}
+
+	public void setGamma(double gamma) {
+		this.gamma = gamma;
+	}
+
+	public double getPercentLabeled() {
+		return percentLabeled;
+	}
+
+	public void setPercentLabeled(double percentLabeled) {
+		this.percentLabeled = percentLabeled;
+	}
+}

Added: ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/pagerank/PageRankService.java
URL: http://svn.apache.org/viewvc/ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/pagerank/PageRankService.java?rev=1551254&view=auto
==============================================================================
--- ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/pagerank/PageRankService.java (added)
+++ ctakes/branches/ytex/ctakes-ytex/src/main/java/org/apache/ctakes/ytex/kernel/pagerank/PageRankService.java Mon Dec 16 16:30:30 2013
@@ -0,0 +1,46 @@
+package org.apache.ctakes.ytex.kernel.pagerank;
+
+import java.util.Map;
+
+import org.apache.ctakes.ytex.kernel.model.ConceptGraph;
+
+
+public interface PageRankService {
+
+	/**
+	 * PageRank for conceptGraph. Page = concept. in-links = parents. out-links
+	 * = children.
+	 * 
+	 * @param dampingVector
+	 *            topic vector/personalized pagerank vector. If null will use
+	 *            normal pagerank with a damping vector where every value is 1/N
+	 * @param cg
+	 *            concept graph
+	 * @param iter
+	 *            max number of iterations
+	 * @param threshold
+	 *            convergence threshold
+	 * @param dampingFactor
+	 * @return pageRank 'vector'. key = concept (page), value = rank
+	 */
+	public abstract double[] rank(Map<String, Double> dampingVector,
+			ConceptGraph cg, int iter, double threshold, double dampingFactor);
+
+	/**
+	 * call rank() with default values for iter (30), threshold(1e-4),
+	 * dampingFactor(0.85)
+	 * 
+	 * @param dampingVector
+	 * @param cg
+	 * @return
+	 */
+	public abstract double[] rank(Map<String, Double> dampingVector,
+			ConceptGraph cg);
+
+	public abstract double sim(String concept1, String concept2, ConceptGraph cg,
+			int iter, double threshold, double dampingFactor);
+
+	public abstract double[] rank2(Map<Integer, Double> dampingVector, ConceptGraph cg, int iter,
+			double threshold, double dampingFactor);
+
+}
\ No newline at end of file



Mime
View raw message