public abstract class SupportingModel extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
SupportingModel.AtomIndexes |
Modifier and Type | Field and Description |
---|---|
protected static String |
CONFIG_FEATURES |
protected static String |
CONFIG_LABELS |
protected static String |
CONFIG_MODEL |
protected static String |
DELIM |
protected int[] |
entityArgumentIndexes
The indexes of this predicate that compose the entity ID.
|
protected Map<String,Integer> |
entityIndexMapping
Map the ID for an entity to an index.
|
protected int[] |
labelArgumentIndexes
The indexes of this predicate that compose the label ID.
|
protected Map<String,Integer> |
labelIndexMapping
Map the ID for a label to its index in the output layer.
|
protected float[][] |
manualLabels
Labels manually set by the reasoner to use for fitting.
|
protected int |
numFeatures |
Constructor and Description |
---|
SupportingModel() |
Modifier and Type | Method and Description |
---|---|
abstract void |
fit()
Fit the model using values set through setLabel().
|
protected String |
getAtomIdentifier(RandomVariableAtom atom,
int[] argumentIndexes) |
protected String |
getAtomIdentifier(String[] stringArgs,
int[] argumentIndexes) |
protected SupportingModel.AtomIndexes |
getAtomIndexes(RandomVariableAtom atom) |
protected int |
getEntityIndex(RandomVariableAtom atom) |
protected int |
getLabelIndex(RandomVariableAtom atom) |
float |
getValue(RandomVariableAtom atom) |
abstract float |
getValue(RandomVariableAtom atom,
int entityIndex,
int labelIndex)
Get the value for the specified atom.
|
abstract void |
load(Map<String,String> config,
String relativeDir)
Load the model from some configuration (that may include paths).
|
protected float[][] |
loadFeatures(String path)
Load the file that maps entities to features.
|
protected void |
loadLabels(String path)
Load the file that defines the order that labels will appear.
|
protected static String |
makePath(String relativeDir,
String basePath)
Construct a path to the given file relative to the data file.
|
void |
resetLabels() |
abstract void |
run()
Run the model and store the result internally.
|
void |
setLabel(RandomVariableAtom atom,
float labelValue) |
protected static final String DELIM
protected static final String CONFIG_FEATURES
protected static final String CONFIG_LABELS
protected static final String CONFIG_MODEL
protected int[] entityArgumentIndexes
protected int[] labelArgumentIndexes
protected Map<String,Integer> entityIndexMapping
protected Map<String,Integer> labelIndexMapping
protected int numFeatures
protected float[][] manualLabels
public abstract void load(Map<String,String> config, String relativeDir)
public abstract float getValue(RandomVariableAtom atom, int entityIndex, int labelIndex)
public abstract void run()
public abstract void fit()
public float getValue(RandomVariableAtom atom)
public void resetLabels()
public void setLabel(RandomVariableAtom atom, float labelValue)
protected void loadLabels(String path)
protected float[][] loadFeatures(String path)
protected SupportingModel.AtomIndexes getAtomIndexes(RandomVariableAtom atom)
protected int getEntityIndex(RandomVariableAtom atom)
protected int getLabelIndex(RandomVariableAtom atom)
protected String getAtomIdentifier(RandomVariableAtom atom, int[] argumentIndexes)
Copyright © 2020 University of California, Santa Cruz. All rights reserved.