Documentation of 'smile.sequence.CRF' Java class
CRF
smile.sequence

Class CRF

  • All Implemented Interfaces:
    SequenceLabeler<double[]>


    public class CRF
    extends java.lang.Object
    implements SequenceLabeler<double[]>
    First-order linear conditional random field. A conditional random field is a type of discriminative undirected probabilistic graphical model. It is most often used for labeling or parsing of sequential data.

    A CRF is a Markov random field that was trained discriminatively. Therefore it is not necessary to model the distribution over always observed variables, which makes it possible to include arbitrarily complicated features of the observed variables into the model. This class implements an algorithm that trains CRFs via gradient tree boosting. In tree boosting, the CRF potential functions are represented as weighted sums of regression trees, which provide compact representations of feature interactions. So the algorithm does not explicitly consider the potentially large parameter space. As a result, gradient tree boosting scales linearly in the order of the Markov model and in the order of the feature interactions, rather than exponentially as in previous algorithms based on iterative scaling and gradient descent.

    References

    1. J. Lafferty, A. McCallum and F. Pereira. Conditional random fields: Probabilistic models for segmenting and labeling sequence data. ICML, 2001.
    2. Thomas G. Dietterich, Guohua Hao, and Adam Ashenfelter. Gradient Tree Boosting for Training Conditional Random Fields. JMLR, 2008.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class and Description
      static class  CRF.Trainer
      Trainer for CRF.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      double[] featureset(double[] features, int label)
      Returns a feature set with the class label of previous position.
      int[] featureset(int[] features, int label)
      Returns a feature set with the class label of previous position.
      boolean isViterbi()
      Returns true if using Viterbi algorithm for sequence labeling.
      int[] predict(double[][] x)
      Predicts the sequence labels.
      int[] predict(int[][] x) 
      CRF setViterbi(boolean viterbi)
      Sets if using Viterbi algorithm for sequence labeling.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • featureset

        public double[] featureset(double[] features,
                                   int label)
        Returns a feature set with the class label of previous position.
        Parameters:
        features - the indices of the nonzero features.
        label - the class label of previous position as a feature.
      • featureset

        public int[] featureset(int[] features,
                                int label)
        Returns a feature set with the class label of previous position.
        Parameters:
        features - the indices of the nonzero features.
        label - the class label of previous position as a feature.
      • isViterbi

        public boolean isViterbi()
        Returns true if using Viterbi algorithm for sequence labeling.
      • setViterbi

        public CRF setViterbi(boolean viterbi)
        Sets if using Viterbi algorithm for sequence labeling. Viterbi algorithm returns the whole sequence label that has the maximum probability, which makes sense in applications (e.g.part-of-speech tagging) that require coherent sequential labeling. The forward-backward algorithm labels a sequence by individual prediction on each position. This usually produces better accuracy although the results may not be coherent.
      • predict

        public int[] predict(double[][] x)
        Description copied from interface: SequenceLabeler
        Predicts the sequence labels.
        Specified by:
        predict in interface SequenceLabeler<double[]>
        Parameters:
        x - a sequence. At each position, it may be the original symbol or a feature set about the symbol, its neighborhood, and/or other information.
        Returns:
        the predicted sequence labels.
      • predict

        public int[] predict(int[][] x)

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.