public static class LibSVMFormatterFactory.LibSVMFormatter extends BaseSparseDataFormatter
exportProperties, kernelUtil, labelToClassIndexMap, maxAttributeIndex, nominalAttributeMap, numericAttributeMap, outdir
ATTR_INSTANCE_ID, SCOPE, SCOPE_FOLD, SCOPE_LABEL
Constructor and Description |
---|
LibSVMFormatter(KernelUtil kernelUtil) |
Modifier and Type | Method and Description |
---|---|
void |
clearFold()
clean up fold specific state
|
void |
clearLabel() |
protected List<Long> |
exportDataForInstances(SparseData bagOfWordsData,
SortedMap<Long,String> instanceClassMap,
com.google.common.collect.BiMap<String,Integer> classToIndexMap,
BufferedWriter wData,
BufferedWriter wId) |
protected void |
exportDataForLabel(String filename,
String idFilename,
SparseData bagOfWordsData,
SortedMap<Long,String> instanceClassMap,
com.google.common.collect.BiMap<String,Integer> classToIndexMap)
Export data file and id file
|
void |
exportFold(SparseData sparseData,
SortedMap<Long,String> instanceClassMap,
boolean train,
String label,
Integer run,
Integer fold)
export the given train/test set
|
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) |
protected void |
writeLibsvmLine(BufferedWriter wData,
SortedMap<Integer,Double> instanceValues) |
addNumericAttribute, exportAttributeNames, exportAttributeNames, exportSparseMatrix, exportSparseRow, getSparseLineValues, updateLabelClassMapTransductive
public LibSVMFormatter(KernelUtil kernelUtil)
public void initializeExport(InstanceData instanceLabel, Properties properties, SparseData sparseData) throws IOException
BaseSparseDataFormatter
initializeExport
in interface SparseDataFormatter
initializeExport
in class BaseSparseDataFormatter
IOException
public void initializeLabel(String label, SortedMap<Integer,SortedMap<Integer,SortedMap<Boolean,SortedMap<Long,String>>>> labelInstances, Properties properties, SparseData sparseData) throws IOException
IOException
public void initializeFold(SparseData sparseData, String label, Integer run, Integer fold, SortedMap<Boolean,SortedMap<Long,String>> foldInstanceLabelMap) throws IOException
IOException
public void exportFold(SparseData sparseData, SortedMap<Long,String> instanceClassMap, boolean train, String label, Integer run, Integer fold) throws IOException
IOException
protected void exportDataForLabel(String filename, String idFilename, SparseData bagOfWordsData, SortedMap<Long,String> instanceClassMap, com.google.common.collect.BiMap<String,Integer> classToIndexMap) throws IOException
filename
- idFilename
- bagOfWordsData
- instanceClassMap
- numericAttributeMap
- nominalAttributeMap
- label
- IOException
protected List<Long> exportDataForInstances(SparseData bagOfWordsData, SortedMap<Long,String> instanceClassMap, com.google.common.collect.BiMap<String,Integer> classToIndexMap, BufferedWriter wData, BufferedWriter wId) throws IOException
bagOfWordsData
- data to be exportedinstanceClassMap
- instance ids - class name mapclassToIndexMap
- class name - class id mapwData
- file to write data towId
- file to write ids toIOException
protected void writeLibsvmLine(BufferedWriter wData, SortedMap<Integer,Double> instanceValues) throws IOException
IOException
public void clearFold()
public void clearLabel()
Copyright © 2012-2017 The Apache Software Foundation. All Rights Reserved.