Examples of LabelList


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

    try {
      for(String line; (line = reader.readLine()) != null; lineNumber++) {
        if(!line.startsWith(COMMENT) && line.length() > 0) {
          List<String> entries = tokenize(line);
          TDoubleList attributes = new TDoubleArrayList(entries.size());
          LabelList labellist = null;
          for(String entry : entries) {
            try {
              double attribute = Double.parseDouble(entry);
              attributes.add(attribute);
            }
            catch(NumberFormatException e) {
              if(labellist == null) {
                labellist = new LabelList(1);
              }
              labellist.add(entry);
            }
          }

          if(dimensionality < 0) {
            dimensionality = attributes.size();
View Full Code Here

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

   */
  protected void parseLineInternal(String line) {
    List<String> entries = tokenize(line);
    // Split into numerical attributes and labels
    TDoubleArrayList attributes = new TDoubleArrayList(entries.size());
    LabelList labels = null;

    Iterator<String> itr = entries.iterator();
    for(int i = 0; itr.hasNext(); i++) {
      String ent = itr.next();
      if(!labelIndices.get(i)) {
        try {
          double attribute = Double.parseDouble(ent);
          attributes.add(attribute);
          continue;
        }
        catch(NumberFormatException e) {
          // Ignore attempt, add to labels below.
        }
      }
      if(labels == null) {
        labels = new LabelList(1);
      }
      labels.add(ent);
    }

    curvec = createDBObject(attributes, ArrayLikeUtil.TDOUBLELISTADAPTER);
    curlbl = labels;
  }
View Full Code Here

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

      for(String line; (line = reader.readLine()) != null; lineNumber++) {
        if(!line.startsWith(COMMENT) && line.length() > 0) {
          List<String> entries = tokenize(line);
          // FIXME: use more efficient storage right away?
          List<Bit> attributes = new ArrayList<Bit>();
          LabelList ll = null;
          for(String entry : entries) {
            try {
              Bit attribute = Bit.valueOf(entry);
              attributes.add(attribute);
            }
            catch(NumberFormatException e) {
              if(ll == null) {
                ll = new LabelList(1);
              }
              ll.add(entry);
            }
          }

          if(dimensionality < 0) {
            dimensionality = attributes.size();
View Full Code Here

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

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

            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

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

  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

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

        }
        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

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

        }
        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

Examples of temp.LabelList

    targets = t;
  }

  public JUMP(Label target)
  {
    this(new NAME(target), new LabelList(target, null));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.