public Classification[] classify (Instance[] instances) { Classification[] ret = new Classification[instances.length]; for (int i = 0; i < instances.length; i++) ret[i] = classify (instances[i]); return ret; }
public Classification[] classify (Instance[] instances) { Classification[] ret = new Classification[instances.length]; for (int i = 0; i < instances.length; i++) ret[i] = classify (instances[i]); return ret; }
public ArrayList<Classification> classify (InstanceList instances) { ArrayList<Classification> ret = new ArrayList<Classification> (instances.size()); for (Instance inst : instances) ret.add (classify (inst)); return ret; }
public ArrayList<Classification> classify (InstanceList instances) { ArrayList<Classification> ret = new ArrayList<Classification> (instances.size()); for (Instance inst : instances) ret.add (classify (inst)); return ret; }
public ArrayList<Classification> classify (InstanceList instances) { ArrayList<Classification> ret = new ArrayList<Classification> (instances.size()); for (Instance inst : instances) ret.add (classify (inst)); return ret; }
public Trial (Classifier c, InstanceList ilist) { super (ilist.size()); this.classifier = c; for (Instance instance : ilist) this.add (c.classify (instance)); }
public List<RerankerResult> probabilities(List<RerankExample> ex) { Classification classify = model.classify(ex); LabelVector labeling = (LabelVector) classify.getLabeling(); List<RerankerResult> result = Lists.newArrayListWithCapacity(ex.size()); for (int i = 0; i < ex.size(); i++) { Label rankLabel = labeling.getLabelAlphabet().lookupLabel(Integer.toString(i)); result.add(new RerankerResult(ex.get(i), labeling.value(rankLabel))); } Collections.sort(result, Ordering.<RerankerResult>natural().reverse()); return result; }
public Trial (Classifier c, InstanceList ilist) { super (ilist.size()); this.classifier = c; for (Instance instance : ilist) this.add (c.classify (instance)); }
/** * Compute the maxent classification of an instance. * * @param classifier the classifier * @param features the features that are on for this instance * @return the classification */ static public Classification classify(Classifier classifier, String[] features) { return classifier.classify( new Instance(new TokenSequence(features), null, null, null)); }
/** * Compute the maxent classification of an instance. * * @param classifier the classifier * @param features the features that are on for this instance * @return the classification */ static public Classification classify(Classifier classifier, String[] features) { return classifier.classify( new Instance(new TokenSequence(features), null, null, null)); }
/** * Compute the maxent classification of an instance. * * @param classifier the classifier * @param features the features that are on for this instance * @return the classification */ static public Classification classify(Classifier classifier, String[] features) { return classifier.classify( new Instance(new TokenSequence(features), null, null, null)); }
public OUTCOME_TYPE classify(List<Feature> features) throws CleartkProcessingException { Classification classification = classifier.classify(toInstance(features)); String returnValue = classification.getLabeling().getBestLabel().toString(); return outcomeEncoder.decode(returnValue); }
public OUTCOME_TYPE classify(List<Feature> features) throws CleartkProcessingException { Classification classification = classifier.classify(toInstance(features)); String returnValue = classification.getLabeling().getBestLabel().toString(); return outcomeEncoder.decode(returnValue); }
private double getScore (AgglomerativeNeighbor pwneighbor) { if (scoreCache == null) scoreCache = new PairwiseMatrix(pwneighbor.getOriginal().getNumInstances()); int[] indices = pwneighbor.getNewCluster(); if (scoreCache.get(indices[0], indices[1]) == 0.0) { scoreCache.set(indices[0], indices[1], classifier.classify(pwneighbor).getLabelVector().value(scoringLabel)); } return scoreCache.get(indices[0], indices[1]); }
private double getScore (AgglomerativeNeighbor pwneighbor) { if (scoreCache == null) scoreCache = new PairwiseMatrix(pwneighbor.getOriginal().getNumInstances()); int[] indices = pwneighbor.getNewCluster(); if (scoreCache.get(indices[0], indices[1]) == 0.0) { scoreCache.set(indices[0], indices[1], classifier.classify(pwneighbor).getLabelVector().value(scoringLabel)); } return scoreCache.get(indices[0], indices[1]); }
private double getScore (AgglomerativeNeighbor pwneighbor) { if (scoreCache == null) scoreCache = new PairwiseMatrix(pwneighbor.getOriginal().getNumInstances()); int[] indices = pwneighbor.getNewCluster(); if (scoreCache.get(indices[0], indices[1]) == 0.0) { scoreCache.set(indices[0], indices[1], classifier.classify(pwneighbor).getLabelVector().value(scoringLabel)); } return scoreCache.get(indices[0], indices[1]); }
@Override protected void doProcess(JCas jCas) throws AnalysisEngineProcessException { InstanceList instances = new InstanceList(classifierModel.getInstancePipe()); instances.addThruPipe(new Instance(jCas.getDocumentText(), "", "from jcas", null)); Classification classify = classifierModel.classify(instances.get(0)); Metadata md = new Metadata(jCas); md.setKey(metadataKey); md.setValue(classify.getLabeling().getBestLabel().toString()); addToJCasIndex(md); }
@Override protected void doProcess(JCas jCas) throws AnalysisEngineProcessException { InstanceList instances = new InstanceList(classifierModel.getInstancePipe()); instances.addThruPipe(new Instance(jCas.getDocumentText(), "", "from jcas", null)); Classification classify = classifierModel.classify(instances.get(0)); Metadata md = new Metadata(jCas); md.setKey(metadataKey); md.setValue(classify.getLabeling().getBestLabel().toString()); addToJCasIndex(md); }