public static class SemiLFormatterFactory.SemiLDataFormatter extends SVMLightFormatterFactory.SVMLightFormatter
Modifier and Type | Field and Description |
---|---|
protected InstanceData |
instanceLabel |
(package private) java.text.NumberFormat |
semilNumberFormat |
foldInstanceLabelMap
exportProperties, kernelUtil, labelToClassIndexMap, maxAttributeIndex, nominalAttributeMap, numericAttributeMap, outdir
ATTR_INSTANCE_ID, SCOPE, SCOPE_FOLD, SCOPE_LABEL
Constructor and Description |
---|
SemiLFormatterFactory.SemiLDataFormatter(KernelUtil kernelUtil) |
Modifier and Type | Method and Description |
---|---|
protected void |
exportData(SparseData sparseData,
java.lang.String label,
java.lang.Integer run,
java.lang.Integer fold) |
void |
exportFold(SparseData sparseData,
java.util.SortedMap<java.lang.Long,java.lang.String> instanceClassMap,
boolean train,
java.lang.String label,
java.lang.Integer run,
java.lang.Integer fold)
export the given train/test set
|
protected void |
exportLabel(java.lang.String lblFilename,
java.util.SortedMap<java.lang.Long,java.lang.Integer> mapInstanceIdToClass)
Write the 'label' file.
|
protected void |
fillLabelToClassIndexMap(java.util.Map<java.lang.String,java.util.SortedSet<java.lang.String>> labelToClassMap) |
protected java.util.SortedMap<java.lang.Long,java.lang.Integer> |
getTrainingClassMap(java.lang.String idFilename,
java.util.SortedMap<java.lang.Long,java.lang.String> trainInstanceClassMap,
java.util.SortedMap<java.lang.Long,java.lang.String> testInstanceClassMap,
java.util.Map<java.lang.String,java.lang.Integer> classToIndexMap,
java.util.SortedSet<java.lang.Long> instanceIds)
pick through the training and test sets, figure out the class id for
all instance ids for training.
|
void |
initializeExport(InstanceData instanceLabel,
java.util.Properties properties,
SparseData sparseData)
write distance up to 6 digit precision.
|
void |
initializeFold(SparseData sparseData,
java.lang.String label,
java.lang.Integer run,
java.lang.Integer fold,
java.util.SortedMap<java.lang.Boolean,java.util.SortedMap<java.lang.Long,java.lang.String>> foldInstanceLabelMap)
write a file with the attribute names corresponding to the indices in
the libsvm data file
|
void |
initializeLabel(java.lang.String label,
java.util.SortedMap<java.lang.Integer,java.util.SortedMap<java.lang.Integer,java.util.SortedMap<java.lang.Boolean,java.util.SortedMap<java.lang.Long,java.lang.String>>>> labelInstances,
java.util.Properties properties,
SparseData sparseData) |
clearFold, exportTransductiveData
clearLabel, exportDataForInstances, exportDataForLabel, writeLibsvmLine
addNumericAttribute, exportAttributeNames, exportAttributeNames, exportSparseMatrix, exportSparseRow, getSparseLineValues, updateLabelClassMapTransductive
protected InstanceData instanceLabel
java.text.NumberFormat semilNumberFormat
public SemiLFormatterFactory.SemiLDataFormatter(KernelUtil kernelUtil)
protected void exportData(SparseData sparseData, java.lang.String label, java.lang.Integer run, java.lang.Integer fold) throws java.io.IOException
foldInstanceLabelMap
- sparseData
- label
- run
- fold
- java.io.IOException
public void exportFold(SparseData sparseData, java.util.SortedMap<java.lang.Long,java.lang.String> instanceClassMap, boolean train, java.lang.String label, java.lang.Integer run, java.lang.Integer fold) throws java.io.IOException
SVMLightFormatterFactory.SVMLightFormatter
exportFold
in interface SparseDataFormatter
exportFold
in class SVMLightFormatterFactory.SVMLightFormatter
java.io.IOException
protected void exportLabel(java.lang.String lblFilename, java.util.SortedMap<java.lang.Long,java.lang.Integer> mapInstanceIdToClass) throws java.io.IOException
lblFilename
- filename to write tomapInstanceIdToClass
- sorted map of instance id to class. this must correspond
to the order in the data filejava.io.IOException
protected java.util.SortedMap<java.lang.Long,java.lang.Integer> getTrainingClassMap(java.lang.String idFilename, java.util.SortedMap<java.lang.Long,java.lang.String> trainInstanceClassMap, java.util.SortedMap<java.lang.Long,java.lang.String> testInstanceClassMap, java.util.Map<java.lang.String,java.lang.Integer> classToIndexMap, java.util.SortedSet<java.lang.Long> instanceIds) throws java.io.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.java.io.IOException
public void initializeExport(InstanceData instanceLabel, java.util.Properties properties, SparseData sparseData) throws java.io.IOException
initializeExport
in interface SparseDataFormatter
initializeExport
in class SVMLightFormatterFactory.SVMLightFormatter
data
- wData
- java.io.IOException
public void initializeFold(SparseData sparseData, java.lang.String label, java.lang.Integer run, java.lang.Integer fold, java.util.SortedMap<java.lang.Boolean,java.util.SortedMap<java.lang.Long,java.lang.String>> foldInstanceLabelMap) throws java.io.IOException
LibSVMFormatterFactory.LibSVMFormatter
initializeFold
in interface SparseDataFormatter
initializeFold
in class SVMLightFormatterFactory.SVMLightFormatter
java.io.IOException
public void initializeLabel(java.lang.String label, java.util.SortedMap<java.lang.Integer,java.util.SortedMap<java.lang.Integer,java.util.SortedMap<java.lang.Boolean,java.util.SortedMap<java.lang.Long,java.lang.String>>>> labelInstances, java.util.Properties properties, SparseData sparseData) throws java.io.IOException
initializeLabel
in interface SparseDataFormatter
initializeLabel
in class LibSVMFormatterFactory.LibSVMFormatter
java.io.IOException
protected void fillLabelToClassIndexMap(java.util.Map<java.lang.String,java.util.SortedSet<java.lang.String>> labelToClassMap)
fillLabelToClassIndexMap
in class SVMLightFormatterFactory.SVMLightFormatter