Class MaxEntFLGEConstraints

    • Field Detail

      • useValues

        protected boolean useValues
      • numLabels

        protected int numLabels
      • numFeatures

        protected int numFeatures
      • indexCache

        protected com.carrotsearch.hppc.IntArrayList indexCache
      • valueCache

        protected com.carrotsearch.hppc.DoubleArrayList valueCache
    • Constructor Detail

      • MaxEntFLGEConstraints

        public MaxEntFLGEConstraints​(int numFeatures,
                                     int numLabels,
                                     boolean useValues)
    • Method Detail

      • addConstraint

        public abstract void addConstraint​(int fi,
                                           double[] ex,
                                           double weight)
      • getCompositeConstraintFeatureValue

        public double getCompositeConstraintFeatureValue​(FeatureVector input,
                                                         int label)
        Description copied from interface: MaxEntGEConstraint
        Computes the composite constraint feature value (over all constraint features) for FeatureVector fv and label label.
        Specified by:
        getCompositeConstraintFeatureValue in interface MaxEntGEConstraint
        Parameters:
        input - input FeatureVector
        label - output label index
        Returns:
        Constraint feature value
      • computeExpectations

        public void computeExpectations​(FeatureVector input,
                                        double[] dist,
                                        double weight)
        Description copied from interface: MaxEntGEConstraint
        Compute expectations using provided distribution over labels.
        Specified by:
        computeExpectations in interface MaxEntGEConstraint
        Parameters:
        input - FeatureVector
        dist - Distribution over labels
      • preProcess

        public java.util.BitSet preProcess​(InstanceList data)
        Specified by:
        preProcess in interface MaxEntGEConstraint
        Parameters:
        data - Unlabeled data
        Returns:
        Returns a bitset of the size of the data, with the bit set if a constraint feature fires in that instance.
      • preProcess

        public void preProcess​(FeatureVector input)
        Description copied from interface: MaxEntGEConstraint
        Gives the constraint the option to do some caching using only the FeatureVector. For example, the constrained input features could be cached.
        Specified by:
        preProcess in interface MaxEntGEConstraint
        Parameters:
        input - FeatureVector input