|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object nz.ac.waikato.mcennis.rat.graph.model.ModelShell nz.ac.waikato.mcennis.rat.graph.algorithm.collaborativefiltering.Item2Item
public class Item2Item
Performs classic Item to Item collaborative filtering. Modified from the orginal version submitted (under GPL) to audioscrobbler.net in 2003 by adding code for using RAT data structures instead of JDBC calls.
Field Summary |
---|
Fields inherited from class nz.ac.waikato.mcennis.rat.graph.model.ModelShell |
---|
listener |
Constructor Summary | |
---|---|
Item2Item()
Create a new generic Item2Item algorithm object with default parameters. |
Method Summary | |
---|---|
protected double |
correlation(cern.colt.matrix.DoubleMatrix2D userArtist,
cern.colt.list.IntArrayList[] indexArtist,
cern.colt.matrix.DoubleMatrix1D time,
cern.colt.matrix.DoubleMatrix1D time2,
int a,
int b,
double[] size)
calculates the correlation between 2 artists using standard statistical definition of correlation. |
protected void |
createCorrelation(Graph g,
Actor u,
double strength,
Actor a)
|
protected void |
createRecommendation(Graph g,
Actor u,
double strength,
Actor a)
|
protected double |
digram(cern.colt.list.IntArrayList[] indexArtist,
cern.colt.matrix.DoubleMatrix2D userArtistMatrix,
int a,
int b,
double[] size)
function to caclualate the digrams needed for calculating relationships between artists. |
void |
execute(Graph g)
execute the algorithm against the given graph |
InputDescriptor[] |
getInputType()
The input type describes all the different kinds of graph objects that are utilized (and hence required) by this object. |
OutputDescriptor[] |
getOutputType()
The output type describes all the different kinds of graph objects that are created during the execution of this algorithm. |
Parameter[] |
getParameter()
List of all parameters this component accepts. |
Parameter |
getParameter(java.lang.String param)
Returns the specific parameter identified by its key-name. |
SettableParameter[] |
getSettableParameter()
Returns settable (i.e. |
SettableParameter |
getSettableParameter(java.lang.String param)
Return the settable parameter namede by this key-name. |
void |
init(java.util.Properties map)
Parameters: name: name of this algorithm. |
Methods inherited from class nz.ac.waikato.mcennis.rat.graph.model.ModelShell |
---|
addListener, fireChange |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface nz.ac.waikato.mcennis.rat.graph.model.Model |
---|
addListener |
Constructor Detail |
---|
public Item2Item()
Method Detail |
---|
public void execute(Graph g)
Algorithm
execute
in interface Algorithm
g
- graph to be modifiedprotected double digram(cern.colt.list.IntArrayList[] indexArtist, cern.colt.matrix.DoubleMatrix2D userArtistMatrix, int a, int b, double[] size)
a
- - artist to be crossedb
- - artist to be crossedsize
- - double passed by reference using array hack/workaround used to pass back the total number of users listening to either artist a or b
protected double correlation(cern.colt.matrix.DoubleMatrix2D userArtist, cern.colt.list.IntArrayList[] indexArtist, cern.colt.matrix.DoubleMatrix1D time, cern.colt.matrix.DoubleMatrix1D time2, int a, int b, double[] size)
a
- - artist in Matrixb
- - artist in Matrixsize
- - number of users listening to either artists
protected void createRecommendation(Graph g, Actor u, double strength, Actor a)
protected void createCorrelation(Graph g, Actor u, double strength, Actor a)
public InputDescriptor[] getInputType()
Component
getInputType
in interface Component
InputDescriptor
public OutputDescriptor[] getOutputType()
Component
getOutputType
in interface Component
OutputDescriptor
public Parameter[] getParameter()
Component
getParameter
in interface Component
public Parameter getParameter(java.lang.String param)
Component
getParameter
in interface Component
param
- key-name of the parameter
public SettableParameter[] getSettableParameter()
Component
getSettableParameter
in interface Component
public SettableParameter getSettableParameter(java.lang.String param)
Component
getSettableParameter
in interface Component
param
- key-name of the parameter
public void init(java.util.Properties map)
init
in interface Component
map
- parameters to be loaded - may be null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |