edu.stanford.nlp.classify
Class WeightedDataset<L,F>
java.lang.Object
edu.stanford.nlp.classify.GeneralDataset<L,F>
edu.stanford.nlp.classify.Dataset<L,F>
edu.stanford.nlp.classify.WeightedDataset<L,F>
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Iterable<RVFDatum<L,F>>
public class WeightedDataset<L,F>
- extends Dataset<L,F>
- Author:
- Galen Andrew, Sarah Spikes (sdspikes@cs.stanford.edu) (Templatization)
- See Also:
- Serialized Form
Field Summary |
protected float[] |
weights
|
Method Summary |
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(int randomSeed)
Randomizes the data array in place
Needs to be redefined here because we need to randomize the weights as well |
Methods inherited from class edu.stanford.nlp.classify.Dataset |
addFeatures, addLabel, 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 |
Methods inherited from class edu.stanford.nlp.classify.GeneralDataset |
addAll, applyFeatureCountThreshold, applyFeatureMaxCountThreshold, clear, clear, featureIndex, getDataArray, getLabelsArray, iterator, labelIndex, labelIterator, makeSvmLabelMap, mapDataset, mapDataset, mapDatum, numClasses, numFeatures, numFeatureTokens, numFeatureTypes, printSVMLightFormat, printSVMLightFormat, sampleDataset, size, trimData, trimLabels, trimToSize, trimToSize, trimToSize |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
weights
protected float[] weights
WeightedDataset
public WeightedDataset(Index<L> labelIndex,
int[] labels,
Index<F> featureIndex,
int[][] data,
int size,
float[] weights)
WeightedDataset
public WeightedDataset()
WeightedDataset
public WeightedDataset(int initSize)
getWeights
public float[] getWeights()
getFeatureCounts
public float[] getFeatureCounts()
- Description copied from class:
GeneralDataset
- Get the total count (over all data instances) of each feature
- Overrides:
getFeatureCounts
in class GeneralDataset<L,F>
- Returns:
- an array containing the counts (indexed by index)
add
public void add(Datum<L,F> d)
- Overrides:
add
in class Dataset<L,F>
add
public void add(java.util.Collection<F> features,
L label)
- Overrides:
add
in class Dataset<L,F>
add
public void add(Datum<L,F> d,
float weight)
ensureSize
protected void ensureSize()
- Overrides:
ensureSize
in class Dataset<L,F>
add
public void add(java.util.Collection<F> features,
L label,
float weight)
randomize
public void randomize(int randomSeed)
- Randomizes the data array in place
Needs to be redefined here because we need to randomize the weights as well
- Overrides:
randomize
in class GeneralDataset<L,F>
Stanford NLP Group