Package gnu.trove

Examples of gnu.trove.TIntArrayList


      Alphabet valueAlph = new Alphabet();
      File directory = new File(classDirs.value[i]);
      File[] subdirs = getSubDirs(directory);
      Alphabet clusterAlph = new Alphabet();
      InstanceList instances = new InstanceList(new Noop());
      TIntArrayList labels = new TIntArrayList();
      for (int j = 0; j < subdirs.length; j++) {
        ArrayList<File> records = new FileIterator(subdirs[j]).getFileArray();
        int label = clusterAlph.lookupIndex(subdirs[j].toString());
        for (int k = 0; k < records.size(); k++) {
          if (fi % 100 == 0) System.out.print(fi);
          else if (fi % 10 == 0) System.out.print(".");
          if (fi % 1000 == 0 && fi > 0) System.out.println();
          System.out.flush();
          fi++;


          File record = records.get(k);
          labels.add(label);
          instances.add(new Instance(new Record(fieldAlph, valueAlph, parseFile(record)),
                        new Integer(label), record.toString(),
                        record.toString()));
        }
      }
      clusterings[i] =
          new Clustering(instances, subdirs.length, labels.toNativeArray());
    }

    logger.info("\nread " + fi + " objects in " + clusterings.length + " clusterings.");
    try {
      ObjectOutputStream oos =
View Full Code Here


    this.normalized = normalized;
    this.numDimensions = 0;
    this.constraints = new TIntObjectHashMap<OneLabelL2IndPRConstraint>();
    // this will be set by the PRTrainer
    this.map = null;
    this.cache = new TIntArrayList();
  }
View Full Code Here

    for (int key : constraints.keys()) {
      this.constraints.put(key, constraints.get(key).copy());
      numDimensions += constraints.get(key).getNumConstrainedLabels();
    }
    this.map = map;
    this.cache = new TIntArrayList();
  }
View Full Code Here

  // provided in preprocess call
  protected TIntArrayList cache;

  public OneLabelGEConstraints() {
    this.constraints = new TIntObjectHashMap<OneLabelGEConstraint>();
    this.cache = new TIntArrayList();
  }
View Full Code Here

  }
 
  protected OneLabelGEConstraints(TIntObjectHashMap<OneLabelGEConstraint> constraints, StateLabelMap map) {
    this.constraints = constraints;
    this.map = map;
    this.cache = new TIntArrayList();
  }
View Full Code Here

    }
  }
 
  public void computeExpectations(ArrayList<SumLattice> lattices) {
    double[][] gammas;   
    TIntArrayList cache = new TIntArrayList();
    for (int i = 0; i < lattices.size(); i++) {
      if (lattices.get(i) == null) { continue; }
      SumLattice lattice = lattices.get(i);
      FeatureVectorSequence fvs = (FeatureVectorSequence)lattice.getInput();
      gammas = lattice.getGammas();
      for (int ip = 0; ip < fvs.size(); ++ip) {
        cache.resetQuick();
        FeatureVector fv = fvs.getFeatureVector(ip);
        int fi;
        for (int loc = 0; loc < fv.numLocations(); loc++) {
          fi = fv.indexAtLocation(loc);
          // binary constraint features
          if (constraints.containsKey(fi)) {
            cache.add(fi);
          }
        }
        if (constraints.containsKey(fv.getAlphabet().size())) {
          cache.add(fv.getAlphabet().size());
        }
        for (int s = 0; s < map.getNumStates(); ++s) {
          int li = map.getLabelIndex(s);
          if (li != StateLabelMap.START_LABEL) {
            double gammaProb = Math.exp(gammas[ip+1][s]);
            for (int j = 0; j < cache.size(); j++) {
              constraints.get(cache.getQuick(j)).expectation[li] += gammaProb;
            }
          }
        }
      }
    }
View Full Code Here

  protected TIntArrayList cache;

  public OneLabelL2PRConstraints(boolean normalized) {
    this.constraints = new TIntObjectHashMap<OneLabelPRConstraint>();
    this.constraintIndices = new TIntIntHashMap();
    this.cache = new TIntArrayList();
    this.normalized = normalized;
  }
View Full Code Here

    }
   
    //this.constraints = constraints;
    this.constraintIndices = constraintIndices;
    this.map = map;
    this.cache = new TIntArrayList();
    this.normalized = normalized;
  }
View Full Code Here

  // provided in preprocess call
  protected TIntArrayList cache;

  public OneLabelL2RangeGEConstraints() {
    this.constraints = new TIntObjectHashMap<OneLabelL2IndGEConstraint>();
    this.cache = new TIntArrayList();
  }
View Full Code Here

  }
 
  protected OneLabelL2RangeGEConstraints(TIntObjectHashMap<OneLabelL2IndGEConstraint> constraints, StateLabelMap map) {
    this.constraints = constraints;
    this.map = map;
    this.cache = new TIntArrayList();
  }
View Full Code Here

TOP

Related Classes of gnu.trove.TIntArrayList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.