Пример #1
0
  /** calculates HCL on SOTA cells (clusters) */
  private void calculateClusterHCL() throws AlgorithmException {

    AlgorithmEvent event = null;

    event =
        new AlgorithmEvent(
            this,
            AlgorithmEvent.SET_UNITS,
            numberOfClusters,
            "Calculate Hierarchical Trees SOTA Cluster Members");
    fireValueChanged(event);
    event.setIntValue(0);
    event.setId(AlgorithmEvent.PROGRESS_VALUE);
    fireValueChanged(event);

    Cluster result_cluster = new Cluster();
    NodeList nodeList = result_cluster.getNodeList();

    // clusters are formed after growSOT

    NodeList resultList = clusters.getNodeList();
    Node currNode;

    int[] probeIndexes;

    for (int i = 0; i < numberOfClusters; i++) {
      if (stop) {
        throw new AbortException();
      }
      currNode = resultList.getNode(i);
      probeIndexes = currNode.getProbesIndexes();

      Node node = new Node(probeIndexes);
      nodeList.addNode(node);

      node.setValues(
          calculateHierarchicalTree(probeIndexes, method, calculate_genes, calculate_experiments));
      event.setIntValue(i + 1);
      fireValueChanged(event);
    }

    if (result_cluster != null) inData.addCluster("hcl-result-clusters", result_cluster);
  }
Пример #2
0
  /** Calculates HCL tree over all genes */
  private void calcFullTreeHCL() throws AlgorithmException {

    AlgorithmEvent event = null;
    event =
        new AlgorithmEvent(
            this,
            AlgorithmEvent.SET_UNITS,
            1,
            "Calculate Hierarchical Tree, Clustering Experiments");
    fireValueChanged(event);
    event.setIntValue(0);
    event.setId(AlgorithmEvent.PROGRESS_VALUE);
    fireValueChanged(event);

    Cluster result_cluster = new Cluster();
    NodeList nodeList = result_cluster.getNodeList();

    int[] probesIndexes = new int[numberOfGenes];
    for (int i = 0; i < numberOfGenes; i++) {
      probesIndexes[i] = i;
    }

    int[] featuresIndexes = new int[numberOfSamples];
    for (int i = 0; i < numberOfSamples; i++) {
      featuresIndexes[i] = i;
    }

    if (stop) {
      throw new AbortException();
    }

    Node node = new Node(featuresIndexes);
    nodeList.addNode(node);

    node.setValues(calculateHierarchicalTree(probesIndexes, method, false, true));
    event.setIntValue(1);
    fireValueChanged(event);

    if (result_cluster != null) inData.addCluster("full-tree-sample-HCL", result_cluster);
  }
Пример #3
0
 public void valueChanged(AlgorithmEvent event) {
   switch (event.getId()) {
     case AlgorithmEvent.SET_UNITS:
       progress.setUnits(event.getIntValue());
       progress.setDescription(event.getDescription());
       break;
     case AlgorithmEvent.PROGRESS_VALUE:
       progress.setValue(event.getIntValue());
       progress.setDescription(event.getDescription());
       break;
     case AlgorithmEvent.MONITOR_VALUE:
       int value = event.getIntValue();
       if (value == -1) {
         // monitor.dispose();
       } else {
         // monitor.update(value);
       }
       break;
   }
 }
Пример #4
0
  /** grows SOT */
  private void growSOT() {

    AlgorithmEvent event = new AlgorithmEvent(this, AlgorithmEvent.SET_UNITS, maxNumCycles);
    fireValueChanged(event);

    AlgorithmEvent event1 =
        new AlgorithmEvent(this, AlgorithmEvent.SET_UNITS, maxNumCycles, "Growing Tree");
    fireValueChanged(event1);
    event1.setIntValue(0);
    event1.setId(AlgorithmEvent.PROGRESS_VALUE);
    fireValueChanged(event1);

    float currDivFraction;
    boolean stopGrowing = false;
    float lowerLim;

    if (!useClusterVariance && mostDiverseCell.cellDiversity < endCriteria) stopGrowing = true;
    else if (useClusterVariance && mostVariableCell.cellVariance < endCriteria) stopGrowing = true;

    for (cycleNum = 0; cycleNum < maxNumCycles && !stopGrowing; cycleNum++) {

      runCycle(maxNumEpochs, epochCriteria);

      // training has optimized the sub-system centroids, trained node's profiles have been
      // distributed
      // among potentially any cluster (closest chosen)

      // now with all profiles assigned to cells, get the cell's and tree's diversity (Resource)
      setDiversities();

      cycleDiversity.add(new Float(treeDiversity));

      if (!useClusterVariance) {
        if (mostDiverseCell.cellDiversity > endCriteria
            && cycleNum < maxNumCycles - 1) // don't split if last cycle in maxNumCycles
        divideCell(mostDiverseCell);
        else stopGrowing = true;
      } else { // using variabliity
        if (mostVariableCell.cellVariance > endCriteria
            && cycleNum < maxNumCycles - 1) // don't split if last cycle in maxNumCycles
        divideCell(mostVariableCell);
        else stopGrowing = true;
      }

      // advance monitor
      event1.setId(AlgorithmEvent.PROGRESS_VALUE);
      event1.setIntValue(cycleNum + 1);
      fireValueChanged(event1);

      // calculate and set monitor values
      // event.setId(AlgorithmEvent.MONITOR_VALUE);
      /*  DISABLED OPTIONAL DIVERSITY MONITOR
      if(myFactor == 1)
          currDivFraction = (float)(treeDiversity/initDivSum);
      else{
          lowerLim = numberOfGenes * myFactor;
          currDivFraction = (float)((treeDiversity + Math.abs(lowerLim))/(initDivSum+Math.abs(lowerLim)));
      }
      if(cycleNum < 245){    //monitor values limit is 245
          event.setIntValue((int)(100*currDivFraction));
          fireValueChanged(event);
      }
       */
    }
    trainLeaves(
        maxNumEpochs,
        epochCriteria); // reached stopping criteria, now just need to train leaves so centroids
                        // migrate to center
    getResults(); // add results to AlgorithmData (inData)
    return;
  }
Пример #5
0
 public void valueChanged(AlgorithmEvent event) {
   logger.append(event.getDescription());
 }