public static class SemiLFormatterFactory.SemiLDataFormatter extends SVMLightFormatterFactory.SVMLightFormatter
Modifier and Type | Field and Description |
---|---|
protected InstanceData |
instanceLabel |
foldInstanceLabelMap
exportProperties, kernelUtil, labelToClassIndexMap, maxAttributeIndex, nominalAttributeMap, numericAttributeMap, outdir
ATTR_INSTANCE_ID, SCOPE, SCOPE_FOLD, SCOPE_LABEL
Constructor and Description |
---|
SemiLDataFormatter(KernelUtil kernelUtil) |
Modifier and Type | Method and Description |
---|---|
protected void |
exportData(SparseData sparseData,
String label,
Integer run,
Integer fold) |
void |
exportFold(SparseData sparseData,
SortedMap<Long,String> instanceClassMap,
boolean train,
String label,
Integer run,
Integer fold)
export the given train/test set
|
protected void |
exportLabel(String lblFilename,
SortedMap<Long,Integer> mapInstanceIdToClass)
Write the 'label' file.
|
protected void |
fillLabelToClassIndexMap(Map<String,SortedSet<String>> labelToClassMap) |
protected SortedMap<Long,Integer> |
getTrainingClassMap(String idFilename,
SortedMap<Long,String> trainInstanceClassMap,
SortedMap<Long,String> testInstanceClassMap,
Map<String,Integer> classToIndexMap,
SortedSet<Long> instanceIds)
pick through the training and test sets, figure out the class id for
all instance ids for training.
|
void |
initializeExport(InstanceData instanceLabel,
Properties properties,
SparseData sparseData)
write distance up to 6 digit precision.
|
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, exportTransductiveData
clearLabel, exportDataForInstances, exportDataForLabel, writeLibsvmLine
addNumericAttribute, exportAttributeNames, exportAttributeNames, exportSparseMatrix, exportSparseRow, getSparseLineValues, updateLabelClassMapTransductive
protected InstanceData instanceLabel
public SemiLDataFormatter(KernelUtil kernelUtil)
protected void exportData(SparseData sparseData, String label, Integer run, Integer fold) throws IOException
foldInstanceLabelMap
- sparseData
- label
- run
- fold
- IOException
public void exportFold(SparseData sparseData, SortedMap<Long,String> instanceClassMap, boolean train, String label, Integer run, Integer fold) throws IOException
SVMLightFormatterFactory.SVMLightFormatter
exportFold
in interface SparseDataFormatter
exportFold
in class SVMLightFormatterFactory.SVMLightFormatter
IOException
protected void exportLabel(String lblFilename, SortedMap<Long,Integer> mapInstanceIdToClass) throws IOException
lblFilename
- filename to write tomapInstanceIdToClass
- sorted map of instance id to class. this must correspond
to the order in the data fileIOException
protected SortedMap<Long,Integer> getTrainingClassMap(String idFilename, SortedMap<Long,String> trainInstanceClassMap, SortedMap<Long,String> testInstanceClassMap, Map<String,Integer> classToIndexMap, SortedSet<Long> instanceIds) throws IOException
idFilename
- filename to write instance id\ttrain/test flag\ttarget
class totrainInstanceClassMap
- instances for trainingtestInstanceClassMap
- instance for testingclassToIndexMap
- map of class to class idsinstanceIds
- sorted set of instance ids; the order with which class.txt
will be written, and the order with which instances will
appear in the training data file.IOException
public void initializeExport(InstanceData instanceLabel, Properties properties, SparseData sparseData) throws IOException
initializeExport
in interface SparseDataFormatter
initializeExport
in class SVMLightFormatterFactory.SVMLightFormatter
data
- wData
- 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 SVMLightFormatterFactory.SVMLightFormatter
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
protected void fillLabelToClassIndexMap(Map<String,SortedSet<String>> labelToClassMap)
fillLabelToClassIndexMap
in class SVMLightFormatterFactory.SVMLightFormatter
Copyright © 2012-2017 The Apache Software Foundation. All Rights Reserved.