public static class SparseMatrixFormatterFactory.SparseMatrixDataFormatter extends LibSVMFormatterFactory.LibSVMFormatter
exportProperties, kernelUtil, labelToClassIndexMap, maxAttributeIndex, nominalAttributeMap, numericAttributeMap, outdir
ATTR_INSTANCE_ID, SCOPE, SCOPE_FOLD, SCOPE_LABEL
Constructor and Description |
---|
SparseMatrixDataFormatter(InstanceDataExporter instanceDataExporter,
KernelUtil kernelUtil) |
Modifier and Type | Method and Description |
---|---|
protected int |
exportAttributeNames(BufferedWriter w,
SparseData sparseData)
add instance_id as first in the map of numeric attribute
|
void |
exportFold(SparseData sparseData,
SortedMap<Long,String> instanceClassMap,
boolean train,
String label,
Integer run,
Integer fold)
export the given train/test set
|
protected SortedMap<Integer,Double> |
getSparseLineValues(SparseData bagOfWordsData,
Map<String,Integer> numericAttributeMap,
Map<String,Map<String,Integer>> nominalAttributeMap,
long instanceId)
add instance_id to sparse line values
|
void |
initializeExport(InstanceData instanceLabel,
Properties properties,
SparseData sparseData)
get needed properties out of outdir.
|
void |
initializeFold(SparseData sparseData,
String label,
Integer run,
Integer fold,
SortedMap<Boolean,SortedMap<Long,String>> foldInstanceLabelMap)
write a file with the attribute names corresponding to the indices in
the libsvm data file
|
void |
initializeLabel(String label,
SortedMap<Integer,SortedMap<Integer,SortedMap<Boolean,SortedMap<Long,String>>>> labelInstances,
Properties properties,
SparseData sparseData) |
clearFold, clearLabel, exportDataForInstances, exportDataForLabel, writeLibsvmLine
addNumericAttribute, exportAttributeNames, exportSparseMatrix, exportSparseRow, updateLabelClassMapTransductive
public SparseMatrixDataFormatter(InstanceDataExporter instanceDataExporter, KernelUtil kernelUtil)
public void initializeExport(InstanceData instanceLabel, Properties properties, SparseData sparseData) throws IOException
BaseSparseDataFormatter
initializeExport
in interface SparseDataFormatter
initializeExport
in class LibSVMFormatterFactory.LibSVMFormatter
IOException
public void initializeLabel(String label, SortedMap<Integer,SortedMap<Integer,SortedMap<Boolean,SortedMap<Long,String>>>> labelInstances, Properties properties, SparseData sparseData) throws IOException
initializeLabel
in interface SparseDataFormatter
initializeLabel
in class LibSVMFormatterFactory.LibSVMFormatter
IOException
public void initializeFold(SparseData sparseData, String label, Integer run, Integer fold, SortedMap<Boolean,SortedMap<Long,String>> foldInstanceLabelMap) throws IOException
LibSVMFormatterFactory.LibSVMFormatter
initializeFold
in interface SparseDataFormatter
initializeFold
in class LibSVMFormatterFactory.LibSVMFormatter
IOException
public void exportFold(SparseData sparseData, SortedMap<Long,String> instanceClassMap, boolean train, String label, Integer run, Integer fold) throws IOException
LibSVMFormatterFactory.LibSVMFormatter
exportFold
in interface SparseDataFormatter
exportFold
in class LibSVMFormatterFactory.LibSVMFormatter
IOException
protected int exportAttributeNames(BufferedWriter w, SparseData sparseData) throws IOException
exportAttributeNames
in class BaseSparseDataFormatter
IOException
protected SortedMap<Integer,Double> getSparseLineValues(SparseData bagOfWordsData, Map<String,Integer> numericAttributeMap, Map<String,Map<String,Integer>> nominalAttributeMap, long instanceId)
getSparseLineValues
in class BaseSparseDataFormatter
Copyright © 2012-2017 The Apache Software Foundation. All Rights Reserved.