@Override public SequenceModel getSequenceModel(List<IN> doc) { Triple<int[][][], int[], double[][][]> p = documentToDataAndLabels(doc); return getSequenceModel(p, doc); }
@SuppressWarnings("WeakerAccess") public CRFCliqueTree<String> getCliqueTree(List<IN> document) { Triple<int[][][], int[], double[][][]> p = documentToDataAndLabels(document); return getCliqueTree(p); }
public List<IN> classifyGibbs(List<IN> document) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { Triple<int[][][], int[], double[][][]> p = documentToDataAndLabels(document); return classifyGibbs(document, p); }
/** * Convert an ObjectBank to corresponding collection of data features and * labels. This version is used at test time. * * @return A List of pairs, one for each document, where the first element is * an int[][][] representing the data and the second element is an * int[] representing the labels. */ public List<Triple<int[][][], int[], double[][][]>> documentsToDataAndLabelsList(Collection<List<IN>> documents) { int numDatums = 0; List<Triple<int[][][], int[], double[][][]>> docList = new ArrayList<>(); for (List<IN> doc : documents) { Triple<int[][][], int[], double[][][]> docTriple = documentToDataAndLabels(doc); docList.add(docTriple); numDatums += doc.size(); } log.info("numClasses: " + classIndex.size() + ' ' + classIndex); log.info("numDocuments: " + docList.size()); log.info("numDatums: " + numDatums); log.info("numFeatures: " + featureIndex.size()); return docList; }
public List<Counter<String>> zeroOrderProbabilities(List<IN> document) { List<Counter<String>> ret = new ArrayList<>(); Triple<int[][][], int[], double[][][]> p = documentToDataAndLabels(document); CRFCliqueTree<String> cliqueTree = getCliqueTree(p); for (int i = 0; i < cliqueTree.length(); i++) { Counter<String> ctr = new ClassicCounter<>(); for (String label : classIndex) { int index = classIndex.indexOf(label); double prob = cliqueTree.prob(i, index); ctr.setCount(label, prob); } ret.add(ctr); } return ret; }
Triple<int[][][], int[], double[][][]> docTriple = documentToDataAndLabels(doc); data.add(docTriple.first()); labels.add(docTriple.second());
@Override public Triple<int[][][], int[], double[][][]> documentToDataAndLabels(List<IN> document) { Triple<int[][][], int[], double[][][]> result = super.documentToDataAndLabels(document); int[][][] data = result.first(); data = transformDocData(data); return new Triple<>(data, result.second(), result.third()); }
boolean verbose = flags.verboseMode; Triple<int[][][], int[], double[][][]> p = documentToDataAndLabels(document); CRFCliqueTree<String> cliqueTree = getCliqueTree(p);
@Override public SequenceModel getSequenceModel(List<IN> doc) { Triple<int[][][], int[], double[][][]> p = documentToDataAndLabels(doc); return getSequenceModel(p, doc); }
public List<IN> classifyGibbs(List<IN> document) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { Triple<int[][][], int[], double[][][]> p = documentToDataAndLabels(document); return classifyGibbs(document, p); }
@Override public SequenceModel getSequenceModel(List<IN> doc) { Triple<int[][][], int[], double[][][]> p = documentToDataAndLabels(doc); return getSequenceModel(p, doc); }
public List<IN> classifyGibbs(List<IN> document) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { Triple<int[][][], int[], double[][][]> p = documentToDataAndLabels(document); return classifyGibbs(document, p); }
@Override public SequenceModel getSequenceModel(List<IN> doc) { Pair<int[][][],int[]> p = documentToDataAndLabels(doc); return getSequenceModel(doc, p); }
public List<IN> classifyGibbs(List<IN> document) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException { Pair<int[][][],int[]> p = documentToDataAndLabels(document); return classifyGibbs(document, p); }
@SuppressWarnings("WeakerAccess") public CRFCliqueTree<String> getCliqueTree(List<IN> document) { Triple<int[][][], int[], double[][][]> p = documentToDataAndLabels(document); return getCliqueTree(p); }
public CRFCliqueTree<String> getCliqueTree(List<IN> document) { Triple<int[][][], int[], double[][][]> p = documentToDataAndLabels(document); return getCliqueTree(p); }
private CRFCliqueTree getCliqueTree(List<IN> document) { Pair<int[][][],int[]> p = documentToDataAndLabels(document); int[][][] data = p.first(); //FactorTable[] factorTables = CRFLogConditionalObjectiveFunction.getCalibratedCliqueTree(weights, data, labelIndices, classIndex.size()); return CRFCliqueTree.getCalibratedCliqueTree(weights, data, labelIndices, classIndex.size(), classIndex, flags.backgroundSymbol); }
public List<Counter<String>> zeroOrderProbabilities(List<IN> document) { List<Counter<String>> ret = new ArrayList<>(); Triple<int[][][], int[], double[][][]> p = documentToDataAndLabels(document); CRFCliqueTree<String> cliqueTree = getCliqueTree(p); for (int i = 0; i < cliqueTree.length(); i++) { Counter<String> ctr = new ClassicCounter<>(); for (String label : classIndex) { int index = classIndex.indexOf(label); double prob = cliqueTree.prob(i, index); ctr.setCount(label, prob); } ret.add(ctr); } return ret; }
@Override public Triple<int[][][], int[], double[][][]> documentToDataAndLabels(List<IN> document) { Triple<int[][][], int[], double[][][]> result = super.documentToDataAndLabels(document); int[][][] data = result.first(); data = transformDocData(data); return new Triple<>(data, result.second(), result.third()); }
@Override public Triple<int[][][], int[], double[][][]> documentToDataAndLabels(List<IN> document) { Triple<int[][][], int[], double[][][]> result = super.documentToDataAndLabels(document); int[][][] data = result.first(); data = transformDocData(data); return new Triple<int[][][], int[], double[][][]>(data, result.second(), result.third()); }