
cc.mallet.classify.constraints.ge.MaxEntGEConstraint Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jcore-mallet-2.0.9 Show documentation
Show all versions of jcore-mallet-2.0.9 Show documentation
MALLET is a Java-based package for statistical natural language processing, document classification, clustering, topic modeling, information extraction, and other machine learning applications to text.
The newest version!
/* Copyright (C) 2011 Univ. of Massachusetts Amherst, Computer Science Dept.
This file is part of "MALLET" (MAchine Learning for LanguagE Toolkit).
http://www.cs.umass.edu/~mccallum/mallet
This software is provided under the terms of the Common Public License,
version 1.0, as published by http://www.opensource.org. For further
information, see the file `LICENSE' included with this distribution. */
package cc.mallet.classify.constraints.ge;
import java.util.BitSet;
import cc.mallet.types.FeatureVector;
import cc.mallet.types.InstanceList;
/**
* Interface for expectation constraints for use with Generalized Expectation (GE).
*
* @author Gregory Druck
*/
public interface MaxEntGEConstraint {
/**
* Computes the composite constraint feature value
* (over all constraint features) for FeatureVector fv
* and label label.
*
* @param input input FeatureVector
* @param label output label index
* @return Constraint feature value
*/
double getCompositeConstraintFeatureValue(FeatureVector input, int label);
/**
* Returns the total constraint value.
*
* @return Constraint value
*/
double getValue();
/**
* Compute expectations using provided distribution over labels.
*
* @param fv FeatureVector
* @param dist Distribution over labels
* @param data Unlabeled data
*/
void computeExpectations(FeatureVector fv, double[] dist, double weight);
/**
* Zero expectation values. Called before re-computing gradient.
*/
void zeroExpectations();
/**
* @param data Unlabeled data
* @return Returns a bitset of the size of the data, with the bit set if
* a constraint feature fires in that instance.
*/
BitSet preProcess(InstanceList data);
/**
* Gives the constraint the option to do some caching
* using only the FeatureVector. For example, the
* constrained input features could be cached.
*
* @param input FeatureVector input
*/
void preProcess(FeatureVector input);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy