public class WeightedDataset<L,F> extends Dataset<L,F>
Modifier and Type | Field and Description |
---|---|
protected float[] |
weights |
data, featureIndex, labelIndex, labels, size
Constructor and Description |
---|
WeightedDataset() |
WeightedDataset(Index<L> labelIndex,
int[] labels,
Index<F> featureIndex,
int[][] data,
int size,
float[] weights) |
WeightedDataset(int initSize) |
Modifier and Type | Method and Description |
---|---|
void |
add(java.util.Collection<F> features,
L label) |
void |
add(java.util.Collection<F> features,
L label,
float weight) |
void |
add(Datum<L,F> d) |
void |
add(Datum<L,F> d,
float weight) |
protected void |
ensureSize() |
float[] |
getFeatureCounts()
Get the total count (over all data instances) of each feature
|
float[] |
getWeights() |
void |
randomize(long randomSeed)
Randomizes (shuffles) the data array in place.
|
void |
setWeight(int i,
float weight)
Set the weight of datum i.
|
<E> void |
shuffleWithSideInformation(long randomSeed,
java.util.List<E> sideInformation)
Randomizes (shuffles) the data array in place.
|
add, add, addFeatureIndices, addFeatures, addFeatures, addLabel, addLabelIndex, applyFeatureCountThreshold, changeFeatureIndex, changeLabelIndex, getDatum, getFeatureCounter, getInformationGains, getL1NormalizedTFIDFDataset, getL1NormalizedTFIDFDatum, getRandomSubDataset, getRVFDatum, getValuesArray, initialize, printFullFeatureMatrix, printSparseFeatureMatrix, printSparseFeatureMatrix, printSVMLightFormat, readSVMLightFormat, readSVMLightFormat, readSVMLightFormat, readSVMLightFormat, selectFeatures, selectFeaturesBinaryInformationGain, split, split, summaryStatistics, svmLightLineToDatum, toString, toSummaryStatistics, toSummaryString, updateLabels
addAll, applyFeatureCountThreshold, applyFeatureMaxCountThreshold, clear, clear, featureIndex, getDataArray, getLabelsArray, iterator, labelIndex, labelIterator, makeSvmLabelMap, mapDataset, mapDataset, mapDatum, numClasses, numDatumsPerLabel, numFeatures, numFeatureTokens, numFeatureTypes, printSVMLightFormat, printSVMLightFormat, retainFeatures, sampleDataset, size, splitOutFold, trimData, trimLabels, trimToSize, trimToSize, trimToSize
public WeightedDataset(Index<L> labelIndex, int[] labels, Index<F> featureIndex, int[][] data, int size, float[] weights)
public WeightedDataset()
public WeightedDataset(int initSize)
public float[] getWeights()
public float[] getFeatureCounts()
GeneralDataset
getFeatureCounts
in class GeneralDataset<L,F>
protected void ensureSize()
ensureSize
in class Dataset<L,F>
public void setWeight(int i, float weight)
i
- The index of the datum to change the weight of.weight
- The weight to setpublic void randomize(long randomSeed)
randomize
in class GeneralDataset<L,F>
randomSeed
- A seed for the Random object (allows you to reproduce the same ordering)public <E> void shuffleWithSideInformation(long randomSeed, java.util.List<E> sideInformation)
shuffleWithSideInformation
in class GeneralDataset<L,F>
randomSeed
- A seed for the Random object (allows you to reproduce the same ordering)