edu.cmu.minorthird.classify.multi
Class MultiDatasetIndex

java.lang.Object
  extended by edu.cmu.minorthird.classify.multi.MultiDatasetIndex
All Implemented Interfaces:
java.io.Serializable

public class MultiDatasetIndex
extends java.lang.Object
implements java.io.Serializable

An inverted index, mapping features to examples which contain the features.

Author:
Cameron Williams, Frank Lin
See Also:
Serialized Form

Constructor Summary
MultiDatasetIndex()
           
MultiDatasetIndex(MultiDataset data)
          Construct an index of a dataset.
 
Method Summary
 void addMultiExample(MultiExample e)
          Add a single example to the index.
 double averageFeaturesPerExample()
          Average number of non-zero feature values in examples.
protected  java.util.List<MultiExample> classIndex(java.lang.String label)
           
protected  java.util.List<MultiExample> featureIndex(Feature feature)
           
 java.util.Iterator<Feature> featureIterator()
          Iterate over all features indexed.
 MultiExample getMultiExample(Feature f, int i)
          Get i-th example containing feature f.
 MultiExample getMultiExample(java.lang.String label, int i)
          Get i-th example with given class label.
 java.util.Iterator<MultiExample> getNeighbors(Instance instance)
          Get all examples with a feature in common with the given instance.
static void main(java.lang.String[] args)
           
 int numberOfFeatures()
          Number of features indexed.
 int size(Feature f)
          Number of examples containing non-zero values for feature f.
 int size(java.lang.String label)
          Number of examples with the given class label.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiDatasetIndex

public MultiDatasetIndex()

MultiDatasetIndex

public MultiDatasetIndex(MultiDataset data)
Construct an index of a dataset.

Method Detail

addMultiExample

public void addMultiExample(MultiExample e)
Add a single example to the index.


featureIterator

public java.util.Iterator<Feature> featureIterator()
Iterate over all features indexed.


size

public int size(Feature f)
Number of examples containing non-zero values for feature f.


size

public int size(java.lang.String label)
Number of examples with the given class label.


getMultiExample

public MultiExample getMultiExample(Feature f,
                                    int i)
Get i-th example containing feature f.


getMultiExample

public MultiExample getMultiExample(java.lang.String label,
                                    int i)
Get i-th example with given class label.


getNeighbors

public java.util.Iterator<MultiExample> getNeighbors(Instance instance)
Get all examples with a feature in common with the given instance.


numberOfFeatures

public int numberOfFeatures()
Number of features indexed.


averageFeaturesPerExample

public double averageFeaturesPerExample()
Average number of non-zero feature values in examples.


featureIndex

protected java.util.List<MultiExample> featureIndex(Feature feature)

classIndex

protected java.util.List<MultiExample> classIndex(java.lang.String label)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)