コード例 #1
0
ファイル: SimpleTransformer.java プロジェクト: CaoAo/BeehiveZ
 protected void cleanUpEdges(double significanceThreshold, double correlationThreshold) {
   for (int x = 0; x < graph.getNumberOfInitialNodes(); x++) {
     for (int y = 0; y < graph.getNumberOfInitialNodes(); y++) {
       if (graph.getNodeMappedTo(x) == null
           || graph.getNodeMappedTo(y) == null
           || (graph.getBinarySignificance(x, y) < significanceThreshold
               && graph.getBinaryCorrelation(x, y) < correlationThreshold)) {
         graph.setBinarySignificance(x, y, 0.0);
         graph.setBinaryCorrelation(x, y, 0.0);
       }
     }
   }
 }
コード例 #2
0
ファイル: SimpleTransformer.java プロジェクト: CaoAo/BeehiveZ
 protected boolean shouldMergeWith(Node node, ClusterNode cluster) {
   if (cluster.getPrimitives().size() == 0) {
     return true; // always add first node
   }
   if (cluster.isDirectlyConnectedTo(node) == true && cluster.contains(node) == false) {
     double ownSignificance = 0.0;
     double otherSignificance = 0.0;
     double ownCorrelation = 0.0;
     double otherCorrelation = 0.0;
     // aggregate correlation and significance of edges between the node
     // in
     // question and connected nodes, separately for edges to/from
     // cluster and
     // to/from other nodes.
     for (int i = 0; i < graph.getNumberOfInitialNodes(); i++) {
       if (i == node.getIndex()) {
         continue; // ignore self-references
       }
       if (cluster.contains(graph.getPrimitiveNode(i))) {
         ownSignificance += graph.getBinarySignificance(node.getIndex(), i);
         ownSignificance += graph.getBinarySignificance(i, node.getIndex());
         ownCorrelation += graph.getBinaryCorrelation(node.getIndex(), i);
         ownCorrelation += graph.getBinaryCorrelation(i, node.getIndex());
       } else {
         otherSignificance += graph.getBinarySignificance(node.getIndex(), i);
         otherSignificance += graph.getBinarySignificance(i, node.getIndex());
         otherCorrelation += graph.getBinaryCorrelation(node.getIndex(), i);
         otherCorrelation += graph.getBinaryCorrelation(i, node.getIndex());
       }
     }
     // make a decision
     return (ownCorrelation > otherCorrelation || ownSignificance > otherSignificance);
   } else {
     // no connection - no merge.
     return false;
   }
 }