edu.isi.karma.modeling.semantictypes.crfmodelhandler
Class CRFModelHandlerOld

java.lang.Object
  extended by edu.isi.karma.modeling.semantictypes.crfmodelhandler.CRFModelHandlerOld

public class CRFModelHandlerOld
extends java.lang.Object


Nested Class Summary
static class CRFModelHandlerOld.ColumnFeature
           
 
Method Summary
static boolean addOrUpdateLabel(java.lang.String label, java.util.List<java.lang.String> examples, java.util.Map<CRFModelHandlerOld.ColumnFeature,java.util.Collection<java.lang.String>> columnFeatures)
           
static boolean getExamplesForLabel(java.lang.String label, java.util.ArrayList<java.lang.String> examples)
           
static boolean getLabels(java.util.List<java.lang.String> labels)
           
static boolean getWeightedFeatureFunctionSums(java.lang.String example, java.util.Map<CRFModelHandlerOld.ColumnFeature,java.util.Collection<java.lang.String>> columnFeatures, java.util.List<java.lang.Double> sums)
           
static boolean predictLabelForExamples(java.util.List<java.lang.String> examples, int numPredictions, java.util.List<java.lang.String> predictedLabels, java.util.List<java.lang.Double> confidenceScores, java.util.List<double[]> exampleProbabilities, java.util.Map<CRFModelHandlerOld.ColumnFeature,java.util.Collection<java.lang.String>> columnFeatures)
           
static boolean readModelFromFile(java.lang.String file)
           
static boolean removeAllLabels()
           
static boolean removeLabel(java.lang.String label)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addOrUpdateLabel

public static boolean addOrUpdateLabel(java.lang.String label,
                                       java.util.List<java.lang.String> examples,
                                       java.util.Map<CRFModelHandlerOld.ColumnFeature,java.util.Collection<java.lang.String>> columnFeatures)
Parameters:
label - True label
examples - list of examples
columnFeatures - List of column features
Returns:
True if success, else False

getExamplesForLabel

public static boolean getExamplesForLabel(java.lang.String label,
                                          java.util.ArrayList<java.lang.String> examples)
Parameters:
label - - the label for which examples are being requested
examples - - the list argument that will contain all the examples of the supplied label in the model.
Returns:

getLabels

public static boolean getLabels(java.util.List<java.lang.String> labels)
Parameters:
labels, - the ordered list of labels is returned in this argument
Returns:

getWeightedFeatureFunctionSums

public static boolean getWeightedFeatureFunctionSums(java.lang.String example,
                                                     java.util.Map<CRFModelHandlerOld.ColumnFeature,java.util.Collection<java.lang.String>> columnFeatures,
                                                     java.util.List<java.lang.Double> sums)

predictLabelForExamples

public static boolean predictLabelForExamples(java.util.List<java.lang.String> examples,
                                              int numPredictions,
                                              java.util.List<java.lang.String> predictedLabels,
                                              java.util.List<java.lang.Double> confidenceScores,
                                              java.util.List<double[]> exampleProbabilities,
                                              java.util.Map<CRFModelHandlerOld.ColumnFeature,java.util.Collection<java.lang.String>> columnFeatures)
Parameters:
examples - - list of examples of an unknown type
numPredictions - - required number of predictions in descending order
predictedLabels - - the argument in which the ordered list of labels is returned. the size of this list could be smaller than numPredictions if there aren't that many labels in the model already
confidenceScores - - the probability of the examples belonging to the labels returned.
exampleProbabilities - - the size() == examples.size(). It contains, for each example, in the same order, a double array that contains the probability of belonging to the labels returned in predictedLabels.
columnFeatures - - this Map supplies ColumnFeatures such as ColumnName, etc.
Returns:

readModelFromFile

public static boolean readModelFromFile(java.lang.String file)

removeAllLabels

public static boolean removeAllLabels()

removeLabel

public static boolean removeLabel(java.lang.String label)