fr.lip6.bag
Class WeightedBagOfVector<T extends MLVector<?>>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<T>
              extended by fr.lip6.bag.BagOfVector<T>
                  extended by fr.lip6.bag.WeightedBagOfVector<T>
Type Parameters:
T - type of vectors in input space.
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<T>, java.util.Collection<T>, java.util.List<T>, java.util.RandomAccess

public class WeightedBagOfVector<T extends MLVector<?>>
extends BagOfVector<T>

Simple class of bag that associated a weight to each element of the bag. This weight is proportional to the representativity of the elements. ie, it os the inverse of the sum of the similarities between the element and the rest of the bag.

Author:
dpicard
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
WeightedBagOfVector(Kernel<T> k)
          Constructor with kernel argument.
 
Method Summary
 void computeWeights()
          Compute the weights for each element of the bag.
 double getWeight(T t)
          get the weights of a particular element in the bag
 double[] getWeights()
          get the weights associated with each element of the bag
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

WeightedBagOfVector

public WeightedBagOfVector(Kernel<T> k)
Constructor with kernel argument.

Parameters:
k - kernel used to compute the weights.
Method Detail

getWeights

public double[] getWeights()
get the weights associated with each element of the bag

Returns:
the weights

getWeight

public double getWeight(T t)
get the weights of a particular element in the bag

Parameters:
t - element to be associated with the weight
Returns:
the weight if it exist, 0. if the element is not in the bag

computeWeights

public void computeWeights()
Compute the weights for each element of the bag.