|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnetkit.graph.edgecreator.EdgeCreatorImp
public abstract class EdgeCreatorImp
Nested Class Summary | |
---|---|
protected class |
EdgeCreatorImp.NbrEntry
Utility class for sub-classes where necessary |
Field Summary | |
---|---|
protected Attribute |
attrib
|
protected int |
attributeIndex
|
protected double |
attributeValue
|
protected Edge[] |
edges
|
protected EdgeType |
edgetype
|
protected GraphMetrics |
gm
|
protected Graph |
graph
|
protected java.util.logging.Logger |
logger
|
protected int |
maxEdges
|
protected java.lang.String |
nodeType
|
protected DataSplit |
split
|
protected double |
trainAssortativity
|
protected double |
trueAssortativity
|
Constructor Summary | |
---|---|
EdgeCreatorImp()
|
Method Summary | |
---|---|
protected void |
addCliqueToAssortMatrix(double[][] matrix,
double[] cliqueClassDistrib)
Utility method whch can be used by any sub-class. |
protected void |
buildEdges()
build the edges using the current edge creation model. |
void |
buildModel(DataSplit split)
Build a model of edge creation based on the data split. |
boolean |
canHandleAttributeValue(Attribute attribute)
Queries the edge creator if it can handle (i.e., create edges for) the given attribute using a specific attribute value. |
Edge[] |
createEdges()
Create all the edges on the graph provided in the initialize method (indirectly through the DataSplit object). |
double |
getAssortativity(boolean useTrueAssort)
Compute the node-based assortativity of this edge creator. |
double[][] |
getAssortativityMatrix(boolean useTrueAssort)
|
int |
getAttributeIndex()
Which attribute is this based on. |
double |
getAttributeValue()
Which attribute value is this based on. |
Edge[] |
getEdgesToNearestNeighbors(Node node)
Get the edges to the K nearest nodes (highest weight using this edge creator), where max-k was provided during initialization. |
EdgeType |
getEdgeType()
|
Classification |
getLabeledNodes(DataSplit split,
boolean useTrueAssort)
Get a classification object which contains all the nodes to be used to calculate assortativity |
int |
getMaxEdges()
How many edges should there be at maximum per node? |
void |
initialize(Graph graph,
java.lang.String nodeType,
int attributeIndex,
double attributeValue,
int maxEdges)
Initialize this creator. |
boolean |
isByAttribute()
Is this edge creator by attribute or by instance as a whole |
boolean |
isByAttributeValue()
Is this edge creator by attribute value or by attribute as a whole |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface netkit.graph.edgecreator.EdgeCreator |
---|
canHandle, getName, getWeight |
Field Detail |
---|
protected java.util.logging.Logger logger
protected Edge[] edges
protected Graph graph
protected java.lang.String nodeType
protected int attributeIndex
protected int maxEdges
protected double attributeValue
protected EdgeType edgetype
protected GraphMetrics gm
protected Attribute attrib
protected DataSplit split
protected double trueAssortativity
protected double trainAssortativity
Constructor Detail |
---|
public EdgeCreatorImp()
Method Detail |
---|
public void initialize(Graph graph, java.lang.String nodeType, int attributeIndex, double attributeValue, int maxEdges)
EdgeCreator
initialize
in interface EdgeCreator
graph
- The graph over which to create edgesnodeType
- Which nodetype is the node to create edges overattributeIndex
- The attribute index over which to generate edges (ignored for creators that cannot handle attributes)attributeValue
- The attribute value over which to generate edges (ignored for creators that cannot handle values; otherwise ignored if value is Double.NaN)maxEdges
- The maximum number of outgoing edges to create from any given nodepublic void buildModel(DataSplit split)
EdgeCreator
buildModel
in interface EdgeCreator
public final EdgeType getEdgeType()
getEdgeType
in interface EdgeCreator
public final int getAttributeIndex()
EdgeCreator
getAttributeIndex
in interface EdgeCreator
public final int getMaxEdges()
EdgeCreator
getMaxEdges
in interface EdgeCreator
public boolean isByAttribute()
EdgeCreator
isByAttribute
in interface EdgeCreator
public boolean isByAttributeValue()
EdgeCreator
isByAttributeValue
in interface EdgeCreator
public boolean canHandleAttributeValue(Attribute attribute)
EdgeCreator
canHandleAttributeValue
in interface EdgeCreator
public final double getAttributeValue()
EdgeCreator
getAttributeValue
in interface EdgeCreator
protected final void addCliqueToAssortMatrix(double[][] matrix, double[] cliqueClassDistrib)
matrix
- An assortativity matrixcliqueClassDistrib
- The number of nodes for each class in the incoming cliquepublic final Classification getLabeledNodes(DataSplit split, boolean useTrueAssort)
split
- The data train/test split to useuseTrueAssort
- If true, use all objects, otherwise use only nods from training set (given in DataSplit object during initialize)
java.lang.IllegalArgumentException
- if creator has not yet been initializedpublic Edge[] getEdgesToNearestNeighbors(Node node)
node
- The node
public double[][] getAssortativityMatrix(boolean useTrueAssort)
public final double getAssortativity(boolean useTrueAssort)
EdgeCreator
getAssortativity
in interface EdgeCreator
useTrueAssort
- Should we compute assortativity based on the whole truth or just the training setpublic final Edge[] createEdges()
EdgeCreator
createEdges
in interface EdgeCreator
protected void buildEdges()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |