edu.stanford.nlp.classify
Class WeightedDataset<L,F>

java.lang.Object
  extended by edu.stanford.nlp.classify.GeneralDataset<L,F>
      extended by edu.stanford.nlp.classify.Dataset<L,F>
          extended by edu.stanford.nlp.classify.WeightedDataset<L,F>
All Implemented Interfaces:
Serializable, 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
           
 
Fields inherited from class edu.stanford.nlp.classify.GeneralDataset
data, featureIndex, labelIndex, labels, size
 
Constructor Summary
WeightedDataset()
           
WeightedDataset(Index<L> labelIndex, int[] labels, Index<F> featureIndex, int[][] data, int size, float[] weights)
           
WeightedDataset(int initSize)
           
 
Method Summary
 void add(Collection<F> features, L label)
           
 void add(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()
           
 
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
 

Field Detail

weights

protected float[] weights
Constructor Detail

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)
Method Detail

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(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(Collection<F> features,
                L label,
                float weight)


Stanford NLP Group