Package de.lmu.ifi.dbs.elki.data

Examples of de.lmu.ifi.dbs.elki.data.LabelList


      List<LabelList> allLabels = new ArrayList<LabelList>();
      for(String line; (line = reader.readLine()) != null; lineNumber++) {
        if(!line.startsWith(COMMENT) && line.length() > 0) {
          List<String> entries = tokenize(line);
          BitSet bitSet = new BitSet();
          LabelList labels = null;

          for(String entry : entries) {
            try {
              Integer index = Integer.valueOf(entry);
              bitSet.set(index);
              dimensionality = Math.max(dimensionality, index);
            }
            catch(NumberFormatException e) {
              if(labels == null) {
                labels = new LabelList(1);
              }
              labels.add(entry);
            }
          }

          bitSets.add(bitSet);
          allLabels.add(labels);
        }
      }

      dimensionality++;
      for(int i = 0; i < bitSets.size(); i++) {
        BitSet bitSet = bitSets.get(i);
        LabelList labels = allLabels.get(i);
        vectors.add(new BitVector(bitSet, dimensionality));
        lblc.add(labels);
      }
    }
    catch(IOException e) {
View Full Code Here


            if(eid != null) {
              lblmap.put(eid.toString(), id);
            }
          }
          if(olq != null) {
            LabelList label = olq.get(id);
            if(label != null) {
              for(String lbl : label) {
                lblmap.put(lbl, id);
              }
            }
View Full Code Here

  protected void parseLineInternal(String line) {
    List<String> entries = tokenize(line);
    int cardinality = Integer.parseInt(entries.get(0));

    TIntFloatHashMap values = new TIntFloatHashMap(cardinality, 1);
    LabelList labels = null;

    for(int i = 1; i < entries.size() - 1; i++) {
      if(!labelIndices.get(i)) {
        try {
          int index = Integer.valueOf(entries.get(i));
          if(index > maxdim) {
            maxdim = index;
          }
          float attribute = Float.valueOf(entries.get(i));
          values.put(index, attribute);
          i++;
        }
        catch(NumberFormatException e) {
          if(labels == null) {
            labels = new LabelList(1);
          }
          labels.add(entries.get(i));
          continue;
        }
      }
      else {
        if(labels == null) {
          labels = new LabelList(1);
        }
        labels.add(entries.get(i));
      }
    }
    curvec = new SparseFloatVector(values, maxdim);
    curlbl = labels;
  }
View Full Code Here

        }
        data[out] = new SparseFloatVector(f, dimsize[out]);
      }
      else if(elkitypes[out] == TypeUtil.LABELLIST) {
        // Build a label list out of successive labels
        LabelList ll = new LabelList(1);
        for(TIntObjectIterator<Object> iter = map.iterator(); iter.hasNext();) {
          iter.advance();
          int i = iter.key();
          if(i < s) {
            continue;
          }
          if(i >= s + dimsize[out]) {
            break;
          }
          String v = (String) iter.value();
          if(ll.size() < i - s) {
            logger.warning("Sparse consecutive labels are currently not correctly supported.");
          }
          ll.add(v);
        }
        data[out] = ll;
      }
      else if(elkitypes[out] == TypeUtil.EXTERNALID) {
        String val = (String) map.get(s);
View Full Code Here

        }
        data[out] = new DoubleVector(cur);
      }
      else if(etyp[out] == TypeUtil.LABELLIST) {
        // Build a label list out of successive labels
        LabelList ll = new LabelList(dimsize[out]);
        for(int k = 0; k < dimsize[out]; k++) {
          if(tokenizer.ttype != StreamTokenizer.TT_WORD) {
            throw new AbortException("Expected word token, got: " + tokenizer.toString());
          }
          ll.add(tokenizer.sval);
          nextToken(tokenizer);
        }
        data[out] = ll;
      }
      else if(etyp[out] == TypeUtil.EXTERNALID) {
View Full Code Here

TOP

Related Classes of de.lmu.ifi.dbs.elki.data.LabelList

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.