@PublicationReference(author={"Richard Colbaugh","Kristin Glass"},title="Agile Sentiment Analysis of Social Media Content for Security Informatics Applications",type=Conference,year=2011,publication="Intelligence and Security Informatics Conference (EISIC)",pages={327,331},url="http://www.cs.princeton.edu/introcs/97data/FFT.java.html") @PublicationReference(author={"Kristin Glass","Richard Colbaugh"},title="Estimating the Sentiment of Social Media Content for Security Informatics Applications",type=Conference,year=2011,publication="Intelligence and Security Informatics (ISI)",pages={65,70},url="http://www.cs.princeton.edu/introcs/97data/FFT.java.html") public class MultipartiteValenceMatrix extends MatrixVectorMultiplier implements java.io.Serializable
m
Modifier | Constructor and Description |
---|---|
protected |
MultipartiteValenceMatrix()
NEVER call this from real code.
|
|
MultipartiteValenceMatrix(java.util.List<java.lang.Integer> eachPartsSize,
int power)
Initializees this with the expected size of each partition, and the power
to raise the L_tilde matrix to.
|
|
MultipartiteValenceMatrix(java.util.List<java.lang.Integer> eachPartsSize,
int power,
int numThreads)
Initializes this with the expected size of each partition, and the power
to raise the L_tilde matrix to.
|
Modifier and Type | Method and Description |
---|---|
void |
addRelationship(int fromGroup,
int fromIndex,
int toGroup,
int toIndex,
double weight)
Adds a relationship between the two indexed elements.
|
Vector |
evaluate(Vector input)
Overrides the default implementation so that L_tilde can be raised to a
power and the diagonal weights can be added implicitly (which is much
faster and memory efficient than the explicit representation).
|
Vector |
init()
This method must be called before an instance is passed to an iterative
solver and after all relationships and trusted/weighted elements are
added.
|
void |
setElementsScore(int group,
int index,
double trust,
double score)
Sets elements of the group with their score (+1/-1 or similar) and how
much to trust that weight.
|
equals, hashCode
protected MultipartiteValenceMatrix()
public MultipartiteValenceMatrix(java.util.List<java.lang.Integer> eachPartsSize, int power)
eachPartsSize
- The ordered list of the sizes of each partition.
This ordering needs to be maintained for the group IDs passed in to
addRelationship and setElementsScore.power
- The power to raise L_tilde to for the matrix solution -- the
higher the power, the farther the spread of the trusted/weighted
elements. However, the farther the spread, the slower the solver and the
more homogenous results.public MultipartiteValenceMatrix(java.util.List<java.lang.Integer> eachPartsSize, int power, int numThreads)
eachPartsSize
- The ordered list of the sizes of each partition.
This ordering needs be maintained for the group IDs passed in to
addRelationship and setElementsScore.power
- The power to raise L_tilde to for the matrix solution -- the
higher the power, the farther the spread of the trusted/weighted
elements. However, the farther the spread, the slower the solver and the
more homogenous results.numThreads
- The number of threads that should be used for
multithreading the SparseMatrix/Vector multiplies in the minimization
step. We've found that 2 threads is good for smallish sizes (10,000
elements), 4 is good for medium (100,000-1,000,000), 8 is good for large
(>10,000,000).public void addRelationship(int fromGroup, int fromIndex, int toGroup, int toIndex, double weight)
fromGroup
- The group id of the "from" elementfromIndex
- The within-group id of the "from" elementtoGroup
- The group id of the "to" elementtoIndex
- The within-group id of the "to" elementweight
- The weight of association between the two elements (zero
indicates no relationship). This value replaces any value previously
entered between these two elements.public void setElementsScore(int group, int index, double trust, double score)
group
- The element's group idindex
- The element's within-group idtrust
- The amount the score should be trustedscore
- The score assigned to the elementpublic Vector init()