public class FFRTargetCostFunction extends Object implements TargetCostFunction
| Modifier and Type | Class and Description |
|---|---|
class |
FFRTargetCostFunction.TargetCostReporter |
| Modifier and Type | Field and Description |
|---|---|
protected double[] |
cumulWeightedCosts |
protected boolean |
debugShowCostGraph |
protected FeatureDefinition |
featureDefinition |
protected FeatureVector[] |
featureVectors |
protected int |
nCostComputations |
protected TargetFeatureComputer |
targetFeatureComputer |
protected WeightFunc[] |
weightFunction |
protected boolean[] |
weightsNonZero |
| Constructor and Description |
|---|
FFRTargetCostFunction() |
| Modifier and Type | Method and Description |
|---|---|
void |
computeTargetFeatures(Target target)
Compute the features for a given target, and store them in the target.
|
double |
cost(Target target,
Unit unit)
Compute the goodness-of-fit of a given unit for a given target.
|
protected double |
cost(Target target,
Unit unit,
FeatureDefinition weights,
WeightFunc[] weightFunctions) |
double |
featureCost(Target target,
Unit unit,
String featureName)
Compute the goodness-of-fit between given unit and given target for a given feature
|
protected double |
featureCost(Target target,
Unit unit,
String featureName,
FeatureDefinition weights,
WeightFunc[] weightFunctions) |
String |
getFeature(Unit unit,
String featureName)
Get the string representation of the feature value associated with the given unit
|
FeatureDefinition |
getFeatureDefinition()
Provide access to the Feature Definition used.
|
FeatureVector |
getFeatureVector(Unit unit)
Look up the features for a given unit.
|
FeatureVector[] |
getFeatureVectors()
Get all feature vectors.
|
void |
load(FeatureFileReader ffr,
InputStream weightsStream,
FeatureProcessorManager featProc)
Initialise the data needed to do a target cost computation.
|
void |
load(String featureFileName,
InputStream weightsStream,
FeatureProcessorManager featProc)
Initialise the data needed to do a target cost computation.
|
protected void |
rememberWhichWeightsAreNonZero() |
protected WeightFunc[] weightFunction
protected TargetFeatureComputer targetFeatureComputer
protected FeatureVector[] featureVectors
protected FeatureDefinition featureDefinition
protected boolean[] weightsNonZero
protected boolean debugShowCostGraph
protected double[] cumulWeightedCosts
protected int nCostComputations
public double cost(Target target, Unit unit)
cost in interface TargetCostFunctiontarget - targetunit - unitprotected double cost(Target target, Unit unit, FeatureDefinition weights, WeightFunc[] weightFunctions)
public double featureCost(Target target, Unit unit, String featureName)
target - target unitunit - candidate unitfeatureName - feature nameIllegalArgumentException - if featureName not available in featureDefinitionprotected double featureCost(Target target, Unit unit, String featureName, FeatureDefinition weights, WeightFunc[] weightFunctions)
public void load(String featureFileName, InputStream weightsStream, FeatureProcessorManager featProc) throws IOException, MaryConfigurationException
load in interface TargetCostFunctionfeatureFileName - name of a file containing the unit featuresweightsStream - an optional weights file -- if non-null, contains feature weights that override the ones present in the feature
file.featProc - a feature processor manager which can provide feature processors to compute the features for a target at run
timeIOException - IOExceptionMaryConfigurationException - MaryConfigurationExceptionpublic void load(FeatureFileReader ffr, InputStream weightsStream, FeatureProcessorManager featProc) throws IOException
TargetCostFunctionload in interface TargetCostFunctionffr - a reader for the file containing the unit featuresweightsStream - an optional weights file -- if non-null, contains feature weights that override the ones present in the feature
file.featProc - a feature processor manager which can provide feature processors to compute the features for a target at run
timeIOException - IOExceptionprotected void rememberWhichWeightsAreNonZero()
public void computeTargetFeatures(Target target)
computeTargetFeatures in interface TargetCostFunctiontarget - the target for which to compute the featuresTarget.getFeatureVector()public FeatureVector getFeatureVector(Unit unit)
getFeatureVector in interface TargetCostFunctionunit - a unit in the databasepublic String getFeature(Unit unit, String featureName)
getFeature in interface TargetCostFunctionunit - the unit whose feature value is requestedfeatureName - name of the feature requestedIllegalArgumentException - if featureName is not a known featurepublic FeatureDefinition getFeatureDefinition()
TargetCostFunctiongetFeatureDefinition in interface TargetCostFunctionpublic FeatureVector[] getFeatureVectors()
TargetCostFunctiongetFeatureVectors in interface TargetCostFunctionCopyright © 2000–2016 DFKI GmbH. All rights reserved.