public abstract class BaseSparseDataFormatter extends Object implements SparseDataFormatter
Modifier and Type | Field and Description |
---|---|
protected Properties |
exportProperties
export properties - properties file that controls what to do for this
export
|
protected KernelUtil |
kernelUtil |
protected Map<String,com.google.common.collect.BiMap<String,Integer>> |
labelToClassIndexMap
map of label - [class name - class index]
|
protected int |
maxAttributeIndex
1-based attribute index
|
protected Map<String,Map<String,Integer>> |
nominalAttributeMap
map of nominal attribute - [nominal attribute value - attribute index].
|
protected Map<String,Integer> |
numericAttributeMap
map of numeric attribute - attribute index.
|
protected 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(BufferedWriter w,
String attributeName) |
protected int |
exportAttributeNames(BufferedWriter w,
SparseData sparseData)
assign indices to each attribute.
|
protected void |
exportAttributeNames(SparseData sparseData,
String label,
Integer run,
Integer fold) |
protected void |
exportSparseMatrix(String filename,
SparseData sparseData)
export sparse matrix data for use in matlab/R.
|
protected void |
exportSparseRow(SparseData bagOfWordsData,
long instanceId,
BufferedWriter wData,
int row) |
protected SortedMap<Integer,Double> |
getSparseLineValues(SparseData bagOfWordsData,
Map<String,Integer> numericAttributeMap,
Map<String,Map<String,Integer>> nominalAttributeMap,
long instanceId)
create a map of attribute index - attribute value for the given instance.
|
void |
initializeExport(InstanceData instanceLabel,
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 String outdir
protected Map<String,Integer> numericAttributeMap
protected Map<String,Map<String,Integer>> nominalAttributeMap
protected Map<String,com.google.common.collect.BiMap<String,Integer>> labelToClassIndexMap
protected int maxAttributeIndex
protected Properties exportProperties
public BaseSparseDataFormatter(KernelUtil kernelUtil)
protected void exportAttributeNames(SparseData sparseData, String label, Integer run, Integer fold) throws IOException
IOException
protected int exportAttributeNames(BufferedWriter w, SparseData sparseData) throws IOException
outdir
- directory to write file tosparseData
- numericAttributeMap
- nominalAttributeMap
- for nominal indices, create an index for each value.IOException
protected void addNumericAttribute(BufferedWriter w, String attributeName) throws IOException
IOException
protected SortedMap<Integer,Double> getSparseLineValues(SparseData bagOfWordsData, Map<String,Integer> numericAttributeMap, Map<String,Map<String,Integer>> nominalAttributeMap, long instanceId)
bagOfWordsData
- numericAttributeMap
- nominalAttributeMap
- instanceId
- protected void exportSparseRow(SparseData bagOfWordsData, long instanceId, BufferedWriter wData, int row) throws IOException
IOException
protected void exportSparseMatrix(String filename, SparseData sparseData) throws IOException
IOException
public void initializeExport(InstanceData instanceLabel, Properties properties, SparseData sparseData) throws IOException
initializeExport
in interface SparseDataFormatter
IOException
protected void updateLabelClassMapTransductive()
Copyright © 2012-2017 The Apache Software Foundation. All Rights Reserved.