|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbpiwowar.maths.eigen.IncrementalSymmetricED
uk.ac.gla.dcs.renaissance.iqir.DensityTracker
@Persistent public class DensityTracker
Track subspaces defined by a set of vectors. It is based on rank one updates of an eigenvalue decomposition, and deals with the sparsity of vectors
In the case of a mixture, computes the sum of alpha(i) * rho(i) for each component of the mixture
Nested Class Summary |
---|
Nested classes/interfaces inherited from class bpiwowar.maths.eigen.IncrementalSymmetricED |
---|
bpiwowar.maths.eigen.IncrementalSymmetricED.ChangeListener |
Constructor Summary | |
---|---|
DensityTracker()
|
|
DensityTracker(it.unimi.dsi.fastutil.ints.Int2IntSortedMap map,
boolean updateMap)
|
Method Summary | |
---|---|
void |
add(double weight,
bpiwowar.maths.matrix.DoubleMatrix1D weightedVector)
Add a set of words In practice, compute a rank-one update of weight^2 x weightedVector |
void |
add(double sigma,
bpiwowar.maths.matrix.DoubleMatrix1D u,
int[] localToGlobalMap)
Add a sigma * u to the column space (that is, update by sigma^2 * u * u^T), using the map to go from one id to another. |
void |
add(bpiwowar.maths.matrix.DoubleMatrix1D weightedVector)
Add a set of words |
void |
add(EigenDecomposition doc)
Add another sparse EVD |
void |
addLocal(double rho,
bpiwowar.maths.matrix.DenseDoubleMatrix1D weightedLocalVector)
Add a dense vector (i.e. |
void |
addLocal(double rho,
bpiwowar.maths.matrix.DenseDoubleMatrix1D weightedLocalVector,
boolean allowCompaction)
Add a dense vector (i.e. |
void |
checkCompaction()
Check & compact |
bpiwowar.maths.matrix.DiagonalDoubleMatrix |
computeSqrtSigma()
Returns sqrt(S) |
int[] |
getLocalToGlobalTermIdMap()
Return the reverse map |
it.unimi.dsi.fastutil.ints.Int2IntSortedMap |
getMap()
|
int |
getNumberOfTerms()
|
int |
getNumberOfUpdates()
|
bpiwowar.maths.matrix.DenseDoubleMatrix1D |
getSum()
|
int |
getUpdatesSinceLastCompaction()
Get the number of updates since the last compaction |
double |
getWeightsSum()
|
void |
rankOneUpdate(double rho,
bpiwowar.maths.matrix.DoubleMatrix1D u,
int[] localToGlobalMap)
Add a rho * uu^T to the column space, using the map to go from one id to another. |
void |
rankOneUpdate(double rho,
bpiwowar.maths.matrix.DoubleMatrix1D u,
int[] localToGlobalMap,
boolean allowCompaction)
Add a rho * uu^T to the column space, using the map to go from one id to another. |
void |
removeMap()
When using only a dense term space, this is useful to prevent bugs (we crash the program directly) |
void |
setCompaction(int compactInterval,
double compactThreshold)
Set the compaction interval (i.e. |
int |
setNumberOfUpdates(int numberOfUpdates)
|
void |
setRealSelector(bpiwowar.maths.eigen.selector.Selector selector)
Set the selector without introducing the default non zero selector as with setSelector |
void |
setSelector(bpiwowar.maths.eigen.selector.Selector selector)
Set the selector for this tracker -- we add up our own non zero selector |
void |
setStoreVectorSum(boolean b)
Should we store the sum of vectors? |
boolean |
trim(boolean trimMatrices,
double threshold,
boolean reorthogonalise)
Reduce as much as possible the space taken by the representation, by removing terms which are not needed anymore (their row in the SVD decomposition is 0), and by adjusting the matrix size if needed |
void |
updateMap(int[] list)
Update our global to local map with another map (i.e., the global ids of the other map will be known by ours) |
void |
updateMap(it.unimi.dsi.fastutil.ints.Int2IntMap otherMap)
Update our global to local map with another map (i.e., the global ids of the other map will be known by ours) |
Methods inherited from class bpiwowar.maths.eigen.IncrementalSymmetricED |
---|
computeU, computeU, getRank, getSelector, getSigma, getSigma, getU1, getU2, removeRows, reorthogonalise, setBrokenArrowSVD, setFactories, setFactory, setRank, trimMatrices, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DensityTracker()
public DensityTracker(it.unimi.dsi.fastutil.ints.Int2IntSortedMap map, boolean updateMap)
Method Detail |
---|
public void add(bpiwowar.maths.matrix.DoubleMatrix1D weightedVector)
weightedVector
- The word vector within the global term id spacepublic void add(double weight, bpiwowar.maths.matrix.DoubleMatrix1D weightedVector)
weight
- The global weight for the vectorweightedVector
- The word vector within the global term id spacepublic void addLocal(double rho, bpiwowar.maths.matrix.DenseDoubleMatrix1D weightedLocalVector)
weightedLocalVector
- The vector to addpublic void addLocal(double rho, bpiwowar.maths.matrix.DenseDoubleMatrix1D weightedLocalVector, boolean allowCompaction)
weightedLocalVector
- The vector to addallowCompaction
- If true, allows compaction after the update (compaction might
change the map)public void checkCompaction()
public void add(double sigma, bpiwowar.maths.matrix.DoubleMatrix1D u, int[] localToGlobalMap)
sigma
- The sigma for the u dimensionu
- The vector to addlocalToGlobalMap
- The map to convert a local index (in u) to a global word idpublic void rankOneUpdate(double rho, bpiwowar.maths.matrix.DoubleMatrix1D u, int[] localToGlobalMap)
rho
- The sigma for the u dimensionu
- The vector to addlocalToGlobalMap
- The map to convert a local index (in u) to a global word idpublic void rankOneUpdate(double rho, bpiwowar.maths.matrix.DoubleMatrix1D u, int[] localToGlobalMap, boolean allowCompaction)
rho
- The sigma for the u dimensionu
- The vector to addlocalToGlobalMap
- The map to convert a local index (in u) to a global word idallowCompaction
- If we can sparsify after the updatepublic int[] getLocalToGlobalTermIdMap()
tracker
-
public void updateMap(it.unimi.dsi.fastutil.ints.Int2IntMap otherMap)
otherMap
- The other map to includepublic void updateMap(int[] list)
list
- The list of global term ids to addpublic int getNumberOfTerms()
public boolean trim(boolean trimMatrices, double threshold, boolean reorthogonalise)
trimMatrices
- True if the matrices of the SVD decomposition should be
trimmed after the cleaning processthreshold
- The threshold for a row norm below which the row is removedreorthogonalise
- true if the basis should be reorthogonalised in case there are
some changes
public void setSelector(bpiwowar.maths.eigen.selector.Selector selector)
setSelector
in class bpiwowar.maths.eigen.IncrementalSymmetricED
public void setRealSelector(bpiwowar.maths.eigen.selector.Selector selector)
setSelector
selector
- The selector for eigenvaluespublic void setCompaction(int compactInterval, double compactThreshold)
compactInterval
- public void setStoreVectorSum(boolean b)
b
- True to store, false to not storepublic bpiwowar.maths.matrix.DenseDoubleMatrix1D getSum()
public it.unimi.dsi.fastutil.ints.Int2IntSortedMap getMap()
public bpiwowar.maths.matrix.DiagonalDoubleMatrix computeSqrtSigma()
public final int setNumberOfUpdates(int numberOfUpdates)
numberOfUpdates
- the numberOfUpdates to setpublic int getNumberOfUpdates()
public void add(EigenDecomposition doc)
doc
- public int getUpdatesSinceLastCompaction()
public double getWeightsSum()
public void removeMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |