Search in sources :

Example 1 with IParameterTraining

use of edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.TransClust.de.layclust.layout.parameter_training.IParameterTraining in project clusterMaker2 by RBVI.

the class ClusteringManager method runClusteringForOneConnectedComponent.

/**
 * Runs clustering for one {@link ConnectedComponent} and sets the total score to
 * the parameters if in the general training mode.
 * @param cc The connected component object.
 * @param clusterFile The clusters file (null if in general training mode)
 * @param semaphore The Semaphore to give to the clustering task to keep track of it.
 * @param time
 * @throws InvalidInputFileException
 */
public void runClusteringForOneConnectedComponent(ConnectedComponent cc, ClusterFile clusterFile, Semaphore semaphore, Semaphore maxThreadSemaphore, long time) throws InvalidInputFileException {
    /* check whether layouterParameters has been initialised */
    if (this.layouterParameters == null) {
        if (TaskConfig.mode == TaskConfig.CLUSTERING_MODE || TaskConfig.mode == TaskConfig.GENERAL_TRAINING_MODE)
            log.warning("Incorrect use of the ClusteringManager, the layouter parameters list" + "hadn't been initialised. Called method to initialise this and the connected components from " + "the config");
        this.initParametersAndCCs();
    }
    // if(TaskConfig.mode == TaskConfig.CLUSTERING_MODE){
    if (TaskConfig.doLayoutParameterTraining && !TaskConfig.greedy) {
        for (int i = 0; i < this.layouterParameters.length; i++) {
            /* start parameter training for the cc */
            IParameterTraining paramTrain = TaskConfig.parameterTrainingEnum.createParameterTrainer();
            paramTrain.initialise(TaskConfig.layouterEnumTypes[i], TaskConfig.noOfParameterConfigurationsPerGeneration, TaskConfig.noOfGenerations);
            paramTrain.setMaxThreadSemaphoreAndThreadsList(maxThreadSemaphore, this.allThreads);
            IParameters bestparam = paramTrain.run(cc);
            log.fine("PARAMETER TRAINING RESULT\n: " + cc.getCcPath() + "\n" + bestparam.toString());
            this.layouterParameters[i] = bestparam;
        }
    }
    // }
    /* run clustering with the previously determined parameters */
    ClusteringTask clusterTask = new ClusteringTask(cc, this.layouterParameters, TaskConfig.layouterEnumTypes, clusterFile);
    clusterTask.setTime(time);
    // if(!TaskConfig.doLayoutParameterTraining&&TaskConfig.useThreads){
    // clusterTask.setSemaphore(semaphore);
    // Thread t = new Thread(clusterTask);
    // clusterTask.setMaxThreadSemaphore(maxThreadSemaphore, allThreads, t);
    // t.start();
    // }else{
    clusterTask.run();
// }
}
Also used : IParameters(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.TransClust.de.layclust.layout.IParameters) IParameterTraining(edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.TransClust.de.layclust.layout.parameter_training.IParameterTraining)

Aggregations

IParameters (edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.TransClust.de.layclust.layout.IParameters)1 IParameterTraining (edu.ucsf.rbvi.clusterMaker2.internal.algorithms.networkClusterers.TransClust.de.layclust.layout.parameter_training.IParameterTraining)1