public abstract class BaseSparseDataFormatter extends java.lang.Object implements SparseDataFormatter
Modifier and Type | Field and Description |
---|---|
protected java.util.Properties |
exportProperties
export properties - properties file that controls what to do for this
export
|
protected KernelUtil |
kernelUtil |
protected java.util.Map<java.lang.String, |
labelToClassIndexMap
map of label - [class name - class index]
|
protected int |
maxAttributeIndex
1-based attribute index
|
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> |
nominalAttributeMap
map of nominal attribute - [nominal attribute value - attribute index].
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
numericAttributeMap
map of numeric attribute - attribute index.
|
protected java.lang.String |
outdir
directory to export files to, with trailing separator added on if
necessary
|
ATTR_INSTANCE_ID, SCOPE, SCOPE_FOLD, SCOPE_LABEL
Constructor and Description |
---|
BaseSparseDataFormatter(KernelUtil kernelUtil) |
Modifier and Type | Method and Description |
---|---|
protected void |
addNumericAttribute(java.io.BufferedWriter w,
java.lang.String attributeName) |
protected int |
exportAttributeNames(java.io.BufferedWriter w,
SparseData sparseData)
assign indices to each attribute.
|
protected void |
exportAttributeNames(SparseData sparseData,
java.lang.String label,
java.lang.Integer run,
java.lang.Integer fold) |
protected void |
exportSparseMatrix(java.lang.String filename,
SparseData sparseData)
export sparse matrix data for use in matlab/R.
|
protected void |
exportSparseRow(SparseData bagOfWordsData,
long instanceId,
java.io.BufferedWriter wData,
int row) |
protected java.util.SortedMap<java.lang.Integer,java.lang.Double> |
getSparseLineValues(SparseData bagOfWordsData,
java.util.Map<java.lang.String,java.lang.Integer> numericAttributeMap,
java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> nominalAttributeMap,
long instanceId)
create a map of attribute index - attribute value for the given instance.
|
void |
initializeExport(InstanceData instanceLabel,
java.util.Properties properties,
SparseData sparseData)
get needed properties out of outdir.
|
protected void |
updateLabelClassMapTransductive()
add the 'unlabeled' class id to the classIndexMap if it isn't there
already
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearFold, clearLabel, exportFold, initializeFold, initializeLabel
protected KernelUtil kernelUtil
protected java.lang.String outdir
protected java.util.Map<java.lang.String,java.lang.Integer> numericAttributeMap
protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> nominalAttributeMap
protected java.util.Map<java.lang.String,> labelToClassIndexMap
protected int maxAttributeIndex
protected java.util.Properties exportProperties
public BaseSparseDataFormatter(KernelUtil kernelUtil)
protected void exportAttributeNames(SparseData sparseData, java.lang.String label, java.lang.Integer run, java.lang.Integer fold) throws java.io.IOException
java.io.IOException
protected int exportAttributeNames(java.io.BufferedWriter w, SparseData sparseData) throws java.io.IOException
outdir
- directory to write file tosparseData
- numericAttributeMap
- nominalAttributeMap
- for nominal indices, create an index for each value.java.io.IOException
protected void addNumericAttribute(java.io.BufferedWriter w, java.lang.String attributeName) throws java.io.IOException
java.io.IOException
protected java.util.SortedMap<java.lang.Integer,java.lang.Double> getSparseLineValues(SparseData bagOfWordsData, java.util.Map<java.lang.String,java.lang.Integer> numericAttributeMap, java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> nominalAttributeMap, long instanceId)
bagOfWordsData
- numericAttributeMap
- nominalAttributeMap
- instanceId
- protected void exportSparseRow(SparseData bagOfWordsData, long instanceId, java.io.BufferedWriter wData, int row) throws java.io.IOException
java.io.IOException
protected void exportSparseMatrix(java.lang.String filename, SparseData sparseData) throws java.io.IOException
java.io.IOException
public void initializeExport(InstanceData instanceLabel, java.util.Properties properties, SparseData sparseData) throws java.io.IOException
initializeExport
in interface SparseDataFormatter
java.io.IOException
protected void updateLabelClassMapTransductive()