use of edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.Clusters in project clusterMaker2 by RBVI.
the class PP_DivideAndRecluster method run.
public void run() {
/* print score before any post processing */
// double scoreAtStart = this.cc.getClusteringScore();
// System.out.println("Score before post processing: "+scoreAtStart);
/* merging step */
ArrayList<ArrayList<Integer>> clusterObject = PostProcessingUtility.createClusterObject(this.cc, false);
HashSet<String> alreadyCompared = new HashSet<String>();
ClusterObjectComparator comparator = new ClusterObjectComparator();
PostProcessingUtility.mergeCluster(clusterObject, alreadyCompared, this.cc, comparator, true);
this.bestScore = PostProcessingUtility.updateClusterInfoInCC(clusterObject, this.cc);
/* collection ConnectedComponent objects */
ArrayList<ConnectedComponent> cCsOfSubgraphs = new ArrayList<ConnectedComponent>();
/* start a new clustering procedure for clusters larger than 3 */
for (int i = 0; i < clusterObject.size(); i++) {
ArrayList<Integer> cluster = clusterObject.get(i);
int clusterSize = cluster.size();
/* if the clusters are to small, leave them in the clusters object and continue */
if (clusterSize <= 3) {
// System.out.println("cluster too small: "+cluster.toString());
continue;
}
/* remove cluster from cluster object and decrease i */
// TODO!!
clusterObject.remove(i);
--i;
ConnectedComponent ccForCluster = this.cc.createConnectedComponentForCluster(i, cluster);
cCsOfSubgraphs.add(ccForCluster);
ClusterPostProcessingTask clusterTask = new ClusterPostProcessingTask(ccForCluster, this.params, this.layouterEnumTypes);
clusterTask.run();
}
for (int i = 0; i < cCsOfSubgraphs.size(); i++) {
ConnectedComponent subCC = cCsOfSubgraphs.get(i);
addClustersToTotalClusters(subCC, clusterObject);
}
/* update clustering information */
this.bestScore = PostProcessingUtility.updateClusterInfoInCC(clusterObject, this.cc);
/* do post post processing - merge and rearrange */
PP_RearrangeAndMergeBest postProcess1 = new PP_RearrangeAndMergeBest();
postProcess1.initPostProcessing(this.cc);
postProcess1.run();
}
use of edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.Clusters in project clusterMaker2 by RBVI.
the class HyperlinkInducedTopicSearch method run.
@Override
public void run(TaskMonitor taskMonitor) {
taskMonitor.setProgress(0.0);
taskMonitor.setTitle("Hyperlink-Induced Topic Search ranking of clusters");
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Fetching clusters...");
taskMonitor.setProgress(0.1);
clusters = ClusterUtils.fetchClusters(network);
taskMonitor.setProgress(0.5);
initVariables();
clusters.forEach(NodeCluster::initNodeScores);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting node scores in clusters");
addNodes();
taskMonitor.setProgress(0.6);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting edge scores in clusters");
addEdges();
taskMonitor.setProgress(0.7);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Performing HITS algorithm");
HITS<PRNode, PREdge> hyperlinkInducedTopicSearchPriors = performHITS(graph);
taskMonitor.setProgress(0.8);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting cluster scores");
insertScores(clusters, graph, hyperlinkInducedTopicSearchPriors);
taskMonitor.setProgress(0.9);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Insert cluster information in tables");
ClusterUtils.insertResultsInColumns(network, clusters, SHORTNAME);
results = new AbstractClusterResults(network, clusters);
taskMonitor.setProgress(1.0);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Done...");
}
use of edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.Clusters in project clusterMaker2 by RBVI.
the class MultipleAttributeAddition method run.
@Override
public void run(TaskMonitor taskMonitor) {
taskMonitor.setProgress(0.0);
taskMonitor.setTitle("Multiple Node Edge Additive ranking of clusters");
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Fetching clusters...");
taskMonitor.setProgress(0.1);
List<NodeCluster> clusters = ClusterUtils.fetchClusters(network);
taskMonitor.setProgress(0.5);
String clusterColumnName = ClusterUtils.getClusterAttribute(network);
List<String> nodeAttributes = context.getSelectedNodeAttributes();
List<String> edgeAttributes = context.getSelectedEdgeAttributes();
taskMonitor.setProgress(0.6);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting node scores in clusters");
clusters = ClusterUtils.setNodeScoresInCluster(network, clusters, nodeAttributes, clusterColumnName, false);
taskMonitor.setProgress(0.75);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting edge scores in clusters");
clusters = ClusterUtils.setEdgeScoresInCluster(network, clusters, edgeAttributes, clusterColumnName, false);
taskMonitor.setProgress(0.80);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Sorting and ranking clusters");
ClusterUtils.ascendingSort(clusters);
NodeCluster.setClusterRanks(clusters);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Insert cluster information in tables");
ClusterUtils.insertResultsInColumns(network, clusters, SHORTNAME);
results = new AbstractClusterResults(network, clusters);
taskMonitor.setProgress(1.0);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Done...");
}
use of edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.Clusters in project clusterMaker2 by RBVI.
the class MultipleAttributeMultiplicative method run.
@Override
public void run(TaskMonitor taskMonitor) {
taskMonitor.setProgress(0.0);
taskMonitor.setTitle("Multiple Node Edge Multiplum ranking of clusters");
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Fetching clusters...");
taskMonitor.setProgress(0.1);
List<NodeCluster> clusters = ClusterUtils.fetchClusters(network);
taskMonitor.setProgress(0.5);
String clusterColumnName = ClusterUtils.getClusterAttribute(network);
List<String> nodeAttributes = context.getSelectedNodeAttributes();
List<String> edgeAttributes = context.getSelectedEdgeAttributes();
taskMonitor.setProgress(0.6);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting node scores in clusters");
clusters = ClusterUtils.setNodeScoresInCluster(network, clusters, nodeAttributes, clusterColumnName, true);
taskMonitor.setProgress(0.75);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting edge scores in clusters");
clusters = ClusterUtils.setEdgeScoresInCluster(network, clusters, edgeAttributes, clusterColumnName, true);
taskMonitor.setProgress(0.80);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Sorting and ranking clusters");
ClusterUtils.ascendingSort(clusters);
NodeCluster.setClusterRanks(clusters);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Insert cluster information in tables");
ClusterUtils.insertResultsInColumns(network, clusters, SHORTNAME);
results = new AbstractClusterResults(network, clusters);
taskMonitor.setProgress(1.0);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Done...");
}
use of edu.ucsf.rbvi.clusterMaker2.internal.algorithms.attributeClusterers.Clusters in project clusterMaker2 by RBVI.
the class PR method run.
@Override
public void run(TaskMonitor taskMonitor) {
taskMonitor.setProgress(0.0);
taskMonitor.setTitle("PRWP with Priors ranking of clusters");
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Fetching clusters...");
taskMonitor.setProgress(0.1);
List<NodeCluster> clusters = ClusterUtils.fetchClusters(network);
taskMonitor.setProgress(0.5);
initVariables();
clusters.forEach(NodeCluster::initNodeScores);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting node scores in clusters");
addNodes();
taskMonitor.setProgress(0.6);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Setting edge scores in clusters");
addEdges();
taskMonitor.setProgress(0.7);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Calculating PageRank scores");
PageRank<PRNode, PREdge> pageRank = performPageRank();
taskMonitor.setProgress(0.8);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Inserting scores into clusters");
insertScores(clusters, pageRank);
taskMonitor.setProgress(0.9);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Insert cluster information in tables");
ClusterUtils.insertResultsInColumns(network, clusters, SHORTNAME);
results = new AbstractClusterResults(network, clusters);
taskMonitor.setProgress(1.0);
taskMonitor.showMessage(TaskMonitor.Level.INFO, "Done...");
}
Aggregations